author | Olivier Brunel
<jjk@jjacky.com> 2023-01-06 10:16:22 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-01-06 10:48:57 UTC |
parent | c78a96b5e99d5ffd7b39183380d286271ba19e3d |
main.c | +8 | -6 |
diff --git a/main.c b/main.c index d72439f..c72586a 100644 --- a/main.c +++ b/main.c @@ -762,7 +762,7 @@ leave_block(MD_BLOCKTYPE type, void *details, void *ctx_) e = memchr(d->info.text, ' ', d->info.size); codelen = (e) ? e - d->info.text : d->info.size; - if (!raw_str(ctx, "<pre class=\"lineno\">")) + if (!raw_str(ctx, "<div class=\"code\"><pre class=\"lineno\">")) return ERR_PARSER_BUFFERED; for (int n = ctx->code.from; s; ++n) { const char *e = memchr(s, '\n', l); @@ -792,11 +792,13 @@ leave_block(MD_BLOCKTYPE type, void *details, void *ctx_) r = escape_text(ctx, buf, blen); if (!r) return ERR_PARSER_BUFFERED; - if ((ctx->code.flags & CODE_LINES) && !raw_str(ctx, "</code>")) - return ERR_PARSER_BUFFERED; - - if (!raw_str(ctx, "</pre>")) - return ERR_PARSER_BUFFERED; + if (ctx->code.flags & CODE_LINES) { + if (!raw_str(ctx, "</code></pre></div>")) + return ERR_PARSER_BUFFERED; + } else { + if (!raw_str(ctx, "</pre>")) + return ERR_PARSER_BUFFERED; + } ctx->code.flags = 0; }