Skip to content

Conversation

@ggodlewski
Copy link

User description

I have following pipe table:

| Header |
|--------|
| value. |

Inside tree-sitter-markdown I'm running tree-sitter parse -x ~/tree.md

The result is:

<?xml version="1.0"?>
<document srow="0" scol="0" erow="3" ecol="0">
  <section srow="0" scol="0" erow="3" ecol="0">
    <pipe_table srow="0" scol="0" erow="3" ecol="0">
      <pipe_table_header srow="0" scol="0" erow="0" ecol="10">
        |
        <pipe_table_cell srow="0" scol="2" erow="0" ecol="9">Header </pipe_table_cell>
        |
      </pipe_table_header>
      <pipe_table_delimiter_row srow="1" scol="0" erow="1" ecol="10">
        |
        <pipe_table_delimiter_cell srow="1" scol="1" erow="1" ecol="9">
          -
          -
          -
          -
          -
          -
          -
          -
        </pipe_table_delimiter_cell>
        |
      </pipe_table_delimiter_row>
      <pipe_table_row srow="2" scol="0" erow="2" ecol="10">
        |
        <pipe_table_cell srow="2" scol="2" erow="2" ecol="9">
          .
        </pipe_table_cell>
        |
      </pipe_table_row>
    </pipe_table>
  </section>
</document>

Look at the last cell.
String value is not captured by any node. If I remove dot after value, the result is ok.

This PR changes the content of cell to be aliased as inline.

The result is tree with captured value string:

<?xml version="1.0"?>
<document srow="0" scol="0" erow="3" ecol="0">
  <section srow="0" scol="0" erow="3" ecol="0">
    <pipe_table srow="0" scol="0" erow="3" ecol="0">
      <pipe_table_header srow="0" scol="0" erow="0" ecol="10">
        |
        <pipe_table_cell srow="0" scol="2" erow="0" ecol="9">
          <inline srow="0" scol="2" erow="0" ecol="8">Header</inline>
          <inline srow="0" scol="8" erow="0" ecol="9"> </inline>
        </pipe_table_cell>
        |
      </pipe_table_header>
      <pipe_table_delimiter_row srow="1" scol="0" erow="1" ecol="10">
        |
        <pipe_table_delimiter_cell srow="1" scol="1" erow="1" ecol="9">
          -
          -
          -
          -
          -
          -
          -
          -
        </pipe_table_delimiter_cell>
        |
      </pipe_table_delimiter_row>
      <pipe_table_row srow="2" scol="0" erow="2" ecol="10">
        |
        <pipe_table_cell srow="2" scol="2" erow="2" ecol="9">
          <inline srow="2" scol="2" erow="2" ecol="7">value</inline>
          <inline srow="2" scol="7" erow="2" ecol="9">
            .
          </inline>
        </pipe_table_cell>
        |
      </pipe_table_row>
    </pipe_table>
  </section>
</document>

PR Type

Bug fix, Enhancement


Description

  • Alias pipe table cells as inline nodes for proper content parsing

  • Fixes issue where text before punctuation in cells was not captured

  • Updates grammar to wrap cell content in inline node structure

  • Adds wiki_link and tag support to inline markdown elements


Diagram Walkthrough

flowchart LR
  A["pipe_table_cell rule"] -->|"wrap with alias"| B["alias to inline"]
  B -->|"restructure"| C["PREC_RIGHT seq"]
  C -->|"contains"| D["inline nodes"]
  D -->|"fixes"| E["text capture before punctuation"]
Loading

File Walkthrough

Relevant files
Enhancement
3 files
grammar.js
Wrap pipe_table_cell with inline alias                                     
+2/-2     
node-types.json
Add tag and wiki_link node types                                                 
+67/-0   
grammar.json
Add tag pattern and wiki_link symbol                                         
+22/-2   
Configuration changes
2 files
grammar.json
Update grammar JSON with alias structure                                 
+178/-173
node-types.json
Add inline children to pipe_table_cell                                     
+11/-1   
Tests
2 files
extension_pipe_table.txt
Update pipe table test expectations                                           
+91/-31 
issues.txt
Add regression test for issue #999                                             
+22/-0   
Additional files
2 files
parser.c [link]   
parser.c [link]   

@ggodlewski ggodlewski marked this pull request as draft December 5, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant