@openclaw/feishu 2026.10.5-beta.1 → 2026.10.5-beta.3
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/node_modules/mdast-util-to-markdown/index.d.ts +2 -0
- package/node_modules/mdast-util-to-markdown/lib/configure.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/configure.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/configure.js +19 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +12 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/break.js +16 -5
- package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/code.js +13 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/definition.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts +30 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +39 -41
- package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/heading.js +11 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/html.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +17 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/image.js +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts +9 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +14 -4
- package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts +10 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +17 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts +13 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/link.js +24 -9
- package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +12 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/list.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/root.js +13 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts +30 -2
- package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/strong.js +39 -41
- package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/text.js +7 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts +6 -0
- package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +6 -0
- package/node_modules/mdast-util-to-markdown/lib/index.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/index.js +34 -8
- package/node_modules/mdast-util-to-markdown/lib/join.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/join.js +18 -1
- package/node_modules/mdast-util-to-markdown/lib/types.d.ts +50 -30
- package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/unsafe.js +15 -1
- package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts +23 -0
- package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts.map +1 -0
- package/node_modules/mdast-util-to-markdown/lib/util/character.js +32 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +4 -0
- package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +3 -1
- package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts +2 -0
- package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +9 -0
- package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts +95 -4
- package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +636 -57
- package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts +2 -2
- package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +12 -7
- package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +7 -2
- package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +20 -15
- package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts +31 -0
- package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts.map +1 -0
- package/node_modules/mdast-util-to-markdown/lib/util/html-kind.js +63 -0
- package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts +5 -0
- package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +11 -0
- package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts +2 -2
- package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts.map +1 -1
- package/node_modules/mdast-util-to-markdown/lib/util/safe.js +71 -7
- package/node_modules/mdast-util-to-markdown/package.json +13 -57
- package/node_modules/mdast-util-to-markdown/readme.md +139 -84
- package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/compile.js +14 -4
- package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
- package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
- package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
- package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/preprocess.js +19 -21
- package/node_modules/micromark/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/lib/compile.js +37 -29
- package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/lib/create-tokenizer.js +37 -35
- package/node_modules/micromark/lib/initialize/document.js +21 -13
- package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/lib/initialize/text.js +7 -3
- package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/lib/preprocess.js +16 -19
- package/node_modules/micromark/package.json +2 -15
- package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
- package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
- package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
- package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
- package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
- package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
- package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
- package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
- package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
- package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
- package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
- package/node_modules/micromark-core-commonmark/package.json +4 -16
- package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/dev/index.js +58 -3
- package/node_modules/micromark-factory-space/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/index.js +55 -3
- package/node_modules/micromark-factory-space/package.json +1 -10
- package/node_modules/micromark-factory-space/readme.md +25 -25
- package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
- package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/index.js +225 -0
- package/node_modules/micromark-util-edit-map/license +22 -0
- package/node_modules/micromark-util-edit-map/package.json +48 -0
- package/node_modules/micromark-util-edit-map/readme.md +234 -0
- package/node_modules/micromark-util-types/index.d.ts +6 -3
- package/node_modules/micromark-util-types/package.json +2 -36
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/package.json +4 -4
- package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts +0 -7
- package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts.map +0 -1
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[![Backers][backers-badge]][collective]
|
|
9
9
|
[![Chat][chat-badge]][chat]
|
|
10
10
|
|
|
11
|
-
**[mdast][]** utility that turns a syntax tree into markdown.
|
|
11
|
+
**[mdast][github-mdast]** utility that turns a syntax tree into markdown.
|
|
12
12
|
|
|
13
13
|
## Contents
|
|
14
14
|
|
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
* [API](#api)
|
|
20
20
|
* [`toMarkdown(tree[, options])`](#tomarkdowntree-options)
|
|
21
21
|
* [`defaultHandlers`](#defaulthandlers)
|
|
22
|
+
* [`Attention`](#attention)
|
|
23
|
+
* [`AttentionInfo`](#attentioninfo)
|
|
22
24
|
* [`ConstructName`](#constructname)
|
|
23
25
|
* [`ConstructNameMap`](#constructnamemap)
|
|
24
26
|
* [`Handle`](#handle)
|
|
@@ -43,25 +45,27 @@
|
|
|
43
45
|
|
|
44
46
|
## What is this?
|
|
45
47
|
|
|
46
|
-
This package is a utility that takes an [mdast][]
|
|
47
|
-
it into serialized markdown.
|
|
48
|
+
This package is a utility that takes an [mdast][github-mdast]
|
|
49
|
+
syntax tree as input and turns it into serialized markdown.
|
|
48
50
|
|
|
49
51
|
This utility is a low level project.
|
|
50
|
-
It’s used in [`remark-stringify`][remark-stringify],
|
|
51
|
-
easier to transform content by abstracting
|
|
52
|
+
It’s used in [`remark-stringify`][github-remark-stringify],
|
|
53
|
+
which focusses on making it easier to transform content by abstracting
|
|
54
|
+
these internals away.
|
|
52
55
|
|
|
53
56
|
## When should I use this?
|
|
54
57
|
|
|
55
58
|
If you want to handle syntax trees manually, use this.
|
|
56
|
-
For an easier time processing content, use the **[remark][]**
|
|
59
|
+
For an easier time processing content, use the **[remark][github-remark]**
|
|
60
|
+
ecosystem instead.
|
|
57
61
|
|
|
58
62
|
You can combine this utility with other utilities to add syntax extensions.
|
|
59
63
|
Notable examples that deeply integrate with it are
|
|
60
|
-
[`mdast-util-gfm`][mdast-util-gfm],
|
|
61
|
-
[`mdast-util-mdx`][mdast-util-mdx],
|
|
62
|
-
[`mdast-util-frontmatter`][mdast-util-frontmatter],
|
|
63
|
-
[`mdast-util-math`][mdast-util-math], and
|
|
64
|
-
[`mdast-util-directive`][mdast-util-directive].
|
|
64
|
+
[`mdast-util-gfm`][github-mdast-util-gfm],
|
|
65
|
+
[`mdast-util-mdx`][github-mdast-util-mdx],
|
|
66
|
+
[`mdast-util-frontmatter`][github-mdast-util-frontmatter],
|
|
67
|
+
[`mdast-util-math`][github-mdast-util-math], and
|
|
68
|
+
[`mdast-util-directive`][github-mdast-util-directive].
|
|
65
69
|
|
|
66
70
|
## Install
|
|
67
71
|
|
|
@@ -144,11 +148,11 @@ There is no default export.
|
|
|
144
148
|
|
|
145
149
|
### `toMarkdown(tree[, options])`
|
|
146
150
|
|
|
147
|
-
Turn an **[mdast][]** syntax tree into markdown.
|
|
151
|
+
Turn an **[mdast][github-mdast]** syntax tree into markdown.
|
|
148
152
|
|
|
149
153
|
###### Parameters
|
|
150
154
|
|
|
151
|
-
* `tree` ([`Node`][
|
|
155
|
+
* `tree` ([`Node`][github-mdast-nodes])
|
|
152
156
|
— tree to serialize
|
|
153
157
|
* `options` ([`Options`][api-options], optional)
|
|
154
158
|
— configuration
|
|
@@ -161,6 +165,43 @@ Serialized markdown representing `tree` (`string`).
|
|
|
161
165
|
|
|
162
166
|
Default (CommonMark) handlers ([`Handlers`][api-handlers]).
|
|
163
167
|
|
|
168
|
+
### `Attention`
|
|
169
|
+
|
|
170
|
+
Serialize a node as attention (emphasis, strong, strikethrough) (TypeScript
|
|
171
|
+
type).
|
|
172
|
+
|
|
173
|
+
Set as the `attention` field of a [`Handle`][api-handle]
|
|
174
|
+
(`handle.attention = x`).
|
|
175
|
+
This switches to a different algorithm,
|
|
176
|
+
where attention is properly handled by `containerPhrasing`.
|
|
177
|
+
|
|
178
|
+
###### Parameters
|
|
179
|
+
|
|
180
|
+
* `node` (`any`)
|
|
181
|
+
— expected mdast node
|
|
182
|
+
* `state` ([`State`][api-state])
|
|
183
|
+
— info passed around about the current state
|
|
184
|
+
|
|
185
|
+
###### Returns
|
|
186
|
+
|
|
187
|
+
Info on how to serialize `node` ([`AttentionInfo`][api-attention-info]).
|
|
188
|
+
|
|
189
|
+
### `AttentionInfo`
|
|
190
|
+
|
|
191
|
+
Info on how to serialize attention (TypeScript type).
|
|
192
|
+
|
|
193
|
+
###### Fields
|
|
194
|
+
|
|
195
|
+
* `construct` ([`ConstructName`][api-construct-name])
|
|
196
|
+
— construct to enter (such as `'emphasis'`)
|
|
197
|
+
* `markers` (`Array<string>`)
|
|
198
|
+
— markers that can be used in order of preference (such as `['*', '_']`);
|
|
199
|
+
one or more strings, each just one ASCII punctuation character
|
|
200
|
+
* `sizes` (`Array<number>`)
|
|
201
|
+
— sizes of sequences that can be used in order of preference (such as `[2]`
|
|
202
|
+
for strong or `[2, 1]` for GFM strikethrough);
|
|
203
|
+
one or more numbers, each a positive integer
|
|
204
|
+
|
|
164
205
|
### `ConstructName`
|
|
165
206
|
|
|
166
207
|
Construct names for things generated by `mdast-util-to-markdown` (TypeScript
|
|
@@ -206,7 +247,7 @@ Handle a particular node (TypeScript type).
|
|
|
206
247
|
|
|
207
248
|
* `node` (`any`)
|
|
208
249
|
— expected mdast node
|
|
209
|
-
* `parent` ([`Node`][
|
|
250
|
+
* `parent` ([`Node`][github-mdast-nodes], optional)
|
|
210
251
|
— parent of `node`
|
|
211
252
|
* `state` ([`State`][api-state])
|
|
212
253
|
— info passed around about the current state
|
|
@@ -236,7 +277,7 @@ Info on the surrounding of the node that is serialized (TypeScript type).
|
|
|
236
277
|
|
|
237
278
|
###### Fields
|
|
238
279
|
|
|
239
|
-
* `now` ([`Point`][point])
|
|
280
|
+
* `now` ([`Point`][github-unist-point])
|
|
240
281
|
— current point
|
|
241
282
|
* `lineShift` (`number`)
|
|
242
283
|
— number of columns each line will be shifted by wrapping nodes
|
|
@@ -258,11 +299,11 @@ return defines how many blank lines to use between them.
|
|
|
258
299
|
|
|
259
300
|
###### Parameters
|
|
260
301
|
|
|
261
|
-
* `left` ([`Node`][
|
|
302
|
+
* `left` ([`Node`][github-mdast-nodes])
|
|
262
303
|
— first of two adjacent siblings
|
|
263
|
-
* `right` ([`Node`][
|
|
304
|
+
* `right` ([`Node`][github-mdast-nodes])
|
|
264
305
|
— second of two adjacent siblings
|
|
265
|
-
* `parent` ([`Node`][
|
|
306
|
+
* `parent` ([`Node`][github-mdast-nodes])
|
|
266
307
|
— parent of the two siblings
|
|
267
308
|
* `state` ([`State`][api-state])
|
|
268
309
|
— info passed around about the current state
|
|
@@ -355,7 +396,10 @@ heading as the opening sequence (`boolean`, default: `false`).
|
|
|
355
396
|
|
|
356
397
|
###### `options.emphasis`
|
|
357
398
|
|
|
358
|
-
|
|
399
|
+
Preferred marker to use for emphasis (`'*'` or `'_'`, default: `'*'`).
|
|
400
|
+
|
|
401
|
+
The other marker is sometimes used, to form for example emphasis next to or
|
|
402
|
+
inside of other emphasis (`*a*_b_`).
|
|
359
403
|
|
|
360
404
|
###### `options.fence`
|
|
361
405
|
|
|
@@ -413,7 +457,10 @@ three or more.
|
|
|
413
457
|
|
|
414
458
|
###### `options.strong`
|
|
415
459
|
|
|
416
|
-
|
|
460
|
+
Preferred marker to use for strong (`'*'` or `'_'`, default: `'*'`).
|
|
461
|
+
|
|
462
|
+
The other marker is sometimes used, to form for example strong next to or
|
|
463
|
+
inside of other strong (`**a**__b__`).
|
|
417
464
|
|
|
418
465
|
###### `options.tightDefinitions`
|
|
419
466
|
|
|
@@ -476,7 +523,7 @@ Info passed around about the current state (TypeScript type).
|
|
|
476
523
|
— positions of child nodes in their parents
|
|
477
524
|
* `associationId` (`(node: Association) => string`)
|
|
478
525
|
— get an identifier from an association to match it to others (see
|
|
479
|
-
[`Association`][association])
|
|
526
|
+
[`Association`][github-mdast-association])
|
|
480
527
|
* `enter` (`(construct: ConstructName) => () => undefined`)
|
|
481
528
|
— enter a construct (returns a corresponding exit function)
|
|
482
529
|
(see [`ConstructName`][api-construct-name])
|
|
@@ -548,11 +595,11 @@ Schema that defines when a character cannot occur (TypeScript type).
|
|
|
548
595
|
|
|
549
596
|
## List of extensions
|
|
550
597
|
|
|
551
|
-
* [`syntax-tree/mdast-util-directive`]
|
|
598
|
+
* [`syntax-tree/mdast-util-directive`][github-mdast-util-directive]
|
|
552
599
|
— directives
|
|
553
|
-
* [`syntax-tree/mdast-util-frontmatter`]
|
|
600
|
+
* [`syntax-tree/mdast-util-frontmatter`][github-mdast-util-frontmatter]
|
|
554
601
|
— frontmatter (YAML, TOML, more)
|
|
555
|
-
* [`syntax-tree/mdast-util-gfm`]
|
|
602
|
+
* [`syntax-tree/mdast-util-gfm`][github-mdast-util-gfm]
|
|
556
603
|
— GFM
|
|
557
604
|
* [`syntax-tree/mdast-util-gfm-autolink-literal`](https://github.com/syntax-tree/mdast-util-gfm-autolink-literal)
|
|
558
605
|
— GFM autolink literals
|
|
@@ -564,9 +611,9 @@ Schema that defines when a character cannot occur (TypeScript type).
|
|
|
564
611
|
— GFM tables
|
|
565
612
|
* [`syntax-tree/mdast-util-gfm-task-list-item`](https://github.com/syntax-tree/mdast-util-gfm-task-list-item)
|
|
566
613
|
— GFM task list items
|
|
567
|
-
* [`syntax-tree/mdast-util-math`]
|
|
614
|
+
* [`syntax-tree/mdast-util-math`][github-mdast-util-math]
|
|
568
615
|
— math
|
|
569
|
-
* [`syntax-tree/mdast-util-mdx`]
|
|
616
|
+
* [`syntax-tree/mdast-util-mdx`][github-mdast-util-mdx]
|
|
570
617
|
— MDX
|
|
571
618
|
* [`syntax-tree/mdast-util-mdx-expression`](https://github.com/syntax-tree/mdast-util-mdx-expression)
|
|
572
619
|
— MDX expressions
|
|
@@ -583,12 +630,14 @@ Extensions can add support for custom syntax.
|
|
|
583
630
|
|
|
584
631
|
## Syntax tree
|
|
585
632
|
|
|
586
|
-
The syntax tree is [mdast][].
|
|
633
|
+
The syntax tree is [mdast][github-mdast].
|
|
587
634
|
|
|
588
635
|
## Types
|
|
589
636
|
|
|
590
637
|
This package is fully typed with [TypeScript][].
|
|
591
638
|
It exports the additional types
|
|
639
|
+
[`Attention`][api-attention],
|
|
640
|
+
[`AttentionInfo`][api-attention-info],
|
|
592
641
|
[`ConstructName`][api-construct-name],
|
|
593
642
|
[`ConstructNameMap`][api-construct-name-map],
|
|
594
643
|
[`Handle`][api-handle],
|
|
@@ -619,10 +668,11 @@ It’ll do its best, but complete roundtripping is impossible given that any val
|
|
|
619
668
|
could be injected into the tree.
|
|
620
669
|
|
|
621
670
|
As markdown is sometimes used for HTML, and improper use of HTML can open you up
|
|
622
|
-
to a [cross-site scripting (XSS)][xss] attack,
|
|
671
|
+
to a [cross-site scripting (XSS)][wikipedia-xss] attack,
|
|
672
|
+
use of `mdast-util-to-markdown`
|
|
623
673
|
and parsing it again later could potentially be unsafe.
|
|
624
674
|
When parsing markdown afterwards and then going to HTML, use something like
|
|
625
|
-
[`hast-util-sanitize`][hast-util-sanitize] to make the tree safe.
|
|
675
|
+
[`hast-util-sanitize`][github-hast-util-sanitize] to make the tree safe.
|
|
626
676
|
|
|
627
677
|
## Related
|
|
628
678
|
|
|
@@ -630,121 +680,126 @@ When parsing markdown afterwards and then going to HTML, use something like
|
|
|
630
680
|
— parse markdown to mdast
|
|
631
681
|
* [`micromark/micromark`](https://github.com/micromark/micromark)
|
|
632
682
|
— parse markdown
|
|
633
|
-
* [`remarkjs/remark`]
|
|
683
|
+
* [`remarkjs/remark`][github-remark]
|
|
634
684
|
— process markdown
|
|
635
685
|
|
|
636
686
|
## Contribute
|
|
637
687
|
|
|
638
|
-
See [`contributing.md`][contributing] in
|
|
688
|
+
See [`contributing.md`][health-contributing] in
|
|
689
|
+
[`syntax-tree/.github`][health] for
|
|
639
690
|
ways to get started.
|
|
640
|
-
See [`support.md`][support] for ways to get help.
|
|
691
|
+
See [`support.md`][health-support] for ways to get help.
|
|
641
692
|
|
|
642
|
-
This project has a [code of conduct][coc].
|
|
693
|
+
This project has a [code of conduct][health-coc].
|
|
643
694
|
By interacting with this repository, organization, or community you agree to
|
|
644
695
|
abide by its terms.
|
|
645
696
|
|
|
646
697
|
## License
|
|
647
698
|
|
|
648
|
-
[MIT][license] © [Titus Wormer][
|
|
699
|
+
[MIT][license] © [Titus Wormer][wooorm]
|
|
649
700
|
|
|
650
701
|
<!-- Definitions -->
|
|
651
702
|
|
|
652
|
-
[
|
|
703
|
+
[api-attention]: #attention
|
|
653
704
|
|
|
654
|
-
[
|
|
705
|
+
[api-attention-info]: #attentioninfo
|
|
655
706
|
|
|
656
|
-
[
|
|
707
|
+
[api-construct-name]: #constructname
|
|
657
708
|
|
|
658
|
-
[
|
|
709
|
+
[api-construct-name-map]: #constructnamemap
|
|
659
710
|
|
|
660
|
-
[
|
|
711
|
+
[api-default-handlers]: #defaulthandlers
|
|
661
712
|
|
|
662
|
-
[
|
|
713
|
+
[api-handle]: #handle
|
|
663
714
|
|
|
664
|
-
[
|
|
715
|
+
[api-handlers]: #handlers
|
|
665
716
|
|
|
666
|
-
[
|
|
717
|
+
[api-info]: #info
|
|
667
718
|
|
|
668
|
-
[
|
|
719
|
+
[api-join]: #join
|
|
669
720
|
|
|
670
|
-
[
|
|
721
|
+
[api-map]: #map
|
|
671
722
|
|
|
672
|
-
[
|
|
723
|
+
[api-options]: #options
|
|
673
724
|
|
|
674
|
-
[
|
|
725
|
+
[api-safe-config]: #safeconfig
|
|
675
726
|
|
|
676
|
-
[
|
|
727
|
+
[api-state]: #state
|
|
677
728
|
|
|
678
|
-
[
|
|
729
|
+
[api-to-markdown]: #tomarkdowntree-options
|
|
679
730
|
|
|
680
|
-
[
|
|
731
|
+
[api-tracker]: #tracker
|
|
681
732
|
|
|
682
|
-
[
|
|
733
|
+
[api-unsafe]: #unsafe
|
|
683
734
|
|
|
684
|
-
[
|
|
735
|
+
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
|
|
685
736
|
|
|
686
|
-
[
|
|
737
|
+
[build]: https://github.com/syntax-tree/mdast-util-to-markdown/actions
|
|
687
738
|
|
|
688
|
-
[
|
|
739
|
+
[build-badge]: https://github.com/syntax-tree/mdast-util-to-markdown/workflows/main/badge.svg
|
|
689
740
|
|
|
690
|
-
[
|
|
741
|
+
[chat]: https://github.com/syntax-tree/unist/discussions
|
|
691
742
|
|
|
692
|
-
[
|
|
743
|
+
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
|
|
693
744
|
|
|
694
|
-
[
|
|
745
|
+
[collective]: https://opencollective.com/unified
|
|
695
746
|
|
|
696
|
-
[
|
|
747
|
+
[coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-markdown
|
|
697
748
|
|
|
698
|
-
[
|
|
749
|
+
[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-markdown.svg
|
|
699
750
|
|
|
700
|
-
[
|
|
751
|
+
[downloads]: https://www.npmjs.com/package/mdast-util-to-markdown
|
|
701
752
|
|
|
702
|
-
[
|
|
753
|
+
[downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-markdown.svg
|
|
703
754
|
|
|
704
|
-
[
|
|
755
|
+
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
|
|
705
756
|
|
|
706
|
-
[
|
|
757
|
+
[esmsh]: https://esm.sh
|
|
707
758
|
|
|
708
|
-
[
|
|
759
|
+
[github-hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize
|
|
709
760
|
|
|
710
|
-
[mdast
|
|
761
|
+
[github-mdast]: https://github.com/syntax-tree/mdast
|
|
711
762
|
|
|
712
|
-
[mdast-
|
|
763
|
+
[github-mdast-association]: https://github.com/syntax-tree/mdast#association
|
|
713
764
|
|
|
714
|
-
[mdast-
|
|
765
|
+
[github-mdast-nodes]: https://github.com/syntax-tree/mdast#nodes
|
|
715
766
|
|
|
716
|
-
[mdast-util-
|
|
767
|
+
[github-mdast-util-directive]: https://github.com/syntax-tree/mdast-util-directive
|
|
717
768
|
|
|
718
|
-
[mdast-util-
|
|
769
|
+
[github-mdast-util-frontmatter]: https://github.com/syntax-tree/mdast-util-frontmatter
|
|
719
770
|
|
|
720
|
-
[
|
|
771
|
+
[github-mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm
|
|
721
772
|
|
|
722
|
-
[
|
|
773
|
+
[github-mdast-util-math]: https://github.com/syntax-tree/mdast-util-math
|
|
723
774
|
|
|
724
|
-
[
|
|
775
|
+
[github-mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx
|
|
725
776
|
|
|
726
|
-
[
|
|
777
|
+
[github-remark]: https://github.com/remarkjs/remark
|
|
727
778
|
|
|
728
|
-
[
|
|
779
|
+
[github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify
|
|
729
780
|
|
|
730
|
-
[
|
|
781
|
+
[github-unist-point]: https://github.com/syntax-tree/unist#point
|
|
731
782
|
|
|
732
|
-
[
|
|
783
|
+
[health]: https://github.com/syntax-tree/.github
|
|
733
784
|
|
|
734
|
-
[
|
|
785
|
+
[health-coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
|
|
735
786
|
|
|
736
|
-
[
|
|
787
|
+
[health-contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
|
|
737
788
|
|
|
738
|
-
[
|
|
789
|
+
[health-support]: https://github.com/syntax-tree/.github/blob/main/support.md
|
|
739
790
|
|
|
740
|
-
[
|
|
791
|
+
[license]: license
|
|
741
792
|
|
|
742
|
-
[
|
|
793
|
+
[npm]: https://docs.npmjs.com/cli/install
|
|
743
794
|
|
|
744
|
-
[
|
|
795
|
+
[size]: https://bundlejs.com/?q=mdast-util-to-markdown
|
|
745
796
|
|
|
746
|
-
[
|
|
797
|
+
[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=mdast-util-to-markdown
|
|
747
798
|
|
|
748
|
-
[
|
|
799
|
+
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
|
|
749
800
|
|
|
750
|
-
[
|
|
801
|
+
[typescript]: https://www.typescriptlang.org
|
|
802
|
+
|
|
803
|
+
[wikipedia-xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
|
|
804
|
+
|
|
805
|
+
[wooorm]: https://wooorm.com
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["compile.js"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,kCAHW,cAAc,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["compile.js"],"names":[],"mappings":"AA6DA;;;GAGG;AACH,kCAHW,cAAc,GAAG,IAAI,GAAG,SAAS,GAC/B,OAAO,CA0kCnB;;YAzmCa,OAAO,GAAG,SAAS;cACnB,MAAM,GAAG,SAAS;YAClB,MAAM,GAAG,SAAS;kBAClB,MAAM,GAAG,SAAS;kBAClB,MAAM,GAAG,SAAS;YAClB,MAAM,GAAG,SAAS;;oCAVtB,sBAAsB;6BAAtB,sBAAsB"}
|
|
@@ -364,7 +364,7 @@ export function compile(options) {
|
|
|
364
364
|
} else {
|
|
365
365
|
containerBalance--
|
|
366
366
|
}
|
|
367
|
-
} else
|
|
367
|
+
} else {
|
|
368
368
|
switch (event[1].type) {
|
|
369
369
|
case types.listItemPrefix: {
|
|
370
370
|
if (event[0] === 'exit') {
|
|
@@ -396,6 +396,7 @@ export function compile(options) {
|
|
|
396
396
|
atMarker = undefined
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
+
}
|
|
399
400
|
}
|
|
400
401
|
|
|
401
402
|
slice[0][1]._loose = loose
|
|
@@ -431,7 +432,10 @@ export function compile(options) {
|
|
|
431
432
|
|
|
432
433
|
/** @type {CompileContext['tag']} */
|
|
433
434
|
function tag(value) {
|
|
434
|
-
if (!tags)
|
|
435
|
+
if (!tags) {
|
|
436
|
+
return
|
|
437
|
+
}
|
|
438
|
+
|
|
435
439
|
setData('lastWasTag', true)
|
|
436
440
|
buffers[buffers.length - 1].push(value)
|
|
437
441
|
}
|
|
@@ -689,7 +693,10 @@ export function compile(options) {
|
|
|
689
693
|
}
|
|
690
694
|
|
|
691
695
|
tag('</code></pre>')
|
|
692
|
-
if (count !== undefined && count < 2)
|
|
696
|
+
if (count !== undefined && count < 2) {
|
|
697
|
+
lineEndingIfNeeded()
|
|
698
|
+
}
|
|
699
|
+
|
|
693
700
|
setData('flowCodeSeenData')
|
|
694
701
|
setData('fencesCount')
|
|
695
702
|
setData('slurpOneLineEnding')
|
|
@@ -909,7 +916,10 @@ export function compile(options) {
|
|
|
909
916
|
*/
|
|
910
917
|
function onexitatxheadingsequence(token) {
|
|
911
918
|
// Exit for further sequences.
|
|
912
|
-
if (getData('headingRank'))
|
|
919
|
+
if (getData('headingRank')) {
|
|
920
|
+
return
|
|
921
|
+
}
|
|
922
|
+
|
|
913
923
|
setData('headingRank', this.sliceSerialize(token).length)
|
|
914
924
|
lineEndingIfNeeded()
|
|
915
925
|
tag('<h' + getData('headingRank') + '>')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-tokenizer.d.ts","sourceRoot":"","sources":["create-tokenizer.js"],"names":[],"mappings":"AAgDA;;;;;;;;;;;;;;;;;GAiBG;AACH,wCATW,YAAY,cAEZ,gBAAgB,SAEhB,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,QAAQ,CAAC,GAAG,SAAS,GAEhD,eAAe,
|
|
1
|
+
{"version":3,"file":"create-tokenizer.d.ts","sourceRoot":"","sources":["create-tokenizer.js"],"names":[],"mappings":"AAgDA;;;;;;;;;;;;;;;;;GAiBG;AACH,wCATW,YAAY,cAEZ,gBAAgB,SAEhB,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,QAAQ,CAAC,GAAG,SAAS,GAEhD,eAAe,CAqhB3B;;;;4BAjkBY,SAAS;;;;;;;;aAKR,OAAO;;;;UAEP,MAAM;;;;;uCAKT,SAAS,QAET,IAAI,KAEF,SAAS;kCAtBZ,sBAAsB;sCAAtB,sBAAsB;2BAAtB,sBAAsB;qCAAtB,sBAAsB;+BAAtB,sBAAsB"}
|
|
@@ -199,15 +199,12 @@ export function createTokenizer(parser, initialize, from) {
|
|
|
199
199
|
* Nothing.
|
|
200
200
|
*/
|
|
201
201
|
function main() {
|
|
202
|
-
/** @type {number} */
|
|
203
|
-
let chunkIndex
|
|
204
|
-
|
|
205
202
|
while (point._index < chunks.length) {
|
|
206
203
|
const chunk = chunks[point._index]
|
|
207
204
|
|
|
208
205
|
// If we’re in a buffer chunk, loop through it.
|
|
209
206
|
if (typeof chunk === 'string') {
|
|
210
|
-
chunkIndex = point._index
|
|
207
|
+
const chunkIndex = point._index
|
|
211
208
|
|
|
212
209
|
if (point._bufferIndex < 0) {
|
|
213
210
|
point._bufferIndex = 0
|
|
@@ -669,7 +666,7 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
669
666
|
|
|
670
667
|
if (typeof chunk === 'string') {
|
|
671
668
|
value = chunk
|
|
672
|
-
} else
|
|
669
|
+
} else {
|
|
673
670
|
switch (chunk) {
|
|
674
671
|
case codes.carriageReturn: {
|
|
675
672
|
value = values.cr
|
|
@@ -696,7 +693,10 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
696
693
|
}
|
|
697
694
|
|
|
698
695
|
case codes.virtualSpace: {
|
|
699
|
-
if (!expandTabs && atTab)
|
|
696
|
+
if (!expandTabs && atTab) {
|
|
697
|
+
continue
|
|
698
|
+
}
|
|
699
|
+
|
|
700
700
|
value = values.space
|
|
701
701
|
|
|
702
702
|
break
|
|
@@ -708,6 +708,7 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
708
708
|
value = String.fromCharCode(chunk)
|
|
709
709
|
}
|
|
710
710
|
}
|
|
711
|
+
}
|
|
711
712
|
|
|
712
713
|
atTab = chunk === codes.horizontalTab
|
|
713
714
|
result.push(value)
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
import {ok as assert} from 'devlop'
|
|
21
21
|
import {factorySpace} from 'micromark-factory-space'
|
|
22
22
|
import {markdownLineEnding} from 'micromark-util-character'
|
|
23
|
-
import {
|
|
23
|
+
import {EditMap} from 'micromark-util-edit-map'
|
|
24
24
|
import {codes, constants, types} from 'micromark-util-symbol'
|
|
25
25
|
|
|
26
26
|
/** @type {InitialConstruct} */
|
|
@@ -128,16 +128,12 @@ function initializeDocument(effects) {
|
|
|
128
128
|
index++
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
const editMap = new EditMap()
|
|
131
132
|
// Inject the exits earlier (they’re still also at the end).
|
|
132
|
-
|
|
133
|
-
self.events,
|
|
134
|
-
indexBeforeFlow + 1,
|
|
135
|
-
0,
|
|
136
|
-
self.events.slice(indexBeforeExits)
|
|
137
|
-
)
|
|
138
|
-
|
|
133
|
+
editMap.add(indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits))
|
|
139
134
|
// Discard the duplicate exits.
|
|
140
|
-
|
|
135
|
+
editMap.add(indexBeforeExits, index - indexBeforeExits, [])
|
|
136
|
+
editMap.consume(self.events)
|
|
141
137
|
|
|
142
138
|
return checkNewContainers(code)
|
|
143
139
|
}
|
|
@@ -188,7 +184,10 @@ function initializeDocument(effects) {
|
|
|
188
184
|
|
|
189
185
|
/** @type {State} */
|
|
190
186
|
function thereIsANewContainer(code) {
|
|
191
|
-
if (childFlow)
|
|
187
|
+
if (childFlow) {
|
|
188
|
+
closeFlow()
|
|
189
|
+
}
|
|
190
|
+
|
|
192
191
|
exitContainers(continued)
|
|
193
192
|
return documentContinued(code)
|
|
194
193
|
}
|
|
@@ -230,7 +229,10 @@ function initializeDocument(effects) {
|
|
|
230
229
|
/** @type {State} */
|
|
231
230
|
function flowStart(code) {
|
|
232
231
|
if (code === codes.eof) {
|
|
233
|
-
if (childFlow)
|
|
232
|
+
if (childFlow) {
|
|
233
|
+
closeFlow()
|
|
234
|
+
}
|
|
235
|
+
|
|
234
236
|
exitContainers(0)
|
|
235
237
|
effects.consume(code)
|
|
236
238
|
return
|
|
@@ -279,9 +281,15 @@ function initializeDocument(effects) {
|
|
|
279
281
|
function writeToChild(token, endOfFile) {
|
|
280
282
|
assert(childFlow, 'expected `childFlow` to be defined when continuing')
|
|
281
283
|
const stream = self.sliceStream(token)
|
|
282
|
-
if (endOfFile)
|
|
284
|
+
if (endOfFile) {
|
|
285
|
+
stream.push(null)
|
|
286
|
+
}
|
|
287
|
+
|
|
283
288
|
token.previous = childToken
|
|
284
|
-
if (childToken)
|
|
289
|
+
if (childToken) {
|
|
290
|
+
childToken.next = token
|
|
291
|
+
}
|
|
292
|
+
|
|
285
293
|
childToken = token
|
|
286
294
|
childFlow.defineSkip(token.start)
|
|
287
295
|
childFlow.write(stream)
|
|
@@ -373,16 +381,12 @@ function initializeDocument(effects) {
|
|
|
373
381
|
index++
|
|
374
382
|
}
|
|
375
383
|
|
|
384
|
+
const editMap = new EditMap()
|
|
376
385
|
// Inject the exits earlier (they’re still also at the end).
|
|
377
|
-
|
|
378
|
-
self.events,
|
|
379
|
-
indexBeforeFlow + 1,
|
|
380
|
-
0,
|
|
381
|
-
self.events.slice(indexBeforeExits)
|
|
382
|
-
)
|
|
383
|
-
|
|
386
|
+
editMap.add(indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits))
|
|
384
387
|
// Discard the duplicate exits.
|
|
385
|
-
|
|
388
|
+
editMap.add(indexBeforeExits, index - indexBeforeExits, [])
|
|
389
|
+
editMap.consume(self.events)
|
|
386
390
|
}
|
|
387
391
|
}
|
|
388
392
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":";;;AAgBA,sCAAiD;AACjD,oCAA6C;8BATnC,sBAAsB;sCAAtB,sBAAsB"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import {ok as assert} from 'devlop'
|
|
13
|
+
import {EditMap} from 'micromark-util-edit-map'
|
|
13
14
|
import {codes, constants, types} from 'micromark-util-symbol'
|
|
14
15
|
|
|
15
16
|
export const resolver = {resolveAll: createResolver()}
|
|
@@ -153,6 +154,7 @@ function createResolver(extraResolver) {
|
|
|
153
154
|
* @type {Resolver}
|
|
154
155
|
*/
|
|
155
156
|
function resolveAllLineSuffixes(events, context) {
|
|
157
|
+
const editMap = new EditMap()
|
|
156
158
|
let eventIndex = 0 // Skip first.
|
|
157
159
|
|
|
158
160
|
while (++eventIndex <= events.length) {
|
|
@@ -180,7 +182,10 @@ function resolveAllLineSuffixes(events, context) {
|
|
|
180
182
|
bufferIndex--
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
if (bufferIndex)
|
|
185
|
+
if (bufferIndex) {
|
|
186
|
+
break
|
|
187
|
+
}
|
|
188
|
+
|
|
184
189
|
bufferIndex = -1
|
|
185
190
|
}
|
|
186
191
|
// Number
|
|
@@ -226,13 +231,10 @@ function resolveAllLineSuffixes(events, context) {
|
|
|
226
231
|
if (data.start.offset === data.end.offset) {
|
|
227
232
|
Object.assign(data, token)
|
|
228
233
|
} else {
|
|
229
|
-
|
|
230
|
-
eventIndex,
|
|
231
|
-
0,
|
|
234
|
+
editMap.add(eventIndex, 0, [
|
|
232
235
|
['enter', token, context],
|
|
233
236
|
['exit', token, context]
|
|
234
|
-
)
|
|
235
|
-
eventIndex += 2
|
|
237
|
+
])
|
|
236
238
|
}
|
|
237
239
|
}
|
|
238
240
|
|
|
@@ -240,5 +242,7 @@ function resolveAllLineSuffixes(events, context) {
|
|
|
240
242
|
}
|
|
241
243
|
}
|
|
242
244
|
|
|
245
|
+
editMap.consume(events)
|
|
246
|
+
|
|
243
247
|
return events
|
|
244
248
|
}
|