Skip to content

bug: incorrect parsing of indented single - in Markdown #202

@liftctrl

Description

@liftctrl

Did you check existing issues?

  • I have read all the tree-sitter docs if it relates to using the parser
  • I have searched the existing issues

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

The Markdown parser incorrectly parses a single indented - as a Setext-style H2 heading.

Steps To Reproduce/Bad Parse Tree

  1. Start Neovim with no plugins loaded:
nvim --clean
  1. Create a markdown file with the following content:
- setup
  -
  1. Run :InspectTree on the first line in Neovim.
(document ; [0, 0] - [2, 0]
  (section ; [0, 0] - [2, 0]
    (list ; [0, 0] - [2, 0]
      (list_item ; [0, 0] - [2, 0]
        (list_marker_minus) ; [0, 0] - [0, 2]
        (setext_heading ; [0, 2] - [2, 0]
          heading_content: (paragraph ; [0, 2] - [1, 2]
            (inline ; [0, 2] - [0, 7]
              (inline)) ; [0, 2] - [0, 7]
            (block_continuation)) ; [1, 0] - [1, 2]
          (setext_h2_underline)))))) ; [1, 2] - [1, 3]

Expected Behavior/Parse Tree

  • The first line - setup should be parsed as a list item.
  • The second line with the indented - should be parsed as an empty child list item.

Repro

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions