-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev for pandoc markdown treesitter grammar
- Loading branch information
Showing
9 changed files
with
328 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
QuartoPreview quarto.txt /*QuartoPreview* | ||
quarto.nvim quarto.txt /*quarto.nvim* | ||
quarto.quartoPreview() quarto.txt /*quarto.quartoPreview()* | ||
quarto-links quarto.txt /*quarto-links* | ||
quarto-quarto-nvim quarto.txt /*quarto-quarto-nvim* | ||
quarto-quarto-nvim-available-commands quarto.txt /*quarto-quarto-nvim-available-commands* | ||
quarto-quarto-nvim-language-support quarto.txt /*quarto-quarto-nvim-language-support* | ||
quarto-quarto-nvim-recommended-plugins quarto.txt /*quarto-quarto-nvim-recommended-plugins* | ||
quarto-quarto-nvim-running-code quarto.txt /*quarto-quarto-nvim-running-code* | ||
quarto-quarto-nvim-setup quarto.txt /*quarto-quarto-nvim-setup* | ||
quarto-quarto-nvim-usage quarto.txt /*quarto-quarto-nvim-usage* | ||
quarto-quarto-nvim-walkthrough quarto.txt /*quarto-quarto-nvim-walkthrough* | ||
quarto-table-of-contents quarto.txt /*quarto-table-of-contents* | ||
quarto.txt quarto.txt /*quarto.txt* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
([ | ||
(fenced_code_block) | ||
(indented_code_block) | ||
(list) | ||
(section) | ||
] @fold | ||
(#trim! @fold)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
;From MDeiml/tree-sitter-markdown & Helix | ||
(setext_heading | ||
(paragraph) @markup.heading.1 | ||
(setext_h1_underline) @markup.heading.1) | ||
|
||
(setext_heading | ||
(paragraph) @markup.heading.2 | ||
(setext_h2_underline) @markup.heading.2) | ||
|
||
(atx_heading | ||
(atx_h1_marker)) @markup.heading.1 | ||
|
||
(atx_heading | ||
(atx_h2_marker)) @markup.heading.2 | ||
|
||
(atx_heading | ||
(atx_h3_marker)) @markup.heading.3 | ||
|
||
(atx_heading | ||
(atx_h4_marker)) @markup.heading.4 | ||
|
||
(atx_heading | ||
(atx_h5_marker)) @markup.heading.5 | ||
|
||
(atx_heading | ||
(atx_h6_marker)) @markup.heading.6 | ||
|
||
(info_string) @label | ||
|
||
(pipe_table_header | ||
(pipe_table_cell) @markup.heading) | ||
|
||
(pipe_table_header | ||
"|" @punctuation.special) | ||
|
||
(pipe_table_row | ||
"|" @punctuation.special) | ||
|
||
(pipe_table_delimiter_row | ||
"|" @punctuation.special) | ||
|
||
(pipe_table_delimiter_cell) @punctuation.special | ||
|
||
; Code blocks (conceal backticks and language annotation) | ||
(indented_code_block) @markup.raw.block | ||
|
||
((fenced_code_block) @markup.raw.block | ||
(#set! priority 90)) | ||
|
||
(fenced_code_block | ||
(fenced_code_block_delimiter) @markup.raw.block | ||
(#set! conceal "")) | ||
|
||
(fenced_code_block | ||
(info_string | ||
(language) @label | ||
(#set! conceal ""))) | ||
|
||
(link_destination) @markup.link.url | ||
|
||
[ | ||
(link_title) | ||
(link_label) | ||
] @markup.link.label | ||
|
||
((link_label) | ||
. | ||
":" @punctuation.delimiter) | ||
|
||
[ | ||
(list_marker_plus) | ||
(list_marker_minus) | ||
(list_marker_star) | ||
(list_marker_dot) | ||
(list_marker_parenthesis) | ||
] @markup.list | ||
|
||
; NOTE: The following has been commented out due to issues with spaces in the | ||
; list marker nodes generated by the parser. If those spaces ever get captured | ||
; by a different node (e.g. block_continuation) we can safely re-add these | ||
; conceals. | ||
; ;; Conceal bullet points | ||
; ([(list_marker_plus) (list_marker_star)] | ||
; @punctuation.special | ||
; (#offset! @punctuation.special 0 0 0 -1) | ||
; (#set! conceal "•")) | ||
; ([(list_marker_plus) (list_marker_star)] | ||
; @punctuation.special | ||
; (#any-of? @punctuation.special "+" "*") | ||
; (#set! conceal "•")) | ||
; ((list_marker_minus) | ||
; @punctuation.special | ||
; (#offset! @punctuation.special 0 0 0 -1) | ||
; (#set! conceal "—")) | ||
; ((list_marker_minus) | ||
; @punctuation.special | ||
; (#eq? @punctuation.special "-") | ||
; (#set! conceal "—")) | ||
(thematic_break) @punctuation.special | ||
|
||
(task_list_marker_unchecked) @markup.list.unchecked | ||
|
||
(task_list_marker_checked) @markup.list.checked | ||
|
||
((block_quote) @markup.quote | ||
(#set! priority 90)) | ||
|
||
([ | ||
(plus_metadata) | ||
(minus_metadata) | ||
] @keyword.directive | ||
(#set! priority 90)) | ||
|
||
[ | ||
(block_continuation) | ||
(block_quote_marker) | ||
] @punctuation.special | ||
|
||
(backslash_escape) @string.escape | ||
|
||
(inline) @spell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(list_item) @indent.auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(fenced_code_block | ||
(info_string | ||
(language) @_lang) | ||
(code_fence_content) @injection.content | ||
(#set-lang-from-info-string! @_lang)) | ||
|
||
((html_block) @injection.content | ||
(#set! injection.language "html") | ||
(#set! injection.combined) | ||
(#set! injection.include-children)) | ||
|
||
((minus_metadata) @injection.content | ||
(#set! injection.language "yaml") | ||
(#offset! @injection.content 1 0 -1 0) | ||
(#set! injection.include-children)) | ||
|
||
((plus_metadata) @injection.content | ||
(#set! injection.language "toml") | ||
(#offset! @injection.content 1 0 -1 0) | ||
(#set! injection.include-children)) | ||
|
||
([ | ||
(inline) | ||
(pipe_table_cell) | ||
] @injection.content | ||
(#set! injection.language "pandoc_markdown_inline")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
; extends | ||
; (atx_heading | ||
; heading_content: (_) @class.inner) @class.outer | ||
; | ||
; (setext_heading | ||
; heading_content: (_) @class.inner) @class.outer | ||
; | ||
; (thematic_break) @class.outer | ||
|
||
|
||
(fenced_code_block (code_fence_content) @class.inner) @class.outer | ||
|
||
(paragraph) @function.outer @function.inner | ||
|
||
(fenced_code_block (code_fence_content) @block.inner) @block.outer | ||
|
||
[ | ||
(paragraph) | ||
(list) | ||
] @block.outer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
; From MDeiml/tree-sitter-markdown | ||
(code_span) @markup.raw @nospell | ||
|
||
(emphasis) @markup.italic | ||
|
||
(strong_emphasis) @markup.strong | ||
|
||
(strikethrough) @markup.strikethrough | ||
|
||
(shortcut_link | ||
(link_text) @nospell) | ||
|
||
[ | ||
(backslash_escape) | ||
(hard_line_break) | ||
] @string.escape | ||
|
||
; Conceal codeblock and text style markers | ||
([ | ||
(code_span_delimiter) | ||
(emphasis_delimiter) | ||
] @conceal | ||
(#set! conceal "")) | ||
|
||
; Conceal inline links | ||
(inline_link | ||
[ | ||
"[" | ||
"]" | ||
"(" | ||
(link_destination) | ||
")" | ||
] @markup.link | ||
(#set! conceal "")) | ||
|
||
[ | ||
(link_label) | ||
(link_text) | ||
(link_title) | ||
(image_description) | ||
] @markup.link.label | ||
|
||
((inline_link | ||
(link_destination) @_url) @_label | ||
(#set! @_label url @_url)) | ||
|
||
((image | ||
(link_destination) @_url) @_label | ||
(#set! @_label url @_url)) | ||
|
||
; Conceal image links | ||
(image | ||
[ | ||
"!" | ||
"[" | ||
"]" | ||
"(" | ||
(link_destination) | ||
")" | ||
] @markup.link | ||
(#set! conceal "")) | ||
|
||
; Conceal full reference links | ||
(full_reference_link | ||
[ | ||
"[" | ||
"]" | ||
(link_label) | ||
] @markup.link | ||
(#set! conceal "")) | ||
|
||
; Conceal collapsed reference links | ||
(collapsed_reference_link | ||
[ | ||
"[" | ||
"]" | ||
] @markup.link | ||
(#set! conceal "")) | ||
|
||
; Conceal shortcut links | ||
(shortcut_link | ||
[ | ||
"[" | ||
"]" | ||
] @markup.link | ||
(#set! conceal "")) | ||
|
||
[ | ||
(link_destination) | ||
(uri_autolink) | ||
(email_autolink) | ||
] @markup.link.url @nospell | ||
|
||
((uri_autolink) @_url | ||
(#offset! @_url 0 1 0 -1) | ||
(#set! @_url url @_url)) | ||
|
||
(entity_reference) @nospell | ||
|
||
; Replace common HTML entities. | ||
((entity_reference) @character.special | ||
(#eq? @character.special " ") | ||
(#set! conceal " ")) | ||
|
||
((entity_reference) @character.special | ||
(#eq? @character.special "<") | ||
(#set! conceal "<")) | ||
|
||
((entity_reference) @character.special | ||
(#eq? @character.special ">") | ||
(#set! conceal ">")) | ||
|
||
((entity_reference) @character.special | ||
(#eq? @character.special "&") | ||
(#set! conceal "&")) | ||
|
||
((entity_reference) @character.special | ||
(#eq? @character.special """) | ||
(#set! conceal "\"")) | ||
|
||
((entity_reference) @character.special | ||
(#any-of? @character.special " " " ") | ||
(#set! conceal " ")) | ||
|
||
|
||
(strikethrough | ||
(emphasis_delimiter) | ||
(strikethrough | ||
(emphasis_delimiter) | ||
(emphasis_delimiter)) | ||
(emphasis_delimiter))@markup.doublestrikethrough | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
((html_tag) @injection.content | ||
(#set! injection.language "html") | ||
(#set! injection.combined)) | ||
|
||
((latex_block) @injection.content | ||
(#set! injection.language "latex") | ||
(#set! injection.include-children)) |