You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/tree-sitter-qmd/README.md
+2-25Lines changed: 2 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,31 +5,8 @@ It has a number of non-standard syntax that are used by Quarto in .qmd files spe
5
5
6
6
The original `tree-sitter-markdown` grammar was written by [Matthias Deiml](https://github.com/MDeiml).
7
7
8
-
At a high level, tree-sitter-qmd should be used like tree-sitter-md, by using the results of a block parse
9
-
to trigger the inline grammar parsing.
8
+
`tree-sitter-qmd` is an internal package written entirely to support `quarto-markdown-pandoc`.
10
9
11
10
For the original tree-sitter-md readme, see [README.tree-sitter-md.md].
12
11
13
-
## QMD changes/additions
14
-
15
-
- A fixed set of extensions
16
-
17
-
- shortcode syntax
18
-
19
-
- attribute syntax
20
-
21
-
- including Quarto's `{lang}` syntax that isn't commonmark
22
-
23
-
- including raw block/inline `{=format}` syntax
24
-
25
-
## QMD _REMOVALS_
26
-
27
-
- Simplified link syntax. the only link syntax supported are _inline links_: `[text](destination title)`
28
-
29
-
- no wikilink support
30
-
31
-
- no shortcut reference link support, we use that syntax for spans instead
32
-
33
-
- Similarly, the only image syntax supported is the one corresponding to inline links: ``
34
-
35
-
- no HTML support: QMD is meant to translate into more than one syntax. We use rawblock instead.
12
+
For more information on the syntax supported by quarto-markdown, see the top-level docs folder, and specifically the [syntax-nodes.md file](../../docs/syntax-notes.md).
Copy file name to clipboardExpand all lines: docs/syntax-notes.md
+28-2Lines changed: 28 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,17 +8,31 @@ We aim to be largely compatible with Pandoc's `markdown` and `Commonmark` format
8
8
9
9
Syntax extensions are handled by [desugaring](https://cs.brown.edu/courses/cs173/2012/book/Desugaring_as_a_Language_Feature.html) into regular Pandoc AST nodes.
10
10
11
+
### Scoped metadata
12
+
13
+
Our intermediate representation can store a metadata block inside the document, allowing (in principle)
14
+
for metadata in the document to be scoped to a particular portion of the document.
15
+
11
16
### Shortcodes
12
17
13
18
We have "native" shortcode support in the "Pandoc" AST in pandoc.rs, and
14
19
we desugar them to Pandoc spans in a Rust filter.
15
20
16
-
### Notes
21
+
### Footnotes
17
22
18
23
We parse footnotes differently from Pandoc.
19
24
We use NoteReference (Inline) and NoteDefinition (block) nodes.
20
25
These are desugared into spans and divs in a Rust filter.
21
26
27
+
### Editor markup
28
+
29
+
Inspired by [CriticMarkup](https://fletcher.github.io/MultiMarkdown-6/syntax/critic.html) and [djot](https://djot.net), Quarto offers syntax for edit marks:
30
+
31
+
- Insertions: `[++ Insert this markdown content]`
32
+
- Deletions: `[-- Delete this sentence]`
33
+
- Highlighting: `[!! this will be highlighted in rendering]`
34
+
- Comment: `[>> this will show up as a comment]`
35
+
22
36
### Reader raw blocks
23
37
24
38
Quarto Markdown supports the following syntax:
@@ -200,4 +214,16 @@ We will also not support definition lists directly.
200
214
Consider `^[footnote-or-span]{.class}^`. `^[` denotes both the start of a footnote and potentially the combination of a superscript block with a span; this parse is ambiguous.
201
215
202
216
Quarto-markdown's parser prefers the footnote interpretation. In case an immediately nested span is needed, use a space between `^` and `[`.
203
-
Superscript nodes with leading spaces are disallowed in Pandoc, but Quarto-markdown will trim spaces.
217
+
Superscript nodes with leading spaces are disallowed in Pandoc, but Quarto-markdown will trim spaces.
218
+
219
+
## QMD _REMOVALS_
220
+
221
+
- Simplified link syntax. the only link syntax supported are _inline links_: `[text](destination title)`
222
+
223
+
- no wikilink support
224
+
225
+
- no shortcut reference link support, we use that syntax for spans instead
226
+
227
+
- Similarly, the only image syntax supported is the one corresponding to inline links: ``
228
+
229
+
- no HTML support: QMD is meant to translate into more than one syntax. We use rawblock instead.
tree-sitter-markdown-inline has a tree-sitter test suite that can be run with
4
+
5
+
```
6
+
$ tree-sitter test
7
+
```
8
+
9
+
Many tests there were inherited from the grammar we forked. Many of those fail, and some shouldn't actually pass.
10
+
11
+
In addition to a fixed test suite, we have `./tree-sitter-markdown-inline/scripts/shortcode_generator.py` to test the shortcode parsing subsystem specifically.
12
+
It uses random testing to generate large numbers of shortcodes, calls `tree-sitter parse` on them, and checks if the output matches expectations.
13
+
14
+
We use it to generate failing tests that are then fixed and added to the test suite (crates/tree-sitter-qmd/tree-sitter-markdown-inline/test/corpus/shortcodes.txt).
15
+
At present time, we have generated over 10k random tests without failures.
Copy file name to clipboardExpand all lines: docs/wasm.md
-16Lines changed: 0 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,3 @@
1
-
## Testing
2
-
3
-
tree-sitter-markdown-inline has a tree-sitter test suite that can be run with
4
-
5
-
```
6
-
$ tree-sitter test
7
-
```
8
-
9
-
Many tests there were inherited from the grammar we forked. Many of those fail, and some shouldn't actually pass.
10
-
11
-
In addition to a fixed test suite, we have `./tree-sitter-markdown-inline/scripts/shortcode_generator.py` to test the shortcode parsing subsystem specifically.
12
-
It uses random testing to generate large numbers of shortcodes, calls `tree-sitter parse` on them, and checks if the output matches expectations.
13
-
14
-
We use it to generate failing tests that are then fixed and added to the test suite (crates/tree-sitter-qmd/tree-sitter-markdown-inline/test/corpus/shortcodes.txt).
15
-
At present time, we have generated over 10k random tests without failures.
0 commit comments