Skip to content

bug: Wikilinks with Alias do not parse in Tables #185

@mcDevnagh

Description

@mcDevnagh

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

Wikilinks require a | to have an alias, but that is the same character as the used to separate cells in tables. While wikilink aliases work fine while outside of tables, they do not parse properly inside a table cell

Steps To Reproduce/Bad Parse Tree

|works        |works        |doesn't work  |
|-------------|-------------|--------------|
|[name](/link)|[[/link]]    |[[/link|name]]|

works: [[/link|name]]
(document ; [0, 0] - [5, 0]
  (section ; [0, 0] - [5, 0]
    (pipe_table ; [0, 0] - [3, 0]
      (pipe_table_header ; [0, 0] - [0, 44]
        (pipe_table_cell ; [0, 1] - [0, 14]
          (inline)) ; [0, 1] - [0, 14]
        (pipe_table_cell ; [0, 15] - [0, 28]
          (inline)) ; [0, 15] - [0, 28]
        (pipe_table_cell ; [0, 29] - [0, 43]
          (inline))) ; [0, 29] - [0, 43]
      (pipe_table_delimiter_row ; [1, 0] - [1, 44]
        (pipe_table_delimiter_cell) ; [1, 1] - [1, 14]
        (pipe_table_delimiter_cell) ; [1, 15] - [1, 28]
        (pipe_table_delimiter_cell)) ; [1, 29] - [1, 43]
      (pipe_table_row ; [2, 0] - [2, 44]
        (pipe_table_cell ; [2, 1] - [2, 14]
          (inline ; [2, 1] - [2, 14]
            (inline_link ; [2, 1] - [2, 14]
              (link_text) ; [2, 2] - [2, 6]
              (link_destination)))) ; [2, 8] - [2, 13]
        (pipe_table_cell ; [2, 15] - [2, 28]
          (inline ; [2, 15] - [2, 28]
            (shortcut_link ; [2, 16] - [2, 23]
              (link_text)))) ; [2, 17] - [2, 22]
        (pipe_table_cell ; [2, 29] - [2, 43]
          (inline ; [2, 29] - [2, 43]
            (shortcut_link ; [2, 30] - [2, 42]
              (link_text)))))) ; [2, 31] - [2, 41]
    (paragraph ; [4, 0] - [5, 0]
      (inline ; [4, 0] - [4, 21]
        (inline ; [4, 0] - [4, 21]
          (shortcut_link ; [4, 8] - [4, 20]
            (link_text))))))) ; [4, 9] - [4, 19]

Expected Behavior/Parse Tree

(document ; [0, 0] - [5, 0]
  (section ; [0, 0] - [5, 0]
    (pipe_table ; [0, 0] - [3, 0]
      (pipe_table_header ; [0, 0] - [0, 44]
        (pipe_table_cell ; [0, 1] - [0, 14]
          (inline)) ; [0, 1] - [0, 14]
        (pipe_table_cell ; [0, 15] - [0, 28]
          (inline)) ; [0, 15] - [0, 28]
        (pipe_table_cell ; [0, 29] - [0, 43]
          (inline))) ; [0, 29] - [0, 43]
      (pipe_table_delimiter_row ; [1, 0] - [1, 44]
        (pipe_table_delimiter_cell) ; [1, 1] - [1, 14]
        (pipe_table_delimiter_cell) ; [1, 15] - [1, 28]
        (pipe_table_delimiter_cell)) ; [1, 29] - [1, 43]
      (pipe_table_row ; [2, 0] - [2, 44]
        (pipe_table_cell ; [2, 1] - [2, 14]
          (inline ; [2, 1] - [2, 14]
            (inline_link ; [2, 1] - [2, 14]
              (link_text) ; [2, 2] - [2, 6]
              (link_destination)))) ; [2, 8] - [2, 13]
        (pipe_table_cell ; [2, 15] - [2, 28]
          (inline ; [2, 15] - [2, 28]
            (shortcut_link ; [2, 16] - [2, 23]
              (link_text)))) ; [2, 17] - [2, 22]
        (pipe_table_cell ; [2, 29] - [2, 43]
          (inline)) ; [2, 29] - [2, 43]
            (shortcut_link ; [2, 30] - [2, 23]
              (link_text)))) ; [2, 31] - [2, 22]
    (paragraph ; [4, 0] - [5, 0]
      (inline ; [4, 0] - [4, 21]
        (inline ; [4, 0] - [4, 21]
          (shortcut_link ; [4, 8] - [4, 20]
            (link_text))))))) ; [4, 9] - [4, 19]

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