Split out of #4 / #5, which fix only the crash.
What
On page 72 of Nephrology.pdf (IMP-2026-00001) the cleanup remediation pass promoted a bold numbered clause into a real heading:
## 5. The transplant coordinator also has the responsibility to maintain up to date records and reports as required for the Renal Transplant license.
sectionize() believes it and opens a section. #5 stops that from failing the import by truncating the title, so the tree now gets a section titled "5. The transplant coordinator also has the responsibility to maintain up to date records and reports as required for the Renal…" — the import passes, the tree is still wrong, and the wiki gets a page for it.
The existing _looks_like_list_item guard doesn't catch this: it only fires on a stray * or double numbering, and only for level-1 headings. This one is a clean ##.
Direction
A heading that runs long and closes like a sentence is body text the parser or the cleanup pass mis-promoted — real headings are short and rarely end in terminal punctuation. It should stay in the section it was found in rather than opening one, with the embedded ToC still authoritative where it lists the title.
Before implementing
The threshold is the whole question, and it should not be guessed. Sweep the existing Source Section titles across every document on wikify.m.frappe.cloud, and pick the length and punctuation rule from what that shows — including how many current headings the rule would reclassify. This changes how every document is split, so the regression surface is real.
Split out of #4 / #5, which fix only the crash.
What
On page 72 of
Nephrology.pdf(IMP-2026-00001) the cleanup remediation pass promoted a bold numbered clause into a real heading:sectionize()believes it and opens a section. #5 stops that from failing the import by truncating the title, so the tree now gets a section titled "5. The transplant coordinator also has the responsibility to maintain up to date records and reports as required for the Renal…" — the import passes, the tree is still wrong, and the wiki gets a page for it.The existing
_looks_like_list_itemguard doesn't catch this: it only fires on a stray*or double numbering, and only for level-1 headings. This one is a clean##.Direction
A heading that runs long and closes like a sentence is body text the parser or the cleanup pass mis-promoted — real headings are short and rarely end in terminal punctuation. It should stay in the section it was found in rather than opening one, with the embedded ToC still authoritative where it lists the title.
Before implementing
The threshold is the whole question, and it should not be guessed. Sweep the existing
Source Sectiontitles across every document onwikify.m.frappe.cloud, and pick the length and punctuation rule from what that shows — including how many current headings the rule would reclassify. This changes how every document is split, so the regression surface is real.