@openclaw/feishu 2026.10.5-beta.1 → 2026.10.5-beta.2

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.
Files changed (210) hide show
  1. package/node_modules/mdast-util-to-markdown/index.d.ts +2 -0
  2. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts +5 -0
  3. package/node_modules/mdast-util-to-markdown/lib/configure.d.ts.map +1 -1
  4. package/node_modules/mdast-util-to-markdown/lib/configure.js +19 -0
  5. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts +7 -0
  6. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.d.ts.map +1 -1
  7. package/node_modules/mdast-util-to-markdown/lib/handle/blockquote.js +12 -1
  8. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts +7 -0
  9. package/node_modules/mdast-util-to-markdown/lib/handle/break.d.ts.map +1 -1
  10. package/node_modules/mdast-util-to-markdown/lib/handle/break.js +16 -5
  11. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts +7 -0
  12. package/node_modules/mdast-util-to-markdown/lib/handle/code.d.ts.map +1 -1
  13. package/node_modules/mdast-util-to-markdown/lib/handle/code.js +13 -2
  14. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts +7 -0
  15. package/node_modules/mdast-util-to-markdown/lib/handle/definition.d.ts.map +1 -1
  16. package/node_modules/mdast-util-to-markdown/lib/handle/definition.js +7 -0
  17. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts +30 -2
  18. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.d.ts.map +1 -1
  19. package/node_modules/mdast-util-to-markdown/lib/handle/emphasis.js +39 -41
  20. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts +7 -0
  21. package/node_modules/mdast-util-to-markdown/lib/handle/heading.d.ts.map +1 -1
  22. package/node_modules/mdast-util-to-markdown/lib/handle/heading.js +11 -2
  23. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts +7 -0
  24. package/node_modules/mdast-util-to-markdown/lib/handle/html.d.ts.map +1 -1
  25. package/node_modules/mdast-util-to-markdown/lib/handle/html.js +7 -0
  26. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts +10 -0
  27. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.d.ts.map +1 -1
  28. package/node_modules/mdast-util-to-markdown/lib/handle/image-reference.js +17 -2
  29. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts +10 -0
  30. package/node_modules/mdast-util-to-markdown/lib/handle/image.d.ts.map +1 -1
  31. package/node_modules/mdast-util-to-markdown/lib/handle/image.js +10 -0
  32. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts +9 -0
  33. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.d.ts.map +1 -1
  34. package/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js +14 -4
  35. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts +10 -0
  36. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.d.ts.map +1 -1
  37. package/node_modules/mdast-util-to-markdown/lib/handle/link-reference.js +17 -2
  38. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts +13 -0
  39. package/node_modules/mdast-util-to-markdown/lib/handle/link.d.ts.map +1 -1
  40. package/node_modules/mdast-util-to-markdown/lib/handle/link.js +24 -9
  41. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts +7 -0
  42. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.d.ts.map +1 -1
  43. package/node_modules/mdast-util-to-markdown/lib/handle/list-item.js +12 -1
  44. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts +7 -0
  45. package/node_modules/mdast-util-to-markdown/lib/handle/list.d.ts.map +1 -1
  46. package/node_modules/mdast-util-to-markdown/lib/handle/list.js +7 -0
  47. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts +7 -0
  48. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.d.ts.map +1 -1
  49. package/node_modules/mdast-util-to-markdown/lib/handle/paragraph.js +7 -0
  50. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts +7 -0
  51. package/node_modules/mdast-util-to-markdown/lib/handle/root.d.ts.map +1 -1
  52. package/node_modules/mdast-util-to-markdown/lib/handle/root.js +13 -2
  53. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts +30 -2
  54. package/node_modules/mdast-util-to-markdown/lib/handle/strong.d.ts.map +1 -1
  55. package/node_modules/mdast-util-to-markdown/lib/handle/strong.js +39 -41
  56. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts +7 -0
  57. package/node_modules/mdast-util-to-markdown/lib/handle/text.d.ts.map +1 -1
  58. package/node_modules/mdast-util-to-markdown/lib/handle/text.js +7 -0
  59. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts +6 -0
  60. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.d.ts.map +1 -1
  61. package/node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js +6 -0
  62. package/node_modules/mdast-util-to-markdown/lib/index.d.ts.map +1 -1
  63. package/node_modules/mdast-util-to-markdown/lib/index.js +34 -8
  64. package/node_modules/mdast-util-to-markdown/lib/join.d.ts.map +1 -1
  65. package/node_modules/mdast-util-to-markdown/lib/join.js +18 -1
  66. package/node_modules/mdast-util-to-markdown/lib/types.d.ts +50 -30
  67. package/node_modules/mdast-util-to-markdown/lib/unsafe.d.ts.map +1 -1
  68. package/node_modules/mdast-util-to-markdown/lib/unsafe.js +15 -1
  69. package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts +23 -0
  70. package/node_modules/mdast-util-to-markdown/lib/util/character.d.ts.map +1 -0
  71. package/node_modules/mdast-util-to-markdown/lib/util/character.js +32 -0
  72. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts +4 -0
  73. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.d.ts.map +1 -1
  74. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js +4 -0
  75. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts +4 -0
  76. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.d.ts.map +1 -1
  77. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js +4 -0
  78. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts +4 -0
  79. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.d.ts.map +1 -1
  80. package/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js +4 -0
  81. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts +4 -0
  82. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.d.ts.map +1 -1
  83. package/node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js +4 -0
  84. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts +4 -0
  85. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.d.ts.map +1 -1
  86. package/node_modules/mdast-util-to-markdown/lib/util/check-fence.js +4 -0
  87. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts +4 -0
  88. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.d.ts.map +1 -1
  89. package/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js +4 -0
  90. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts +4 -0
  91. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.d.ts.map +1 -1
  92. package/node_modules/mdast-util-to-markdown/lib/util/check-quote.js +4 -0
  93. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts +4 -0
  94. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.d.ts.map +1 -1
  95. package/node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js +4 -0
  96. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts +4 -0
  97. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.d.ts.map +1 -1
  98. package/node_modules/mdast-util-to-markdown/lib/util/check-rule.js +4 -0
  99. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts +4 -0
  100. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.d.ts.map +1 -1
  101. package/node_modules/mdast-util-to-markdown/lib/util/check-strong.js +4 -0
  102. package/node_modules/mdast-util-to-markdown/lib/util/compile-pattern.js +3 -1
  103. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts +2 -0
  104. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.d.ts.map +1 -1
  105. package/node_modules/mdast-util-to-markdown/lib/util/container-flow.js +9 -0
  106. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts +95 -4
  107. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.d.ts.map +1 -1
  108. package/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js +636 -57
  109. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts +2 -2
  110. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.d.ts.map +1 -1
  111. package/node_modules/mdast-util-to-markdown/lib/util/encode-info.js +1 -1
  112. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts +5 -0
  113. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.d.ts.map +1 -1
  114. package/node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js +12 -7
  115. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts +5 -0
  116. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.d.ts.map +1 -1
  117. package/node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js +7 -2
  118. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts +5 -0
  119. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.d.ts.map +1 -1
  120. package/node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js +20 -15
  121. package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts +31 -0
  122. package/node_modules/mdast-util-to-markdown/lib/util/html-kind.d.ts.map +1 -0
  123. package/node_modules/mdast-util-to-markdown/lib/util/html-kind.js +63 -0
  124. package/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js +5 -0
  125. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts +5 -0
  126. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.d.ts.map +1 -1
  127. package/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js +11 -0
  128. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts +2 -2
  129. package/node_modules/mdast-util-to-markdown/lib/util/safe.d.ts.map +1 -1
  130. package/node_modules/mdast-util-to-markdown/lib/util/safe.js +71 -7
  131. package/node_modules/mdast-util-to-markdown/package.json +13 -57
  132. package/node_modules/mdast-util-to-markdown/readme.md +139 -84
  133. package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
  134. package/node_modules/micromark/dev/lib/compile.js +14 -4
  135. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
  136. package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
  137. package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
  138. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
  139. package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
  140. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
  141. package/node_modules/micromark/dev/lib/preprocess.js +19 -21
  142. package/node_modules/micromark/lib/compile.d.ts.map +1 -1
  143. package/node_modules/micromark/lib/compile.js +37 -29
  144. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
  145. package/node_modules/micromark/lib/create-tokenizer.js +37 -35
  146. package/node_modules/micromark/lib/initialize/document.js +21 -13
  147. package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
  148. package/node_modules/micromark/lib/initialize/text.js +7 -3
  149. package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
  150. package/node_modules/micromark/lib/preprocess.js +16 -19
  151. package/node_modules/micromark/package.json +2 -15
  152. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
  153. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
  154. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
  155. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
  156. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
  157. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
  158. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
  159. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
  160. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
  161. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
  162. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
  163. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
  164. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
  165. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  166. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
  167. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
  168. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
  169. package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
  170. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
  171. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
  172. package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
  173. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
  174. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
  175. package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
  176. package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
  177. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
  178. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
  179. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
  180. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
  181. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
  182. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  183. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
  184. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
  185. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
  186. package/node_modules/micromark-core-commonmark/package.json +4 -16
  187. package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
  188. package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
  189. package/node_modules/micromark-factory-space/dev/index.js +58 -3
  190. package/node_modules/micromark-factory-space/index.d.ts +24 -1
  191. package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
  192. package/node_modules/micromark-factory-space/index.js +55 -3
  193. package/node_modules/micromark-factory-space/package.json +1 -10
  194. package/node_modules/micromark-factory-space/readme.md +25 -25
  195. package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
  196. package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
  197. package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
  198. package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
  199. package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
  200. package/node_modules/micromark-util-edit-map/index.js +225 -0
  201. package/node_modules/micromark-util-edit-map/license +22 -0
  202. package/node_modules/micromark-util-edit-map/package.json +48 -0
  203. package/node_modules/micromark-util-edit-map/readme.md +234 -0
  204. package/node_modules/micromark-util-types/index.d.ts +6 -3
  205. package/node_modules/micromark-util-types/package.json +2 -36
  206. package/node_modules/ws/lib/websocket.js +17 -3
  207. package/node_modules/ws/package.json +1 -1
  208. package/package.json +4 -4
  209. package/node_modules/mdast-util-to-markdown/lib/util/emphasis-strong-marker.d.ts +0 -7
  210. 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][] syntax tree as input and turns
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], which focusses on making it
51
- easier to transform content by abstracting these internals away.
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][]** ecosystem instead.
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`][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`][node], optional)
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`][node])
302
+ * `left` ([`Node`][github-mdast-nodes])
262
303
  — first of two adjacent siblings
263
- * `right` ([`Node`][node])
304
+ * `right` ([`Node`][github-mdast-nodes])
264
305
  — second of two adjacent siblings
265
- * `parent` ([`Node`][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
- Marker to use for emphasis (`'*'` or `'_'`, default: `'*'`).
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
- Marker to use for strong (`'*'` or `'_'`, default: `'*'`).
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`](https://github.com/syntax-tree/mdast-util-directive)
598
+ * [`syntax-tree/mdast-util-directive`][github-mdast-util-directive]
552
599
  — directives
553
- * [`syntax-tree/mdast-util-frontmatter`](https://github.com/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`](https://github.com/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`](https://github.com/syntax-tree/mdast-util-math)
614
+ * [`syntax-tree/mdast-util-math`][github-mdast-util-math]
568
615
  — math
569
- * [`syntax-tree/mdast-util-mdx`](https://github.com/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, use of `mdast-util-to-markdown`
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`](https://github.com/remarkjs/remark)
683
+ * [`remarkjs/remark`][github-remark]
634
684
  — process markdown
635
685
 
636
686
  ## Contribute
637
687
 
638
- See [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for
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][author]
699
+ [MIT][license] © [Titus Wormer][wooorm]
649
700
 
650
701
  <!-- Definitions -->
651
702
 
652
- [build-badge]: https://github.com/syntax-tree/mdast-util-to-markdown/workflows/main/badge.svg
703
+ [api-attention]: #attention
653
704
 
654
- [build]: https://github.com/syntax-tree/mdast-util-to-markdown/actions
705
+ [api-attention-info]: #attentioninfo
655
706
 
656
- [coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-markdown.svg
707
+ [api-construct-name]: #constructname
657
708
 
658
- [coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-markdown
709
+ [api-construct-name-map]: #constructnamemap
659
710
 
660
- [downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-markdown.svg
711
+ [api-default-handlers]: #defaulthandlers
661
712
 
662
- [downloads]: https://www.npmjs.com/package/mdast-util-to-markdown
713
+ [api-handle]: #handle
663
714
 
664
- [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
715
+ [api-handlers]: #handlers
665
716
 
666
- [size]: https://bundlejs.com/?q=mdast-util-to-markdown
717
+ [api-info]: #info
667
718
 
668
- [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
719
+ [api-join]: #join
669
720
 
670
- [backers-badge]: https://opencollective.com/unified/backers/badge.svg
721
+ [api-map]: #map
671
722
 
672
- [collective]: https://opencollective.com/unified
723
+ [api-options]: #options
673
724
 
674
- [chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
725
+ [api-safe-config]: #safeconfig
675
726
 
676
- [chat]: https://github.com/syntax-tree/unist/discussions
727
+ [api-state]: #state
677
728
 
678
- [npm]: https://docs.npmjs.com/cli/install
729
+ [api-to-markdown]: #tomarkdowntree-options
679
730
 
680
- [esmsh]: https://esm.sh
731
+ [api-tracker]: #tracker
681
732
 
682
- [license]: license
733
+ [api-unsafe]: #unsafe
683
734
 
684
- [author]: https://wooorm.com
735
+ [backers-badge]: https://opencollective.com/unified/backers/badge.svg
685
736
 
686
- [health]: https://github.com/syntax-tree/.github
737
+ [build]: https://github.com/syntax-tree/mdast-util-to-markdown/actions
687
738
 
688
- [contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
739
+ [build-badge]: https://github.com/syntax-tree/mdast-util-to-markdown/workflows/main/badge.svg
689
740
 
690
- [support]: https://github.com/syntax-tree/.github/blob/main/support.md
741
+ [chat]: https://github.com/syntax-tree/unist/discussions
691
742
 
692
- [coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
743
+ [chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
693
744
 
694
- [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
745
+ [collective]: https://opencollective.com/unified
695
746
 
696
- [typescript]: https://www.typescriptlang.org
747
+ [coverage]: https://codecov.io/github/syntax-tree/mdast-util-to-markdown
697
748
 
698
- [xss]: https://en.wikipedia.org/wiki/Cross-site_scripting
749
+ [coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/mdast-util-to-markdown.svg
699
750
 
700
- [hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize
751
+ [downloads]: https://www.npmjs.com/package/mdast-util-to-markdown
701
752
 
702
- [point]: https://github.com/syntax-tree/unist#point
753
+ [downloads-badge]: https://img.shields.io/npm/dm/mdast-util-to-markdown.svg
703
754
 
704
- [mdast]: https://github.com/syntax-tree/mdast
755
+ [esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
705
756
 
706
- [node]: https://github.com/syntax-tree/mdast#nodes
757
+ [esmsh]: https://esm.sh
707
758
 
708
- [association]: https://github.com/syntax-tree/mdast#association
759
+ [github-hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize
709
760
 
710
- [mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm
761
+ [github-mdast]: https://github.com/syntax-tree/mdast
711
762
 
712
- [mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx
763
+ [github-mdast-association]: https://github.com/syntax-tree/mdast#association
713
764
 
714
- [mdast-util-frontmatter]: https://github.com/syntax-tree/mdast-util-frontmatter
765
+ [github-mdast-nodes]: https://github.com/syntax-tree/mdast#nodes
715
766
 
716
- [mdast-util-math]: https://github.com/syntax-tree/mdast-util-math
767
+ [github-mdast-util-directive]: https://github.com/syntax-tree/mdast-util-directive
717
768
 
718
- [mdast-util-directive]: https://github.com/syntax-tree/mdast-util-directive
769
+ [github-mdast-util-frontmatter]: https://github.com/syntax-tree/mdast-util-frontmatter
719
770
 
720
- [remark]: https://github.com/remarkjs/remark
771
+ [github-mdast-util-gfm]: https://github.com/syntax-tree/mdast-util-gfm
721
772
 
722
- [remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify
773
+ [github-mdast-util-math]: https://github.com/syntax-tree/mdast-util-math
723
774
 
724
- [api-construct-name]: #constructname
775
+ [github-mdast-util-mdx]: https://github.com/syntax-tree/mdast-util-mdx
725
776
 
726
- [api-construct-name-map]: #constructnamemap
777
+ [github-remark]: https://github.com/remarkjs/remark
727
778
 
728
- [api-default-handlers]: #defaulthandlers
779
+ [github-remark-stringify]: https://github.com/remarkjs/remark/tree/main/packages/remark-stringify
729
780
 
730
- [api-handle]: #handle
781
+ [github-unist-point]: https://github.com/syntax-tree/unist#point
731
782
 
732
- [api-handlers]: #handlers
783
+ [health]: https://github.com/syntax-tree/.github
733
784
 
734
- [api-info]: #info
785
+ [health-coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
735
786
 
736
- [api-join]: #join
787
+ [health-contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md
737
788
 
738
- [api-map]: #map
789
+ [health-support]: https://github.com/syntax-tree/.github/blob/main/support.md
739
790
 
740
- [api-options]: #options
791
+ [license]: license
741
792
 
742
- [api-safe-config]: #safeconfig
793
+ [npm]: https://docs.npmjs.com/cli/install
743
794
 
744
- [api-state]: #state
795
+ [size]: https://bundlejs.com/?q=mdast-util-to-markdown
745
796
 
746
- [api-to-markdown]: #tomarkdowntree-options
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
- [api-tracker]: #tracker
799
+ [sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
749
800
 
750
- [api-unsafe]: #unsafe
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,CAgkCnB;;YA/lCa,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"}
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) return
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) lineEndingIfNeeded()
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')) return
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,CAwhB3B;;;;4BApkBY,SAAS;;;;;;;;aAKR,OAAO;;;;UAEP,MAAM;;;;;uCAKT,SAAS,QAET,IAAI,KAEF,SAAS;kCAtBZ,sBAAsB;sCAAtB,sBAAsB;2BAAtB,sBAAsB;qCAAtB,sBAAsB;+BAAtB,sBAAsB"}
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) continue
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 {splice} from 'micromark-util-chunked'
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
- splice(
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
- self.events.length = index
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) closeFlow()
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) closeFlow()
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) stream.push(null)
284
+ if (endOfFile) {
285
+ stream.push(null)
286
+ }
287
+
283
288
  token.previous = childToken
284
- if (childToken) childToken.next = token
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
- splice(
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
- self.events.length = index
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":";;;AAeA,sCAAiD;AACjD,oCAA6C;8BARnC,sBAAsB;sCAAtB,sBAAsB"}
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) break
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
- events.splice(
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
  }