From 2c977623738be5f4bbb8807e6893bf0c48014390 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Mon, 2 Nov 2026 12:51:06 -1000 Subject: Keep counting across a split ordered list --- custom/extensions/about-render.lua | 9 ++++++++- tests/extensions/test-about-render.lua | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/custom/extensions/about-render.lua b/custom/extensions/about-render.lua index 5738b00..35f30d0 100644 --- a/custom/extensions/about-render.lua +++ b/custom/extensions/about-render.lua @@ -309,7 +309,13 @@ local function emit_blocks(blocks) html("") elseif kind == "list" then local tag = block.ordered and "ol" or "ul" - html("<" .. tag .. ">") + html("<" .. tag) + -- Even a blank line between two items ends a list, so the next + -- one keeps counting from the number its first item gives. + if block.ordered and block.start ~= 1 then + html(" start='" .. block.start .. "'") + end + html(">") for _, item in ipairs(block.items) do html("
  • ") emit_lines(item) @@ -626,6 +632,7 @@ if has_lpeg then blocks[#blocks + 1] = { kind = "list", ordered = is_ordered, + start = is_ordered and tonumber(mark:match("%d+")), items = items, } -- Four spaces or a tab start a code block, except straight diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua index feb1a68..95e95bb 100644 --- a/tests/extensions/test-about-render.lua +++ b/tests/extensions/test-about-render.lua @@ -307,6 +307,13 @@ h.contains("dashes render an unordered list", out, "