diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2021-12-13 21:29:07 +0100 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2021-12-14 15:00:14 +0100 |
| commit | 387a8f38bd1ee25321b59bb08d23641f113f85da (patch) | |
| tree | 8bb28c4497d413201b6c924fb11b57f825582609 | |
| parent | feat(lang): add make (diff) | |
| download | nvim-treesitter-387a8f38bd1ee25321b59bb08d23641f113f85da.tar nvim-treesitter-387a8f38bd1ee25321b59bb08d23641f113f85da.tar.gz nvim-treesitter-387a8f38bd1ee25321b59bb08d23641f113f85da.tar.bz2 nvim-treesitter-387a8f38bd1ee25321b59bb08d23641f113f85da.tar.lz nvim-treesitter-387a8f38bd1ee25321b59bb08d23641f113f85da.tar.xz nvim-treesitter-387a8f38bd1ee25321b59bb08d23641f113f85da.tar.zst nvim-treesitter-387a8f38bd1ee25321b59bb08d23641f113f85da.zip | |
parsers: Add MDeiml/tree-sitter-markdown as markdown parser
Fixes #872
| -rw-r--r-- | lua/nvim-treesitter/configs.lua | 3 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 15 | ||||
| -rw-r--r-- | queries/markdown/highlights.scm | 40 | ||||
| -rw-r--r-- | queries/markdown/injections.scm | 1 |
4 files changed, 37 insertions, 22 deletions
diff --git a/lua/nvim-treesitter/configs.lua b/lua/nvim-treesitter/configs.lua index cb0b8b5a8..5fddd1620 100644 --- a/lua/nvim-treesitter/configs.lua +++ b/lua/nvim-treesitter/configs.lua @@ -25,8 +25,7 @@ local builtin_modules = { enable = false, custom_captures = {}, is_supported = function(lang) - -- FIXME(vigoux): markdown highlighting breaks everything for now - return lang ~= "markdown" and queries.has_highlights(lang) + return queries.has_highlights(lang) end, additional_vim_regex_highlighting = false, }, diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index a757fdd14..57280e820 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -433,13 +433,14 @@ list.hcl = { used_by = { "terraform" }, } --- FIXME(vigoux): markdown is broken for now --- list.markdown = { --- install_info = { --- url = "https://github.com/ikatyang/tree-sitter-markdown", --- files = { "src/parser.c", "src/scanner.cc" }, --- } --- } +list.markdown = { + install_info = { + url = "https://github.com/MDeiml/tree-sitter-markdown", + files = { "src/parser.c", "src/scanner.cc" }, + branch = "main", + }, + experimental = true, +} list.tlaplus = { install_info = { diff --git a/queries/markdown/highlights.scm b/queries/markdown/highlights.scm index 268d0c1c9..55dcc918d 100644 --- a/queries/markdown/highlights.scm +++ b/queries/markdown/highlights.scm @@ -1,21 +1,35 @@ -(atx_heading) @text.title - +;; From MDeiml/tree-sitter-markdown [ - (code_span) - (fenced_code_block) -]@text.literal + (atx_heading) + (setext_heading) +] @text.title (code_fence_content) @none [ - (link_text) - (image_description) -] @text.strong + (indented_code_block) + (fenced_code_block) + (code_span) +] @text.literal + + +(emphasis) @text.emphasis + +(strong_emphasis) @text.strong -[ - (emphasis) - (strong_emphasis) -] @text.emphasis (link_destination) @text.uri -(html_comment) @comment +(link_label) @text.reference + +[ + (list_marker_plus) + (list_marker_minus) + (list_marker_star) + (list_marker_dot) + (list_marker_parenthesis) +] @punctuation.special + +[ + (backslash_escape) + (hard_line_break) +] @string.escape diff --git a/queries/markdown/injections.scm b/queries/markdown/injections.scm index 42328ad24..f27248330 100644 --- a/queries/markdown/injections.scm +++ b/queries/markdown/injections.scm @@ -3,3 +3,4 @@ (code_fence_content) @content) ((html_block) @html) +((html_tag) @html) |
