Skip to content

Commit 7391bf9

Browse files
committed
fix(html-reader): stop pandoc from collapsing bold-lead-in lists into a paragraph
The book style writes a bold label then a list with no blank line between them: **触发分离的条件**: - 输入序列长度 > 某阈值 Strict CommonMark (pandoc default -f markdown) requires a blank line before a list, so it folded every such list into a single <p>. Measured 640 occurrences across 13 books — troubleshooting checklists and diagnostic steps shipped in the offline HTML reader as run-on paragraphs, while GitBook, GitHub, and the PDF all rendered them correctly. The source was fine; only this reader was wrong. Fix is the additive pandoc extension markdown+lists_without_preceding_blankline, verified on real book content through real pandoc: the three bullets that previously joined into one <p> now produce <ul><li>, with no effect on ordinary paragraphs or on tables (pipe_tables stays enabled).
1 parent 4175760 commit 7391bf9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/build_html_reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def main():
218218
tpl = "/tmp/_book_template.html"; out_tmp = "/tmp/_book_out.html"
219219
with open(tmp_md, "w", encoding="utf-8") as f: f.write(combined)
220220
with open(tpl, "w", encoding="utf-8") as f: f.write(TEMPLATE)
221-
cmd = ["pandoc", "_combined_tmp.md", "-f", "markdown", "-t", "html5",
221+
cmd = ["pandoc", "_combined_tmp.md", "-f", "markdown+lists_without_preceding_blankline", "-t", "html5",
222222
"--standalone", "--embed-resources", "--mathml",
223223
"--template", tpl, "--metadata", f"title={a.title}", "-o", out_tmp]
224224
print(" running pandoc ...")

0 commit comments

Comments
 (0)