fix: require whitespace after an ATX heading marker - #43
Conversation
Benchmark ResultsComparison of Open to see the benchmark resultsNo benchmark changes above ±5%. Generated by phpbench against commit 8e924a0 |
|
Please fix the merge conflicts before merging |
6faff73 to
8e924a0
Compare
|
Rebased on While re-checking it against a personal dataset of real-world Markdown, this turns out to change a few hundred documents, all in the same direction. A line starting with #[Book now](#reservation)
Note the |
Closes part of #37 (point 4).
HeadingRule::shouldParse()only checked that the line starts with#, so any#-prefixed word became a heading:CommonMark §4.2: an ATX heading is "a string of characters, parsed as inline content, between an opening sequence of 1–6 unescaped
#characters and an optional closing sequence", and "the opening sequence of#characters must be followed by spaces or tabs, or by the end of line".shouldParse()now checks both conditions:#titre<h1 id="titre">titre</h1><p>#titre</p>#5 bolt<h1 id="5-bolt">5 bolt</h1><p>#5 bolt</p>####### seven<h7><p>####### seven</p># Titre<h1 id="titre">Titre</h1>#<h1></h1>The seven-marker case also stops emitting an
<h7>element, which isn't HTML.composer test(331 tests),lintandanalyseare clean.