tree-sitter-markdown
tree-sitter-markdown copied to clipboard
wikilinks
Maybe this should not be part of tree-sitter-markdown since its not part of CommonMark Spec or Github flavored markdown so just opening up the question of supporting wikilinks.
It could definitely be implemented in a way that it can be conditionally enabled (as an extension). To me it seems like a there would be a few people who would want this.
@MDeiml Just curious, what do you mean by conditionally enabled? Does tree-sitter parser can be configured?
Once the parser is compiled it can't be configured, but I added some code to configure it at compile time (using environment variables). You can see it in the common/grammar.js
+1 for the feature, ideally given that wikilinks are becoming more and more common, alias text support would make it compatible with multiple tools:
[[wikilink]]
[[wikilink|alias]]
This could allow mainly for concealing where just [[alias]]
or [alias]
is shown
I am trying to enable this feature and am having trouble (new to vim/neovim). How do I set the variable in the readme? Is it in vim.g ?
This is not really supported that well yet in neovim. See https://github.com/nvim-treesitter/nvim-treesitter/issues/3076. I think the only solution is to build the parser yourself. For this clone the repo, and run the command EXTENSION_WIKI_LINK=1 npm run build
. This assumes you are using either linux or macos.
Then you have to point nvim-treesitter to this local version. See their documentation on how to do that.
Closing this as wiki links are now supported (but hidden behind a compilation time flag).