@openclaw/discord 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.
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/node/dgram.d.ts +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +6 -0
- package/node_modules/@types/ws/README.md +1 -1
- package/node_modules/@types/ws/index.d.mts +4 -0
- package/node_modules/@types/ws/index.d.ts +4 -0
- package/node_modules/@types/ws/package.json +3 -3
- 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/package.json +4 -4
|
@@ -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
|
-
|
|
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
|
-
|
|
188
|
+
const labelStarts = self._labelStarts
|
|
191
189
|
/** @type {Token} */
|
|
192
190
|
let labelStart
|
|
193
191
|
/** @type {boolean} */
|
|
194
192
|
let defined
|
|
195
193
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
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":"
|
|
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
|
|
105
|
-
|
|
107
|
+
/* c8 ignore next 6 */
|
|
108
|
+
if (
|
|
109
|
+
code === codes.caret &&
|
|
106
110
|
'_hiddenFootnoteSupport' in self.parser.constructs
|
|
107
|
-
|
|
108
|
-
|
|
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":"
|
|
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
|
|
57
|
-
|
|
59
|
+
/* c8 ignore next 6 */
|
|
60
|
+
if (
|
|
61
|
+
code === codes.caret &&
|
|
58
62
|
'_hiddenFootnoteSupport' in self.parser.constructs
|
|
59
|
-
|
|
60
|
-
|
|
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 @@
|
|
|
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":"
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
81
|
-
|
|
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.
|
|
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
|
-
|
|
217
|
-
|
|
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":"
|
|
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
|
-
|
|
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
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* } from 'micromark-util-types'
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { factorySpaceMinMax } from 'micromark-factory-space';
|
|
11
11
|
import { markdownLineEnding, markdownSpace } from 'micromark-util-character';
|
|
12
12
|
/** @type {Construct} */
|
|
13
13
|
export const codeIndented = {
|
|
@@ -27,7 +27,6 @@ const furtherStart = {
|
|
|
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,24 +47,7 @@ function tokenizeCodeIndented(effects, ok, nok) {
|
|
|
48
47
|
// To do: manually check if interrupting like `markdown-rs`.
|
|
49
48
|
|
|
50
49
|
effects.enter("codeIndented");
|
|
51
|
-
|
|
52
|
-
// so that we can drop the next state.
|
|
53
|
-
return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* At start, after 1 or 4 spaces.
|
|
58
|
-
*
|
|
59
|
-
* ```markdown
|
|
60
|
-
* > | aaa
|
|
61
|
-
* ^
|
|
62
|
-
* ```
|
|
63
|
-
*
|
|
64
|
-
* @type {State}
|
|
65
|
-
*/
|
|
66
|
-
function afterPrefix(code) {
|
|
67
|
-
const tail = self.events[self.events.length - 1];
|
|
68
|
-
return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? atBreak(code) : nok(code);
|
|
50
|
+
return factorySpaceMinMax(effects, atBreak, nok, "linePrefix", 4, 4)(code);
|
|
69
51
|
}
|
|
70
52
|
|
|
71
53
|
/**
|
|
@@ -154,24 +136,24 @@ function tokenizeFurtherStart(effects, ok, nok) {
|
|
|
154
136
|
// To do: the code here in `micromark-js` is a bit different from
|
|
155
137
|
// `markdown-rs` because there it can attempt spaces.
|
|
156
138
|
// We can’t yet.
|
|
157
|
-
|
|
158
|
-
// To do: use an improved `space_or_tab` function like `markdown-rs`,
|
|
159
|
-
// so that we can drop the next state.
|
|
160
|
-
return factorySpace(effects, afterPrefix, "linePrefix", 4 + 1)(code);
|
|
139
|
+
return factorySpaceMinMax(effects, ok, onNotEnoughPrefix, "linePrefix", 4, 4)(code);
|
|
161
140
|
}
|
|
162
141
|
|
|
163
142
|
/**
|
|
164
|
-
*
|
|
143
|
+
* After not enough of a prefix.
|
|
144
|
+
*
|
|
145
|
+
* A following line ending is another (potentially blank) line to try,
|
|
146
|
+
* anything else means this isn’t a continuation.
|
|
165
147
|
*
|
|
166
148
|
* ```markdown
|
|
167
149
|
* > | aaa
|
|
168
|
-
*
|
|
150
|
+
*
|
|
151
|
+
* | bbb
|
|
169
152
|
* ```
|
|
170
153
|
*
|
|
171
154
|
* @type {State}
|
|
172
155
|
*/
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
return tail && tail[1].type === "linePrefix" && tail[2].sliceSerialize(tail[1], true).length >= 4 ? ok(code) : markdownLineEnding(code) ? furtherStart(code) : nok(code);
|
|
156
|
+
function onNotEnoughPrefix(code) {
|
|
157
|
+
return markdownLineEnding(code) ? furtherStart(code) : nok(code);
|
|
176
158
|
}
|
|
177
159
|
}
|
|
@@ -23,10 +23,6 @@ export const headingAtx = {
|
|
|
23
23
|
function resolveHeadingAtx(events, context) {
|
|
24
24
|
let contentEnd = events.length - 2;
|
|
25
25
|
let contentStart = 3;
|
|
26
|
-
/** @type {Token} */
|
|
27
|
-
let content;
|
|
28
|
-
/** @type {Token} */
|
|
29
|
-
let text;
|
|
30
26
|
|
|
31
27
|
// Prefix whitespace, part of the opening.
|
|
32
28
|
if (events[contentStart][1].type === "whitespace") {
|
|
@@ -41,12 +37,12 @@ function resolveHeadingAtx(events, context) {
|
|
|
41
37
|
contentEnd -= contentStart + 1 === contentEnd ? 2 : 4;
|
|
42
38
|
}
|
|
43
39
|
if (contentEnd > contentStart) {
|
|
44
|
-
content = {
|
|
40
|
+
const content = {
|
|
45
41
|
type: "atxHeadingText",
|
|
46
42
|
start: events[contentStart][1].start,
|
|
47
43
|
end: events[contentEnd][1].end
|
|
48
44
|
};
|
|
49
|
-
text = {
|
|
45
|
+
const text = {
|
|
50
46
|
type: "chunkText",
|
|
51
47
|
start: events[contentStart][1].start,
|
|
52
48
|
end: events[contentEnd][1].end,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-flow.d.ts","sourceRoot":"","sources":["html-flow.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"html-flow.d.ts","sourceRoot":"","sources":["html-flow.js"],"names":[],"mappings":"AAwBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BAtBS,sBAAsB"}
|