author | Olivier Brunel
<jjk@jjacky.com> 2022-12-29 20:46:51 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2022-12-29 20:46:51 UTC |
parent | 65608385709709861334e0bc652b31a63f24e968 |
base.md | +3 | -3 |
main.c | +11 | -1 |
diff --git a/base.md b/base.md index 24e95fc..e4571fb 100644 --- a/base.md +++ b/base.md @@ -78,18 +78,18 @@ in ``pre``/``code`` blocks too (unlike the others) : This is a line. It continues here, but <hl>watch out</hl> for - the highlight. + the =highlight=. Which, also, can <hl>spawn multiple lines</hl>. Yep. -Well no, there's no highlight in there. It's not in basic ``pre`` blocks, that +Well no, there's no =highlight= in there. It's not in basic ``pre`` blocks, that is indented ones. But we can do it though, easy peasy : ```pre hl This is a line. It continues here, but <hl>watch out</hl> for -the highlight. +the =highlight=. Which, also, can <hl>spawn multiple lines</hl>. Yep. ``` diff --git a/main.c b/main.c index 524048d..641fd1e 100644 --- a/main.c +++ b/main.c @@ -719,6 +719,11 @@ enter_span(MD_SPANTYPE type, void *details, void *ctx_) return ERR_PARSER_ENTER_SPAN; break; + case MD_SPAN_HIGHLIGHT: + if (!raw_str(ctx, "<span class=\"highlighted\">")) + return ERR_PARSER_ENTER_SPAN; + break; + case MD_SPAN_LATEXMATH: case MD_SPAN_LATEXMATH_DISPLAY: case MD_SPAN_WIKILINK: @@ -768,6 +773,11 @@ leave_span(MD_SPANTYPE type, void *details, void *ctx_) return ERR_PARSER_LEAVE_SPAN; break; + case MD_SPAN_HIGHLIGHT: + if (!raw_str(ctx, "</span>")) + return ERR_PARSER_LEAVE_SPAN; + break; + case MD_SPAN_LATEXMATH: case MD_SPAN_LATEXMATH_DISPLAY: case MD_SPAN_WIKILINK: @@ -879,7 +889,7 @@ convert_page(struct ctx *ctx, int fddest) const MD_PARSER parser = { .flags = MD_FLAG_COLLAPSEWHITESPACE | MD_FLAG_PERMISSIVEAUTOLINKS | MD_FLAG_NOHTMLBLOCKS | MD_FLAG_STRIKETHROUGH | MD_FLAG_UNDERLINE - | MD_FLAG_ITALIC | MD_FLAG_BOLD | MD_FLAG_BOX, + | MD_FLAG_ITALIC | MD_FLAG_BOLD | MD_FLAG_BOX | MD_FLAG_HIGHLIGHT, .enter_block = enter_block, .leave_block = leave_block, .enter_span = enter_span,