Repository navigation
[markdown] Fix setext heading precedence over lists in gitHubFlavored - #2510
Merged
srawlins merged 1 commit intoAug 13, 2026
Merged
Conversation
ExtensionSet.gitHubFlavored checked UnorderedListWithCheckboxSyntax before SetextHeaderSyntax, so a lone `-`/`=` line continuing a paragraph was parsed as an empty list item instead of a setext heading underline (unlike the default parser and gitHubWeb, which already order this correctly). Fixes dart-lang#2108.
Contributor
There was a problem hiding this comment.
Code Review
This pull request fixes an issue in ExtensionSet.gitHubFlavored where a lone - or = line continuing a paragraph was incorrectly parsed as an empty list item instead of a setext heading underline. This is resolved by adding SetextHeaderSyntax before the list syntaxes in the block syntaxes list. A regression test has been added to verify this behavior. There are no review comments, and I have no additional feedback to provide.
srawlins
approved these changes
Aug 13, 2026
tomyeh
added a commit
to tomyeh/markd
that referenced
this pull request
Sep 24, 2026
…ake AutolinkExtensionSyntax.emailPattern public * Fix quadratic parsing time on a long unbroken run of word characters ending a line (dart-lang/tools#2536) * Fix performance and correctness of the HTML comment parser; processing instructions, declarations and CDATA sections may span lines; tag names accept uppercase letters (dart-lang/tools#2121) * Fix nested list structure when indented by tabs (dart-lang/tools#2173) * Escape image description text when assigning it to the alt attribute (dart-lang/tools#2478) * markdownToHtml respects enableTagfilter when inlineOnly is true; the tag filter covers tags with attributes, spaces, self-closing and closing tags (dart-lang/tools#2471, dart-lang/tools#2472) * Bound the email regex quantifiers in AutolinkExtensionSyntax (dart-lang/tools#2474) * ExtensionSet.gitHubFlavored: setext heading underline takes precedence over an empty list item (dart-lang/tools#2510) * AutolinkExtensionSyntax.emailPattern is public, for reuse by Quire Co-author: Claude Fable 5.1
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.
Summary
ExtensionSet.gitHubFlavored's block syntax list checkedUnorderedListWithCheckboxSyntaxbeforeSetextHeaderSyntax. Since customdocument.blockSyntaxesare always tried before the standard ones inBlockParser.parseLines, a lone-/=line continuing a paragraph was parsed as an empty list item instead of a setext heading underline — unlike the default parser (which ordersSetextHeaderSyntaxfirst) andExtensionSet.gitHubWeb(which already putsSetextHeaderWithIdSyntaxbefore its list syntaxes).This matches CommonMark / GitHub's own rendering (confirmed in the issue by @lrhn) — see https://spec.commonmark.org/dingus/?text=I%20am%20paragraph%0A-.
Fixes #2108 (duplicate of #1953).
Changes
SetextHeaderSyntaxtoExtensionSet.gitHubFlavored's block syntax list, ordered before the list syntaxes.test/regression_test.dart.7.4.0section.Test plan
dart test— fullmarkdownsuite passes (2763 passed, 1 pre-existing skip, 0 failures)dart analyze --fatal-infos .— no issuesdart format --output=none --set-exit-if-changedon changed files — no changes needed