Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions crates/quarto-markdown-pandoc/snapshots/native/030.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
source: crates/quarto-markdown-pandoc/tests/test.rs
expression: output
---
[ Para [Span ( "" , ["quarto-shortcode__"] , [("data-is-shortcode", "1")] ) [Span ( "" , ["quarto-shortcode__-param"] , [("data-value", "include"), ("data-is-shortcode", "1"), ("data-raw", "include")] ) [], Span ( "" , ["quarto-shortcode__-param"] , [("data-is-shortcode", "1"), ("data-value", "/docs/prerelease/1.5/_pre-release-feature.qmd"), ("data-raw", "/docs/prerelease/1.5/_pre-release-feature.qmd")] ) []]] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{< include /docs/prerelease/1.5/_pre-release-feature.qmd >}}
3 changes: 2 additions & 1 deletion crates/tree-sitter-qmd/tree-sitter-markdown/grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ module.exports = grammar({
optional($.block_continuation)
),
// Some symbols get parsed as single tokens so that html blocks get detected properly
_code_line: $ => prec.right(repeat1(choice($._word, '<', '>', $._display_math_state_track_marker, $._inline_math_state_track_marker, $._whitespace, $._html_comment, common.punctuation_without($, [])))),
_code_line: $ => prec.right(repeat1(choice($._word, '<', '>', '{{<', '}}>', $._display_math_state_track_marker, $._inline_math_state_track_marker, $._whitespace, $._html_comment, common.punctuation_without($, [])))),

// the gymnastics around `:` in _line exist to make the parser reject paragraphs that start with a colon.
// Those are technically valid in Markdown, but disallowing them here makes it possible to detect an
Expand All @@ -414,6 +414,7 @@ module.exports = grammar({
$._autolink,
$._escaped_characters,
$._pipe_table_code_span,
'{{<', '>}}', // shortcodes
'[>>', // this needs to be accepted for highlights in editorial comments
),

Expand Down
16 changes: 16 additions & 0 deletions crates/tree-sitter-qmd/tree-sitter-markdown/src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -3032,6 +3032,14 @@
"type": "STRING",
"value": ">"
},
{
"type": "STRING",
"value": "{{<"
},
{
"type": "STRING",
"value": "}}>"
},
{
"type": "SYMBOL",
"name": "_display_math_state_track_marker"
Expand Down Expand Up @@ -3233,6 +3241,14 @@
"type": "SYMBOL",
"name": "_pipe_table_code_span"
},
{
"type": "STRING",
"value": "{{<"
},
{
"type": "STRING",
"value": ">}}"
},
{
"type": "STRING",
"value": "[>>"
Expand Down
12 changes: 12 additions & 0 deletions crates/tree-sitter-qmd/tree-sitter-markdown/src/node-types.json
Original file line number Diff line number Diff line change
Expand Up @@ -1034,6 +1034,10 @@
"type": ">",
"named": false
},
{
"type": ">}}",
"named": false
},
{
"type": "?",
"named": false
Expand Down Expand Up @@ -1166,6 +1170,10 @@
"type": "{",
"named": false
},
{
"type": "{{<",
"named": false
},
{
"type": "{}",
"named": false
Expand All @@ -1178,6 +1186,10 @@
"type": "}",
"named": false
},
{
"type": "}}>",
"named": false
},
{
"type": "~",
"named": false
Expand Down
Loading
Loading