@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.
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
  */
9
9
 
10
10
  import {ok as assert} from 'devlop'
11
- import {factorySpace} from 'micromark-factory-space'
11
+ import {factorySpaceMinMax} from 'micromark-factory-space'
12
12
  import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
13
13
  import {codes, constants, types} from 'micromark-util-symbol'
14
14
 
@@ -27,7 +27,6 @@ const furtherStart = {partial: true, tokenize: tokenizeFurtherStart}
27
27
  * @type {Tokenizer}
28
28
  */
29
29
  function tokenizeCodeIndented(effects, ok, nok) {
30
- const self = this
31
30
  return start
32
31
 
33
32
  /**
@@ -48,35 +47,16 @@ function tokenizeCodeIndented(effects, ok, nok) {
48
47
  // To do: manually check if interrupting like `markdown-rs`.
49
48
  assert(markdownSpace(code))
50
49
  effects.enter(types.codeIndented)
51
- // To do: use an improved `space_or_tab` function like `markdown-rs`,
52
- // so that we can drop the next state.
53
- return factorySpace(
50
+ return factorySpaceMinMax(
54
51
  effects,
55
- afterPrefix,
52
+ atBreak,
53
+ nok,
56
54
  types.linePrefix,
57
- constants.tabSize + 1
55
+ constants.tabSize,
56
+ constants.tabSize
58
57
  )(code)
59
58
  }
60
59
 
61
- /**
62
- * At start, after 1 or 4 spaces.
63
- *
64
- * ```markdown
65
- * > | aaa
66
- * ^
67
- * ```
68
- *
69
- * @type {State}
70
- */
71
- function afterPrefix(code) {
72
- const tail = self.events[self.events.length - 1]
73
- return tail &&
74
- tail[1].type === types.linePrefix &&
75
- tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize
76
- ? atBreak(code)
77
- : nok(code)
78
- }
79
-
80
60
  /**
81
61
  * At a break.
82
62
  *
@@ -168,35 +148,31 @@ function tokenizeFurtherStart(effects, ok, nok) {
168
148
  // To do: the code here in `micromark-js` is a bit different from
169
149
  // `markdown-rs` because there it can attempt spaces.
170
150
  // We can’t yet.
171
- //
172
- // To do: use an improved `space_or_tab` function like `markdown-rs`,
173
- // so that we can drop the next state.
174
- return factorySpace(
151
+ return factorySpaceMinMax(
175
152
  effects,
176
- afterPrefix,
153
+ ok,
154
+ onNotEnoughPrefix,
177
155
  types.linePrefix,
178
- constants.tabSize + 1
156
+ constants.tabSize,
157
+ constants.tabSize
179
158
  )(code)
180
159
  }
181
160
 
182
161
  /**
183
- * At start, after 1 or 4 spaces.
162
+ * After not enough of a prefix.
163
+ *
164
+ * A following line ending is another (potentially blank) line to try,
165
+ * anything else means this isn’t a continuation.
184
166
  *
185
167
  * ```markdown
186
168
  * > | aaa
187
- * ^
169
+ *
170
+ * | bbb
188
171
  * ```
189
172
  *
190
173
  * @type {State}
191
174
  */
192
- function afterPrefix(code) {
193
- const tail = self.events[self.events.length - 1]
194
- return tail &&
195
- tail[1].type === types.linePrefix &&
196
- tail[2].sliceSerialize(tail[1], true).length >= constants.tabSize
197
- ? ok(code)
198
- : markdownLineEnding(code)
199
- ? furtherStart(code)
200
- : nok(code)
175
+ function onNotEnoughPrefix(code) {
176
+ return markdownLineEnding(code) ? furtherStart(code) : nok(code)
201
177
  }
202
178
  }
@@ -30,10 +30,6 @@ export const headingAtx = {
30
30
  function resolveHeadingAtx(events, context) {
31
31
  let contentEnd = events.length - 2
32
32
  let contentStart = 3
33
- /** @type {Token} */
34
- let content
35
- /** @type {Token} */
36
- let text
37
33
 
38
34
  // Prefix whitespace, part of the opening.
39
35
  if (events[contentStart][1].type === types.whitespace) {
@@ -58,12 +54,12 @@ function resolveHeadingAtx(events, context) {
58
54
  }
59
55
 
60
56
  if (contentEnd > contentStart) {
61
- content = {
57
+ const content = {
62
58
  type: types.atxHeadingText,
63
59
  start: events[contentStart][1].start,
64
60
  end: events[contentEnd][1].end
65
61
  }
66
- text = {
62
+ const text = {
67
63
  type: types.chunkText,
68
64
  start: events[contentStart][1].start,
69
65
  end: events[contentEnd][1].end,
@@ -1 +1 @@
1
- {"version":3,"file":"html-flow.d.ts","sourceRoot":"","sources":["html-flow.js"],"names":[],"mappings":"AAuBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BArBS,sBAAsB"}
1
+ {"version":3,"file":"html-flow.d.ts","sourceRoot":"","sources":["html-flow.js"],"names":[],"mappings":"AAwBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BAtBS,sBAAsB"}
@@ -20,6 +20,7 @@ import {
20
20
  import {htmlBlockNames, htmlRawNames} from 'micromark-util-html-tag-name'
21
21
  import {codes, constants, types} from 'micromark-util-symbol'
22
22
  import {blankLine} from './blank-line.js'
23
+ import {nonLazyContinuation} from './partial-non-lazy-continuation.js'
23
24
 
24
25
  /** @type {Construct} */
25
26
  export const htmlFlow = {
@@ -31,10 +32,6 @@ export const htmlFlow = {
31
32
 
32
33
  /** @type {Construct} */
33
34
  const blankLineBefore = {partial: true, tokenize: tokenizeBlankLineBefore}
34
- const nonLazyContinuationStart = {
35
- partial: true,
36
- tokenize: tokenizeNonLazyContinuationStart
37
- }
38
35
 
39
36
  /** @type {Resolver} */
40
37
  function resolveToHtmlFlow(events) {
@@ -704,7 +701,7 @@ function tokenizeHtmlFlow(effects, ok, nok) {
704
701
  */
705
702
  function continuationStart(code) {
706
703
  return effects.check(
707
- nonLazyContinuationStart,
704
+ nonLazyContinuation,
708
705
  continuationStartNonLazy,
709
706
  continuationAfter
710
707
  )(code)
@@ -912,54 +909,6 @@ function tokenizeHtmlFlow(effects, ok, nok) {
912
909
  }
913
910
  }
914
911
 
915
- /**
916
- * @this {TokenizeContext}
917
- * Context.
918
- * @type {Tokenizer}
919
- */
920
- function tokenizeNonLazyContinuationStart(effects, ok, nok) {
921
- const self = this
922
-
923
- return start
924
-
925
- /**
926
- * At eol, before continuation.
927
- *
928
- * ```markdown
929
- * > | * ```js
930
- * ^
931
- * | b
932
- * ```
933
- *
934
- * @type {State}
935
- */
936
- function start(code) {
937
- if (markdownLineEnding(code)) {
938
- effects.enter(types.lineEnding)
939
- effects.consume(code)
940
- effects.exit(types.lineEnding)
941
- return after
942
- }
943
-
944
- return nok(code)
945
- }
946
-
947
- /**
948
- * A continuation.
949
- *
950
- * ```markdown
951
- * | * ```js
952
- * > | b
953
- * ^
954
- * ```
955
- *
956
- * @type {State}
957
- */
958
- function after(code) {
959
- return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
960
- }
961
- }
962
-
963
912
  /**
964
913
  * @this {TokenizeContext}
965
914
  * Context.
@@ -69,8 +69,6 @@ function resolveAllLabelEnd(events) {
69
69
  function resolveToLabelEnd(events, context) {
70
70
  let index = events.length
71
71
  let offset = 0
72
- /** @type {Token} */
73
- let token
74
72
  /** @type {number | undefined} */
75
73
  let open
76
74
  /** @type {number | undefined} */
@@ -80,7 +78,7 @@ function resolveToLabelEnd(events, context) {
80
78
 
81
79
  // Find an opening.
82
80
  while (index--) {
83
- token = events[index][1]
81
+ const token = events[index][1]
84
82
 
85
83
  if (open) {
86
84
  // If we see another link, or inactive link label, we’ve been here before.
@@ -187,22 +185,23 @@ function resolveToLabelEnd(events, context) {
187
185
  */
188
186
  function tokenizeLabelEnd(effects, ok, nok) {
189
187
  const self = this
190
- let index = self.events.length
188
+ const labelStarts = self._labelStarts
191
189
  /** @type {Token} */
192
190
  let labelStart
193
191
  /** @type {boolean} */
194
192
  let defined
195
193
 
196
- // Find an opening.
197
- while (index--) {
198
- if (
199
- (self.events[index][1].type === types.labelImage ||
200
- self.events[index][1].type === types.labelLink) &&
201
- !self.events[index][1]._balanced
194
+ if (labelStarts) {
195
+ // Discard ones that failed to close,
196
+ // they’re not needed anymore.
197
+ while (
198
+ labelStarts.length > 0 &&
199
+ labelStarts[labelStarts.length - 1]._balanced
202
200
  ) {
203
- labelStart = self.events[index][1]
204
- break
201
+ labelStarts.pop()
205
202
  }
203
+
204
+ labelStart = labelStarts[labelStarts.length - 1]
206
205
  }
207
206
 
208
207
  return start
@@ -338,6 +337,9 @@ function tokenizeLabelEnd(effects, ok, nok) {
338
337
  */
339
338
  function labelEndOk(code) {
340
339
  // Note: `markdown-rs` does a bunch of stuff here.
340
+ // This label start is now used up: discard it so it’s never found again.
341
+ assert(labelStarts, 'expected `labelStarts` to be populated')
342
+ labelStarts.pop()
341
343
  return ok(code)
342
344
  }
343
345
 
@@ -1 +1 @@
1
- {"version":3,"file":"label-start-image.d.ts","sourceRoot":"","sources":["label-start-image.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAZS,sBAAsB"}
1
+ {"version":3,"file":"label-start-image.d.ts","sourceRoot":"","sources":["label-start-image.js"],"names":[],"mappings":"AAcA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAZS,sBAAsB"}
@@ -2,6 +2,7 @@
2
2
  * @import {
3
3
  * Construct,
4
4
  * State,
5
+ * Token,
5
6
  * TokenizeContext,
6
7
  * Tokenizer
7
8
  * } from 'micromark-util-types'
@@ -25,6 +26,8 @@ export const labelStartImage = {
25
26
  */
26
27
  function tokenizeLabelStartImage(effects, ok, nok) {
27
28
  const self = this
29
+ /** @type {Token} */
30
+ let labelImage
28
31
 
29
32
  return start
30
33
 
@@ -62,7 +65,7 @@ function tokenizeLabelStartImage(effects, ok, nok) {
62
65
  effects.enter(types.labelMarker)
63
66
  effects.consume(code)
64
67
  effects.exit(types.labelMarker)
65
- effects.exit(types.labelImage)
68
+ labelImage = effects.exit(types.labelImage)
66
69
  return after
67
70
  }
68
71
 
@@ -101,10 +104,16 @@ function tokenizeLabelStartImage(effects, ok, nok) {
101
104
  // `micromark-extension-gfm-footnote`, but the `label-start-link`
102
105
  // behavior isn’t.
103
106
  // Hidden footnotes hook.
104
- /* c8 ignore next 3 */
105
- return code === codes.caret &&
107
+ /* c8 ignore next 6 */
108
+ if (
109
+ code === codes.caret &&
106
110
  '_hiddenFootnoteSupport' in self.parser.constructs
107
- ? nok(code)
108
- : ok(code)
111
+ ) {
112
+ return nok(code)
113
+ }
114
+
115
+ self._labelStarts = self._labelStarts || []
116
+ self._labelStarts.push(labelImage)
117
+ return ok(code)
109
118
  }
110
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"label-start-link.d.ts","sourceRoot":"","sources":["label-start-link.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,6BADW,SAAS,CAKnB;+BAZS,sBAAsB"}
1
+ {"version":3,"file":"label-start-link.d.ts","sourceRoot":"","sources":["label-start-link.js"],"names":[],"mappings":"AAcA,wBAAwB;AACxB,6BADW,SAAS,CAKnB;+BAZS,sBAAsB"}
@@ -2,6 +2,7 @@
2
2
  * @import {
3
3
  * Construct,
4
4
  * State,
5
+ * Token,
5
6
  * TokenizeContext,
6
7
  * Tokenizer
7
8
  * } from 'micromark-util-types'
@@ -25,6 +26,8 @@ export const labelStartLink = {
25
26
  */
26
27
  function tokenizeLabelStartLink(effects, ok, nok) {
27
28
  const self = this
29
+ /** @type {Token} */
30
+ let labelLink
28
31
 
29
32
  return start
30
33
 
@@ -44,7 +47,7 @@ function tokenizeLabelStartLink(effects, ok, nok) {
44
47
  effects.enter(types.labelMarker)
45
48
  effects.consume(code)
46
49
  effects.exit(types.labelMarker)
47
- effects.exit(types.labelLink)
50
+ labelLink = effects.exit(types.labelLink)
48
51
  return after
49
52
  }
50
53
 
@@ -53,10 +56,16 @@ function tokenizeLabelStartLink(effects, ok, nok) {
53
56
  // To do: this isn’t needed in `micromark-extension-gfm-footnote`,
54
57
  // remove.
55
58
  // Hidden footnotes hook.
56
- /* c8 ignore next 3 */
57
- return code === codes.caret &&
59
+ /* c8 ignore next 6 */
60
+ if (
61
+ code === codes.caret &&
58
62
  '_hiddenFootnoteSupport' in self.parser.constructs
59
- ? nok(code)
60
- : ok(code)
63
+ ) {
64
+ return nok(code)
65
+ }
66
+
67
+ self._labelStarts = self._labelStarts || []
68
+ self._labelStarts.push(labelLink)
69
+ return ok(code)
61
70
  }
62
71
  }
@@ -0,0 +1,4 @@
1
+ /** @type {Construct} */
2
+ export const nonLazyContinuation: Construct;
3
+ import type { Construct } from 'micromark-util-types';
4
+ //# sourceMappingURL=partial-non-lazy-continuation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partial-non-lazy-continuation.d.ts","sourceRoot":"","sources":["partial-non-lazy-continuation.js"],"names":[],"mappings":"AAaA,wBAAwB;AACxB,kCADW,SAAS,CAInB;+BAXS,sBAAsB"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @import {
3
+ * Construct,
4
+ * State,
5
+ * TokenizeContext,
6
+ * Tokenizer
7
+ * } from 'micromark-util-types'
8
+ */
9
+
10
+ import {ok as assert} from 'devlop'
11
+ import {markdownLineEnding} from 'micromark-util-character'
12
+ import {codes, types} from 'micromark-util-symbol'
13
+
14
+ /** @type {Construct} */
15
+ export const nonLazyContinuation = {
16
+ partial: true,
17
+ tokenize: tokenizeNonLazyContinuation
18
+ }
19
+
20
+ /**
21
+ * @this {TokenizeContext}
22
+ * Context.
23
+ * @type {Tokenizer}
24
+ */
25
+ function tokenizeNonLazyContinuation(effects, ok, nok) {
26
+ const self = this
27
+
28
+ return start
29
+
30
+ /**
31
+ * At eol, before continuation.
32
+ *
33
+ * ```markdown
34
+ * > | * ```js
35
+ * ^
36
+ * | b
37
+ * ```
38
+ *
39
+ * @type {State}
40
+ */
41
+ function start(code) {
42
+ if (code === codes.eof) {
43
+ return nok(code)
44
+ }
45
+
46
+ assert(markdownLineEnding(code), 'expected eol')
47
+ effects.enter(types.lineEnding)
48
+ effects.consume(code)
49
+ effects.exit(types.lineEnding)
50
+ return after
51
+ }
52
+
53
+ /**
54
+ * A continuation.
55
+ *
56
+ * ```markdown
57
+ * | * ```js
58
+ * > | b
59
+ * ^
60
+ * ```
61
+ *
62
+ * @type {State}
63
+ */
64
+ function after(code) {
65
+ return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
66
+ }
67
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"setext-underline.d.ts","sourceRoot":"","sources":["setext-underline.js"],"names":[],"mappings":"AAgBA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAbS,sBAAsB"}
1
+ {"version":3,"file":"setext-underline.d.ts","sourceRoot":"","sources":["setext-underline.js"],"names":[],"mappings":"AAiBA,wBAAwB;AACxB,8BADW,SAAS,CAKnB;+BAdS,sBAAsB"}
@@ -12,6 +12,7 @@
12
12
  import {ok as assert} from 'devlop'
13
13
  import {factorySpace} from 'micromark-factory-space'
14
14
  import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
15
+ import {EditMap} from 'micromark-util-edit-map'
15
16
  import {codes, types} from 'micromark-util-symbol'
16
17
 
17
18
  /** @type {Construct} */
@@ -23,7 +24,7 @@ export const setextUnderline = {
23
24
 
24
25
  /** @type {Resolver} */
25
26
  function resolveToSetextUnderline(events, context) {
26
- // To do: resolve like `markdown-rs`.
27
+ const editMap = new EditMap()
27
28
  let index = events.length
28
29
  /** @type {number | undefined} */
29
30
  let content
@@ -49,7 +50,7 @@ function resolveToSetextUnderline(events, context) {
49
50
  else {
50
51
  if (events[index][1].type === types.content) {
51
52
  // Remove the content end (if needed we’ll add it later)
52
- events.splice(index, 1)
53
+ editMap.add(index, 1, [])
53
54
  }
54
55
 
55
56
  if (!definition && events[index][1].type === types.definition) {
@@ -77,15 +78,17 @@ function resolveToSetextUnderline(events, context) {
77
78
  // If we have definitions in the content, we’ll keep on having content,
78
79
  // but we need move it.
79
80
  if (definition) {
80
- events.splice(text, 0, ['enter', heading, context])
81
- events.splice(definition + 1, 0, ['exit', events[content][1], context])
81
+ editMap.add(text, 0, [['enter', heading, context]])
82
+ editMap.add(definition + 1, 0, [['exit', events[content][1], context]])
82
83
  events[content][1].end = {...events[definition][1].end}
83
84
  } else {
84
85
  events[content][1] = heading
85
86
  }
86
87
 
87
88
  // Add the heading exit at the end.
88
- events.push(['exit', heading, context])
89
+ editMap.add(events.length, 0, [['exit', heading, context]])
90
+
91
+ editMap.consume(events)
89
92
 
90
93
  return events
91
94
  }
@@ -30,22 +30,8 @@ export const attention = {
30
30
  // eslint-disable-next-line complexity
31
31
  function resolveAllAttention(events, context) {
32
32
  let index = -1;
33
- /** @type {number} */
34
- let open;
35
- /** @type {Token} */
36
- let group;
37
- /** @type {Token} */
38
- let text;
39
- /** @type {Token} */
40
- let openingSequence;
41
- /** @type {Token} */
42
- let closingSequence;
43
- /** @type {number} */
44
- let use;
45
33
  /** @type {Array<Event>} */
46
34
  let nextEvents;
47
- /** @type {number} */
48
- let offset;
49
35
 
50
36
  // Walk through all events.
51
37
  //
@@ -54,7 +40,7 @@ function resolveAllAttention(events, context) {
54
40
  while (++index < events.length) {
55
41
  // Find a token that can close.
56
42
  if (events[index][0] === 'enter' && events[index][1].type === 'attentionSequence' && events[index][1]._close) {
57
- open = index;
43
+ let open = index;
58
44
 
59
45
  // Now walk back to find an opener.
60
46
  while (open--) {
@@ -71,7 +57,7 @@ function resolveAllAttention(events, context) {
71
57
  }
72
58
 
73
59
  // Number of markers to use from the sequence.
74
- use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
60
+ const use = events[open][1].end.offset - events[open][1].start.offset > 1 && events[index][1].end.offset - events[index][1].start.offset > 1 ? 2 : 1;
75
61
  const start = {
76
62
  ...events[open][1].end
77
63
  };
@@ -80,21 +66,21 @@ function resolveAllAttention(events, context) {
80
66
  };
81
67
  movePoint(start, -use);
82
68
  movePoint(end, use);
83
- openingSequence = {
69
+ const openingSequence = {
84
70
  type: use > 1 ? "strongSequence" : "emphasisSequence",
85
71
  start,
86
72
  end: {
87
73
  ...events[open][1].end
88
74
  }
89
75
  };
90
- closingSequence = {
76
+ const closingSequence = {
91
77
  type: use > 1 ? "strongSequence" : "emphasisSequence",
92
78
  start: {
93
79
  ...events[index][1].start
94
80
  },
95
81
  end
96
82
  };
97
- text = {
83
+ const text = {
98
84
  type: use > 1 ? "strongText" : "emphasisText",
99
85
  start: {
100
86
  ...events[open][1].end
@@ -103,7 +89,7 @@ function resolveAllAttention(events, context) {
103
89
  ...events[index][1].start
104
90
  }
105
91
  };
106
- group = {
92
+ const group = {
107
93
  type: use > 1 ? "strong" : "emphasis",
108
94
  start: {
109
95
  ...openingSequence.start
@@ -136,12 +122,13 @@ function resolveAllAttention(events, context) {
136
122
  // Closing.
137
123
  nextEvents = push(nextEvents, [['exit', text, context], ['enter', closingSequence, context], ['exit', closingSequence, context], ['exit', group, context]]);
138
124
 
125
+ /** @type {number} */
126
+ let offset = 0;
127
+
139
128
  // If there are more markers in the closing, add them after.
140
129
  if (events[index][1].end.offset - events[index][1].start.offset) {
141
130
  offset = 2;
142
131
  nextEvents = push(nextEvents, [['enter', events[index][1], context], ['exit', events[index][1], context]]);
143
- } else {
144
- offset = 0;
145
132
  }
146
133
  splice(events, open - 1, index - open + 3, nextEvents);
147
134
  index = open + nextEvents.length - offset - 2;
@@ -213,8 +200,11 @@ function tokenizeAttention(effects, ok) {
213
200
 
214
201
  // Always populated by defaults.
215
202
 
216
- const open = !after || after === 2 && before || attentionMarkers.includes(code);
217
- const close = !before || before === 2 && after || attentionMarkers.includes(previous);
203
+ // Note: `*` and `_` are in `attentionMarkers` through core.
204
+ // They are excluded here as the loosening is meant for markers registered
205
+ // by *other* constructs (such as GFM strikethrough’s `~`).
206
+ const open = !after || after === 2 && before || attentionMarkers.includes(code) && code !== 42 && code !== 95;
207
+ const close = !before || before === 2 && after || attentionMarkers.includes(previous) && previous !== 42 && previous !== 95;
218
208
  token._open = Boolean(marker === 42 ? open : open && (before || !close));
219
209
  token._close = Boolean(marker === 42 ? close : close && (after || !open));
220
210
  return ok(code);
@@ -1 +1 @@
1
- {"version":3,"file":"code-fenced.d.ts","sourceRoot":"","sources":["code-fenced.js"],"names":[],"mappings":"AAqBA,wBAAwB;AACxB,yBADW,SAAS,CAKnB;+BAnBS,sBAAsB"}
1
+ {"version":3,"file":"code-fenced.d.ts","sourceRoot":"","sources":["code-fenced.js"],"names":[],"mappings":"AAgBA,wBAAwB;AACxB,yBADW,SAAS,CAKnB;+BAdS,sBAAsB"}
@@ -10,11 +10,7 @@
10
10
 
11
11
  import { factorySpace } from 'micromark-factory-space';
12
12
  import { markdownLineEnding, markdownSpace } from 'micromark-util-character';
13
- /** @type {Construct} */
14
- const nonLazyContinuation = {
15
- partial: true,
16
- tokenize: tokenizeNonLazyContinuation
17
- };
13
+ import { nonLazyContinuation } from './partial-non-lazy-continuation.js';
18
14
 
19
15
  /** @type {Construct} */
20
16
  export const codeFenced = {
@@ -423,38 +419,4 @@ function tokenizeCodeFenced(effects, ok, nok) {
423
419
  return nok(code);
424
420
  }
425
421
  }
426
- }
427
-
428
- /**
429
- * @this {TokenizeContext}
430
- * Context.
431
- * @type {Tokenizer}
432
- */
433
- function tokenizeNonLazyContinuation(effects, ok, nok) {
434
- const self = this;
435
- return start;
436
-
437
- /**
438
- *
439
- *
440
- * @type {State}
441
- */
442
- function start(code) {
443
- if (code === null) {
444
- return nok(code);
445
- }
446
- effects.enter("lineEnding");
447
- effects.consume(code);
448
- effects.exit("lineEnding");
449
- return lineStart;
450
- }
451
-
452
- /**
453
- *
454
- *
455
- * @type {State}
456
- */
457
- function lineStart(code) {
458
- return self.parser.lazy[self.now().line] ? nok(code) : ok(code);
459
- }
460
422
  }