--- title = Highlight --- # Highlight ---------- This header provides an highlighter for c-like languages (mostly c). The usage is simple, first create a highlight context using hlInit, for which you need an hl_config_t. The only mandatory argument is colors, which are the strings put before the keywords in the highlighted text. You can also pass some flags: * `HL_FLAG_HTML`: escapes html characters If you're using the offline documentation, this is the code used to highlight inside the markdown code blocks (simplified to remove actual markdown parsing): ```c str_t highlight_code_block(arena_t *arena, strview_t code) { uint8 tmpbuf[KB(5)]; arena_t scratch = arenaMake(ARENA_STATIC, sizeof(tmpbuf), tmpbuf); hl_ctx_t *hl = hlInit(&scratch, &(hl_config_t){ .colors = { [HL_COLOR_NORMAL] = strv(""), [HL_COLOR_PREPROC] = strv(""), [HL_COLOR_TYPES] = strv(""), [HL_COLOR_CUSTOM_TYPES] = strv(""), [HL_COLOR_KEYWORDS] = strv(""), [HL_COLOR_NUMBER] = strv(""), [HL_COLOR_STRING] = strv(""), [HL_COLOR_COMMENT] = strv(""), [HL_COLOR_FUNC] = strv(""), [HL_COLOR_SYMBOL] = strv(""), [HL_COLOR_MACRO] = strv(""), }, .flags = HL_FLAG_HTML, }); } ```