author | Olivier Brunel
<jjk@jjacky.com> 2023-01-13 10:43:42 UTC |
committer | Olivier Brunel
<jjk@jjacky.com> 2023-01-13 10:54:17 UTC |
parent | 002c508eb01f81af169ac50a8f22de817f7aa77c |
doc/qmdoc.1.md | +3 | -0 |
src/main.c | +1 | -1 |
diff --git a/doc/qmdoc.1.md b/doc/qmdoc.1.md index c2aa7c7..dddd441 100644 --- a/doc/qmdoc.1.md +++ b/doc/qmdoc.1.md @@ -312,6 +312,9 @@ its language is set to `pre` ! HINT: ! It is of course possible to have line numbering for `pre` blocks, either by ! using another term as language, e.g. `raw`, or by adding `from=1` +! +! You can also use `from=0` to disable the line numbers, all the while keeping +! the alternate line background as well as language name being shown. # INDENTATION diff --git a/src/main.c b/src/main.c index c7bda86..75c7158 100644 --- a/src/main.c +++ b/src/main.c @@ -803,7 +803,7 @@ leave_block(MD_BLOCKTYPE type, void *details, void *ctx_) if (!raw_str(ctx, "<div class=\"code\"><pre class=\"lineno\">")) return ERR_PARSER_BUFFERED; - for (int n = ctx->code.from; s; ++n) { + for (int n = ctx->code.from; n > 0 && s; ++n) { const char *e = memchr(s, '\n', l); if (!e) break; l -= ++e - s;