tree-sitter-grammars / tree-sitter-markdown

Markdown grammar for tree-sitter
MIT License
430 stars 56 forks source link

markdown-inline grammar fails tests #136

Closed msva closed 8 months ago

msva commented 9 months ago

Hi there!

It seems, markdown-inline grammar fails tests (at least with tree-sitter and tree-sitter-cli version 0.20.9):

  tags:                                                                                                               
    ✗ Tags are working
    ✓ Purely numeric tags are forbidden
  spec:
    <...>
    ✓ Example 323 - https://github.github.com/gfm/#example-323
    ✗ Example 324 - https://github.github.com/gfm/#example-324
    ✓ Example 325 - https://github.github.com/gfm/#example-325
    <..>
    ✓ Example 637 - https://github.github.com/gfm/#example-637
    ✗ Example 638 - https://github.github.com/gfm/#example-638
    ✓ Example 639 - https://github.github.com/gfm/#example-639
  <...>
  extension_wikilink:
    ✗ Basic Wiki-link parsing.
    ✗ Wiki-link to a file
    ✗ Wiki-link to a heading in a note
    ✗ Wiki-link with title
    ✓ Wiki-link opener with no closer
    ✗ Wiki-link version of Example 556
<...>
8 failures:                                                                                                                                                                                                                       [32/13506]

expected / actual

  1. Tags are working:

    (inline) <- red

    (inline  <- green
      (tag)  <- green
      (tag)  <- green
      (tag)) <- green

  2. Example 324 - https://github.github.com/gfm/#example-324:

    (inline) <- red

    (inline  <- green
      (tag)  <- green
      (tag)) <- green

  3. Example 638 - https://github.github.com/gfm/#example-638:

    (inline) <- red

    (inline  <- green
      (tag)) <- green

  4. Basic Wiki-link parsing.:

    (inline
      (shortcut_link         <- red
        (link_text)))        <- red
      (wiki_link             <- green
        (link_destination))) <- green

  5. Wiki-link to a file:

    (inline
      (shortcut_link         <- red
        (link_text)))        <- red
      (wiki_link             <- green
        (link_destination))) <- green

  6. Wiki-link to a heading in a note:

    (inline
      (shortcut_link         <- red
        (link_text)))        <- red
      (wiki_link             <- green
        (link_destination))) <- green

  7. Wiki-link with title:

    (inline
      (shortcut_link       <- red
      (wiki_link           <- green
        (link_destination) <- green
        (link_text)))

  8. Wiki-link version of Example 556:

    (inline
      (shortcut_link         <- red
        (link_text)))        <- red
      (wiki_link             <- green
        (link_destination))) <- green
MDeiml commented 9 months ago

The tests are written for having all extensions enabled, see also here. To verify this you can download the repo and run ALL_EXTENSIONS=1 npm test.

Theres actually some CI set up to always run those tests.

Regarding the pull request where you referenced this you could either also build the grammer with the ALL_EXTENSIONS environment variable set or just use the default build, which doesn't include tags and wiki-links (which are both non-standard markdown).