Conversation
…aragraph/list/blockquote interactions - Allow 0-3 leading spaces in setext heading underlines (fixes spec examples 48, 50) - Thematic breaks now interrupt paragraphs (fixes spec examples 23, 52) - Thematic breaks now interrupt lazy blockquote continuations (fixes spec examples 56, 64) - Thematic breaks now interrupt list item continuations (fixes spec examples 22, 57, 62) - Thematic breaks with 4+ leading spaces no longer recognised as HR (fixes spec examples 14, 51) Net result: Thematic breaks 16→18/19 passing, Setext headings 10→17/20 passing. All 222 existing Markdown tests and 101 Literate tests continue to pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ic-25affc9f5e6ac001
Contributor
|
/repo-assist Show me the remote heads by running |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been minimized.
This comment has been minimized.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
12 tasks
dsyme
approved these changes
Feb 27, 2026
…ic-25affc9f5e6ac001
Contributor
|
@nojaf I'll merge this as its just increasing compliance step by step, seems fine as long as more tests pass |
Contributor
|
Oh actually no new tests have been enabled! |
Contributor
|
/repo-assist please add or enable more commonmark tests corresponding to this change |
…gs' sections Add the two sections to enabledSections, covering 35 additional spec examples (18 Thematic breaks + 17 Setext headings). The four known remaining failures (examples 26, 55, 58, 65) are listed in a skippedExamples set so they are excluded until the underlying parser issues are resolved. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
Commit pushed:
|
dsyme
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is a pull request created by Repo Assist, an automated AI assistant.
Closes #191 (partial progress)
Summary
This PR improves CommonMark spec compliance in the Markdown parser, building on the ATX heading improvements merged in #1028. It addresses correctness of thematic breaks and setext headings, with a particular focus on how these interact with paragraphs, list items, and blockquotes.
Changes to
MarkdownParser.fs1. Thematic breaks now interrupt paragraphs (
TakeParagraphLines)A thematic break (
***,---,___,- - -, etc.) now correctly ends a running paragraph. Previously,Foo\n***\nbarwas rendered as a single paragraph containing***; it now produces<p>Foo</p><hr /><p>bar</p>.CommonMark spec examples fixed: 23, 52
2. Thematic breaks now interrupt list item continuations (
LinesUntilListOrWhite)A thematic break following a list item no longer gets absorbed as lazy continuation content. Previously,
- foo\n---created a setext heading inside the list item; it now produces a list followed by<hr />.CommonMark spec examples fixed: 22, 57, 62
3. Thematic breaks now interrupt lazy blockquote continuations (
LinesUntilBlockquoteEnds)A thematic break following a blockquote line no longer gets absorbed as lazy continuation content. Previously,
> foo\n---created a setext heading inside the blockquote; it now produces a blockquote followed by<hr />.CommonMark spec examples fixed: 56, 64
4. Thematic breaks with 4+ leading spaces are rejected (
HorizontalRule)The
HorizontalRulepattern now rejects lines with 4 or more leading spaces, matching the CommonMark rule that 4+ spaces create an indented code block instead. Previously,***was mistakenly recognised as a thematic break.CommonMark spec examples fixed (regressions prevented): 14, 51
5. Setext heading underlines allow 0–3 leading spaces (
isSetextUnderline+Heading)The setext heading detection now uses a new
isSetextUnderlinehelper that accepts 0–3 leading spaces in the underline row (e.g.===or---), matching the CommonMark spec. Also adds a non-empty content guard to prevent matching an empty line followed by a setext underline as a heading.CommonMark spec examples fixed: 48, 50
CommonMark Spec Results
Remaining failures are more complex cases requiring further investigation:
* * *needs block-level (not inline) parsing---Test Status
✅ All 222 Markdown tests pass (0 failures, 0 regressions).
✅ All 101 Literate tests pass.
✅ Build succeeds.
✅ Code formatted with Fantomas.