@willbooster/tree-sitter-markdown 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ digits of an ordered list marker with `'0'` and `'9'` instead of calling `isdigi
|
|
|
19
19
|
own ABI number (`0x57420001`) and load only with that fork's runtime, version 2.0.0 or later: upstream's tree-sitter
|
|
20
20
|
runtime rejects them. They parse as the parsers in upstream's 0.5.3 packages do, with these exceptions:
|
|
21
21
|
|
|
22
|
+
- HTML declarations end on the first line containing `>`, leaving subsequent Markdown outside the HTML block.
|
|
22
23
|
- Short HTML comments such as `<!-->` and `<!--->` end on their opening line. Malformed `<!-` prefixes remain ordinary text.
|
|
23
24
|
- Block containers nest to a maximum depth of 255. Additional quote, list, code, or HTML block openers remain literal text inside the deepest container.
|
|
24
25
|
- Final headings, thematic breaks, empty list items, and opening code fences are recognized without a trailing newline.
|
|
@@ -137,6 +138,7 @@ parser.set_language(&tree_sitter_md::LANGUAGE.into())?;
|
|
|
137
138
|
|
|
138
139
|
The crate keeps the API of upstream's `tree-sitter-md` crate: `tree_sitter_md::INLINE_LANGUAGE` is the inline grammar,
|
|
139
140
|
and the `parser` feature adds `MarkdownParser`, which parses a document with both grammars into a `MarkdownTree`.
|
|
141
|
+
The `parser` feature requires runtime version 2.0.18 or later, which supports UTF-8 characters split across short input chunks.
|
|
140
142
|
`MarkdownCursor::field_name` returns a name that borrows from the tree (`Option<&'tree str>`), since the
|
|
141
143
|
willbooster-tree-sitter runtime returns field names with that lifetime, where upstream's returns `Option<&'static str>`.
|
|
142
144
|
|
package/package.json
CHANGED
|
@@ -221,7 +221,7 @@ module.exports = grammar({
|
|
|
221
221
|
),
|
|
222
222
|
_html_block_2: $ => build_html_block($, $._html_block_2_start, '-->', true),
|
|
223
223
|
_html_block_3: $ => build_html_block($, $._html_block_3_start, '?>', true),
|
|
224
|
-
_html_block_4: $ => build_html_block($, $._html_block_4_start, '>', true),
|
|
224
|
+
_html_block_4: $ => build_html_block($, $._html_block_4_start, '>', true, $._declaration_line),
|
|
225
225
|
_html_block_5: $ => build_html_block($, $._html_block_5_start, ']]>', true),
|
|
226
226
|
_html_block_6: $ => build_html_block(
|
|
227
227
|
$,
|
|
@@ -390,6 +390,7 @@ module.exports = grammar({
|
|
|
390
390
|
optional($.block_continuation)
|
|
391
391
|
),
|
|
392
392
|
// Some symbols get parsed as single tokens so that html blocks get detected properly
|
|
393
|
+
_declaration_line: $ => prec.right(repeat1(choice($._word, $._whitespace, common.punctuation_without($, ['>'])))),
|
|
393
394
|
_line: $ => prec.right(repeat1(choice($._word, $._whitespace, common.punctuation_without($, [])))),
|
|
394
395
|
_word: $ => choice(
|
|
395
396
|
new RegExp('[^' + PUNCTUATION_CHARACTERS_REGEX + ' \\t\\n\\r]+'),
|
|
@@ -599,11 +600,11 @@ module.exports = grammar({
|
|
|
599
600
|
// General purpose structure for html blocks. The different kinds mostly work the same but have
|
|
600
601
|
// different openling and closing conditions. Some html blocks may not interrupt a paragraph and
|
|
601
602
|
// have to be marked as such.
|
|
602
|
-
function build_html_block($, open, close, interrupt_paragraph) {
|
|
603
|
+
function build_html_block($, open, close, interrupt_paragraph, line = $._line) {
|
|
603
604
|
return seq(
|
|
604
605
|
open,
|
|
605
606
|
repeat(choice(
|
|
606
|
-
|
|
607
|
+
line,
|
|
607
608
|
$._newline,
|
|
608
609
|
seq(close, $._close_block),
|
|
609
610
|
)),
|
|
Binary file
|
|
Binary file
|