Skip to content

[markdown] Putting UnorderedListWithCheckboxSyntax before SetextHeaderSyntax leads to incorrect parsing of "a\n-" #1953

Closed as not planned

Description

@w568w

(I'm opening a blank issue because the package:markdown issue type isn't available on the New Issue page.)

Problem

If UnorderedListWithCheckboxSyntax precedes SetextHeaderSyntax in BlockParser's blockSyntaxes (as is the case when ExtensionSet.gitHubFlavored is enabled, due to its inclusion of UnorderedListWithCheckboxSyntax), the following text will be rendered as an empty list item:

I am paragraph
-

Actual Output

I am paragraph is ignored, producing an empty list item, as follows:

Expected Output

I am paragraph should be rendered as a SETEXT-style heading. Check:

https://spec.commonmark.org/dingus/?text=I%20am%20paragraph%0A-

Minimal Reproducible Example

import 'package:markdown/markdown.dart' as md;

void main() {
  final md.Document document = md.Document(
    blockSyntaxes: [
      const md.UnorderedListSyntax(), // <-- This line breaks the case
    ],
  );
  final List<md.Node> astNodes = document.parse("I am paragraph\n-");
  print((astNodes[0] as md.Element).tag); // should print: h2; actual print: ul
}

Activity

  1. changed the title [-][markdown] Putting `UnorderedListWithCheckboxSyntax` before `SetextHeaderSyntax` leads to incorrect parsing[/-] [+][markdown] Putting `UnorderedListWithCheckboxSyntax` before `SetextHeaderSyntax` leads to incorrect parsing of `"a\n-"`[/+] on Dec 31, 2024
  2. w568w commented on Jun 7, 2025

    @w568w
    Author

    Close in favor of #2108.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions