tree-sitter-norg icon indicating copy to clipboard operation
tree-sitter-norg copied to clipboard

ranged tags aren't highlighted properly

Open flexagoon opened this issue 11 months ago • 3 comments

image

This doesn't look right. The opening tag is highlighted, while the closing one isn't.

Looking at the TS tree shows that it doesn't parse the segment correctly

image

This also means that the tags don't do what they're supposed to, and e.g. text inside of the |example tag is still rendered

flexagoon avatar Mar 26 '24 12:03 flexagoon

UPD: ranged tags work when there's just text inside of them, but some markup like headings or other tags break it.

flexagoon avatar Mar 26 '24 13:03 flexagoon

This seems to be due to ranged tag content expecting a paragraph:

https://github.com/nvim-neorg/tree-sitter-norg/blob/9766442985fd546e2d33f8d1c7e7619ed07860cf/grammar.js#L821

So any non-paragraph markup is disallowed

flexagoon avatar Mar 26 '24 15:03 flexagoon

@vhyrro I think this can be fixed by simply replacing the $.paragraph selector with a choice similar to what's currently used in $.document. However, AFAIK the |example tag should not render the text inside of it. Is it something that's supposed to be implemented in the treesitter parser, or is that functionality on the side of neorg?

flexagoon avatar Mar 26 '24 15:03 flexagoon