@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
|
@@ -201,14 +201,12 @@ export function createTokenizer(parser, initialize, from) {
|
|
|
201
201
|
* Nothing.
|
|
202
202
|
*/
|
|
203
203
|
function main() {
|
|
204
|
-
/** @type {number} */
|
|
205
|
-
let chunkIndex;
|
|
206
204
|
while (point._index < chunks.length) {
|
|
207
205
|
const chunk = chunks[point._index];
|
|
208
206
|
|
|
209
207
|
// If we’re in a buffer chunk, loop through it.
|
|
210
208
|
if (typeof chunk === 'string') {
|
|
211
|
-
chunkIndex = point._index;
|
|
209
|
+
const chunkIndex = point._index;
|
|
212
210
|
if (point._bufferIndex < 0) {
|
|
213
211
|
point._bufferIndex = 0;
|
|
214
212
|
}
|
|
@@ -571,38 +569,42 @@ function serializeChunks(chunks, expandTabs) {
|
|
|
571
569
|
let value;
|
|
572
570
|
if (typeof chunk === 'string') {
|
|
573
571
|
value = chunk;
|
|
574
|
-
} else
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
572
|
+
} else {
|
|
573
|
+
switch (chunk) {
|
|
574
|
+
case -5:
|
|
575
|
+
{
|
|
576
|
+
value = "\r";
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
case -4:
|
|
580
|
+
{
|
|
581
|
+
value = "\n";
|
|
582
|
+
break;
|
|
583
|
+
}
|
|
584
|
+
case -3:
|
|
585
|
+
{
|
|
586
|
+
value = "\r" + "\n";
|
|
587
|
+
break;
|
|
588
|
+
}
|
|
589
|
+
case -2:
|
|
590
|
+
{
|
|
591
|
+
value = expandTabs ? " " : "\t";
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
case -1:
|
|
595
|
+
{
|
|
596
|
+
if (!expandTabs && atTab) {
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
value = " ";
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
default:
|
|
603
|
+
{
|
|
604
|
+
// Currently only replacement character.
|
|
605
|
+
value = String.fromCharCode(chunk);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
606
608
|
}
|
|
607
609
|
atTab = chunk === -2;
|
|
608
610
|
result.push(value);
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
import { factorySpace } from 'micromark-factory-space';
|
|
21
21
|
import { markdownLineEnding } from 'micromark-util-character';
|
|
22
|
-
import {
|
|
22
|
+
import { EditMap } from 'micromark-util-edit-map';
|
|
23
23
|
/** @type {InitialConstruct} */
|
|
24
24
|
export const document = {
|
|
25
25
|
tokenize: initializeDocument
|
|
@@ -108,12 +108,12 @@ function initializeDocument(effects) {
|
|
|
108
108
|
};
|
|
109
109
|
index++;
|
|
110
110
|
}
|
|
111
|
-
|
|
111
|
+
const editMap = new EditMap();
|
|
112
112
|
// Inject the exits earlier (they’re still also at the end).
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
editMap.add(indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
|
|
115
114
|
// Discard the duplicate exits.
|
|
116
|
-
|
|
115
|
+
editMap.add(indexBeforeExits, index - indexBeforeExits, []);
|
|
116
|
+
editMap.consume(self.events);
|
|
117
117
|
return checkNewContainers(code);
|
|
118
118
|
}
|
|
119
119
|
return start(code);
|
|
@@ -156,7 +156,9 @@ function initializeDocument(effects) {
|
|
|
156
156
|
|
|
157
157
|
/** @type {State} */
|
|
158
158
|
function thereIsANewContainer(code) {
|
|
159
|
-
if (childFlow)
|
|
159
|
+
if (childFlow) {
|
|
160
|
+
closeFlow();
|
|
161
|
+
}
|
|
160
162
|
exitContainers(continued);
|
|
161
163
|
return documentContinued(code);
|
|
162
164
|
}
|
|
@@ -186,7 +188,9 @@ function initializeDocument(effects) {
|
|
|
186
188
|
/** @type {State} */
|
|
187
189
|
function flowStart(code) {
|
|
188
190
|
if (code === null) {
|
|
189
|
-
if (childFlow)
|
|
191
|
+
if (childFlow) {
|
|
192
|
+
closeFlow();
|
|
193
|
+
}
|
|
190
194
|
exitContainers(0);
|
|
191
195
|
effects.consume(code);
|
|
192
196
|
return;
|
|
@@ -230,9 +234,13 @@ function initializeDocument(effects) {
|
|
|
230
234
|
*/
|
|
231
235
|
function writeToChild(token, endOfFile) {
|
|
232
236
|
const stream = self.sliceStream(token);
|
|
233
|
-
if (endOfFile)
|
|
237
|
+
if (endOfFile) {
|
|
238
|
+
stream.push(null);
|
|
239
|
+
}
|
|
234
240
|
token.previous = childToken;
|
|
235
|
-
if (childToken)
|
|
241
|
+
if (childToken) {
|
|
242
|
+
childToken.next = token;
|
|
243
|
+
}
|
|
236
244
|
childToken = token;
|
|
237
245
|
childFlow.defineSkip(token.start);
|
|
238
246
|
childFlow.write(stream);
|
|
@@ -315,12 +323,12 @@ function initializeDocument(effects) {
|
|
|
315
323
|
};
|
|
316
324
|
index++;
|
|
317
325
|
}
|
|
318
|
-
|
|
326
|
+
const editMap = new EditMap();
|
|
319
327
|
// Inject the exits earlier (they’re still also at the end).
|
|
320
|
-
|
|
321
|
-
|
|
328
|
+
editMap.add(indexBeforeFlow + 1, 0, self.events.slice(indexBeforeExits));
|
|
322
329
|
// Discard the duplicate exits.
|
|
323
|
-
|
|
330
|
+
editMap.add(indexBeforeExits, index - indexBeforeExits, []);
|
|
331
|
+
editMap.consume(self.events);
|
|
324
332
|
}
|
|
325
333
|
}
|
|
326
334
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["text.js"],"names":[],"mappings":";;;AAgBA,sCAAiD;AACjD,oCAA6C;8BATnC,sBAAsB;sCAAtB,sBAAsB"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* } from 'micromark-util-types'
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import { EditMap } from 'micromark-util-edit-map';
|
|
12
13
|
export const resolver = {
|
|
13
14
|
resolveAll: createResolver()
|
|
14
15
|
};
|
|
@@ -142,6 +143,7 @@ function createResolver(extraResolver) {
|
|
|
142
143
|
* @type {Resolver}
|
|
143
144
|
*/
|
|
144
145
|
function resolveAllLineSuffixes(events, context) {
|
|
146
|
+
const editMap = new EditMap();
|
|
145
147
|
let eventIndex = 0; // Skip first.
|
|
146
148
|
|
|
147
149
|
while (++eventIndex <= events.length) {
|
|
@@ -161,7 +163,9 @@ function resolveAllLineSuffixes(events, context) {
|
|
|
161
163
|
size++;
|
|
162
164
|
bufferIndex--;
|
|
163
165
|
}
|
|
164
|
-
if (bufferIndex)
|
|
166
|
+
if (bufferIndex) {
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
165
169
|
bufferIndex = -1;
|
|
166
170
|
}
|
|
167
171
|
// Number
|
|
@@ -201,12 +205,12 @@ function resolveAllLineSuffixes(events, context) {
|
|
|
201
205
|
if (data.start.offset === data.end.offset) {
|
|
202
206
|
Object.assign(data, token);
|
|
203
207
|
} else {
|
|
204
|
-
|
|
205
|
-
eventIndex += 2;
|
|
208
|
+
editMap.add(eventIndex, 0, [['enter', token, context], ['exit', token, context]]);
|
|
206
209
|
}
|
|
207
210
|
}
|
|
208
211
|
eventIndex++;
|
|
209
212
|
}
|
|
210
213
|
}
|
|
214
|
+
editMap.consume(events);
|
|
211
215
|
return events;
|
|
212
216
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preprocess.d.ts","sourceRoot":"","sources":["preprocess.js"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,8BAHa,YAAY,
|
|
1
|
+
{"version":3,"file":"preprocess.d.ts","sourceRoot":"","sources":["preprocess.js"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,8BAHa,YAAY,CAoHxB;;;;mCAnIU,KAAK,aAEL,QAAQ,GAAG,IAAI,GAAG,SAAS,QAE3B,OAAO,GAAG,IAAI,GAAG,SAAS,KAExB,KAAK,CAAC,KAAK,CAAC;2BAZsB,sBAAsB;8BAAtB,sBAAsB;2BAAtB,sBAAsB"}
|
|
@@ -33,20 +33,11 @@ export function preprocess() {
|
|
|
33
33
|
/** @type {Preprocessor} */
|
|
34
34
|
// eslint-disable-next-line complexity
|
|
35
35
|
function preprocessor(value, encoding, end) {
|
|
36
|
+
value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value));
|
|
37
|
+
|
|
36
38
|
/** @type {Array<Chunk>} */
|
|
37
39
|
const chunks = [];
|
|
38
|
-
|
|
39
|
-
let match;
|
|
40
|
-
/** @type {number} */
|
|
41
|
-
let next;
|
|
42
|
-
/** @type {number} */
|
|
43
|
-
let startPosition;
|
|
44
|
-
/** @type {number} */
|
|
45
|
-
let endPosition;
|
|
46
|
-
/** @type {Code} */
|
|
47
|
-
let code;
|
|
48
|
-
value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value));
|
|
49
|
-
startPosition = 0;
|
|
40
|
+
let startPosition = 0;
|
|
50
41
|
buffer = '';
|
|
51
42
|
if (start) {
|
|
52
43
|
// To do: `markdown-rs` actually parses BOMs (byte order mark).
|
|
@@ -57,9 +48,9 @@ export function preprocess() {
|
|
|
57
48
|
}
|
|
58
49
|
while (startPosition < value.length) {
|
|
59
50
|
search.lastIndex = startPosition;
|
|
60
|
-
match = search.exec(value);
|
|
61
|
-
endPosition = match && match.index !== undefined ? match.index : value.length;
|
|
62
|
-
code = value.charCodeAt(endPosition);
|
|
51
|
+
const match = search.exec(value);
|
|
52
|
+
const endPosition = match && match.index !== undefined ? match.index : value.length;
|
|
53
|
+
const code = value.charCodeAt(endPosition);
|
|
63
54
|
if (!match) {
|
|
64
55
|
buffer = value.slice(startPosition);
|
|
65
56
|
break;
|
|
@@ -85,9 +76,11 @@ export function preprocess() {
|
|
|
85
76
|
}
|
|
86
77
|
case 9:
|
|
87
78
|
{
|
|
88
|
-
next = Math.ceil(column / 4) * 4;
|
|
79
|
+
const next = Math.ceil(column / 4) * 4;
|
|
89
80
|
chunks.push(-2);
|
|
90
|
-
while (column++ < next)
|
|
81
|
+
while (column++ < next) {
|
|
82
|
+
chunks.push(-1);
|
|
83
|
+
}
|
|
91
84
|
break;
|
|
92
85
|
}
|
|
93
86
|
case 10:
|
|
@@ -106,8 +99,12 @@ export function preprocess() {
|
|
|
106
99
|
startPosition = endPosition + 1;
|
|
107
100
|
}
|
|
108
101
|
if (end) {
|
|
109
|
-
if (atCarriageReturn)
|
|
110
|
-
|
|
102
|
+
if (atCarriageReturn) {
|
|
103
|
+
chunks.push(-5);
|
|
104
|
+
}
|
|
105
|
+
if (buffer) {
|
|
106
|
+
chunks.push(buffer);
|
|
107
|
+
}
|
|
111
108
|
chunks.push(null);
|
|
112
109
|
}
|
|
113
110
|
return chunks;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "micromark",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "small commonmark compliant markdown parser with positional info and concrete tokens",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
"micromark-util-chunked": "^2.0.0",
|
|
73
73
|
"micromark-util-combine-extensions": "^2.0.0",
|
|
74
74
|
"micromark-util-decode-numeric-character-reference": "^2.0.0",
|
|
75
|
+
"micromark-util-edit-map": "^1.0.0",
|
|
75
76
|
"micromark-util-encode": "^2.0.0",
|
|
76
77
|
"micromark-util-normalize-identifier": "^2.0.0",
|
|
77
78
|
"micromark-util-resolve-all": "^2.0.0",
|
|
@@ -82,19 +83,5 @@
|
|
|
82
83
|
},
|
|
83
84
|
"scripts": {
|
|
84
85
|
"build": "micromark-build"
|
|
85
|
-
},
|
|
86
|
-
"xo": {
|
|
87
|
-
"envs": [
|
|
88
|
-
"shared-node-browser"
|
|
89
|
-
],
|
|
90
|
-
"prettier": true,
|
|
91
|
-
"rules": {
|
|
92
|
-
"logical-assignment-operators": "off",
|
|
93
|
-
"max-depth": "off",
|
|
94
|
-
"unicorn/no-this-assignment": "off",
|
|
95
|
-
"unicorn/prefer-at": "off",
|
|
96
|
-
"unicorn/prefer-code-point": "off",
|
|
97
|
-
"unicorn/prefer-event-target": "off"
|
|
98
|
-
}
|
|
99
86
|
}
|
|
100
87
|
}
|
|
@@ -33,22 +33,8 @@ export const attention = {
|
|
|
33
33
|
// eslint-disable-next-line complexity
|
|
34
34
|
function resolveAllAttention(events, context) {
|
|
35
35
|
let index = -1
|
|
36
|
-
/** @type {number} */
|
|
37
|
-
let open
|
|
38
|
-
/** @type {Token} */
|
|
39
|
-
let group
|
|
40
|
-
/** @type {Token} */
|
|
41
|
-
let text
|
|
42
|
-
/** @type {Token} */
|
|
43
|
-
let openingSequence
|
|
44
|
-
/** @type {Token} */
|
|
45
|
-
let closingSequence
|
|
46
|
-
/** @type {number} */
|
|
47
|
-
let use
|
|
48
36
|
/** @type {Array<Event>} */
|
|
49
37
|
let nextEvents
|
|
50
|
-
/** @type {number} */
|
|
51
|
-
let offset
|
|
52
38
|
|
|
53
39
|
// Walk through all events.
|
|
54
40
|
//
|
|
@@ -61,7 +47,7 @@ function resolveAllAttention(events, context) {
|
|
|
61
47
|
events[index][1].type === 'attentionSequence' &&
|
|
62
48
|
events[index][1]._close
|
|
63
49
|
) {
|
|
64
|
-
open = index
|
|
50
|
+
let open = index
|
|
65
51
|
|
|
66
52
|
// Now walk back to find an opener.
|
|
67
53
|
while (open--) {
|
|
@@ -93,7 +79,7 @@ function resolveAllAttention(events, context) {
|
|
|
93
79
|
}
|
|
94
80
|
|
|
95
81
|
// Number of markers to use from the sequence.
|
|
96
|
-
use =
|
|
82
|
+
const use =
|
|
97
83
|
events[open][1].end.offset - events[open][1].start.offset > 1 &&
|
|
98
84
|
events[index][1].end.offset - events[index][1].start.offset > 1
|
|
99
85
|
? 2
|
|
@@ -104,22 +90,22 @@ function resolveAllAttention(events, context) {
|
|
|
104
90
|
movePoint(start, -use)
|
|
105
91
|
movePoint(end, use)
|
|
106
92
|
|
|
107
|
-
openingSequence = {
|
|
93
|
+
const openingSequence = {
|
|
108
94
|
type: use > 1 ? types.strongSequence : types.emphasisSequence,
|
|
109
95
|
start,
|
|
110
96
|
end: {...events[open][1].end}
|
|
111
97
|
}
|
|
112
|
-
closingSequence = {
|
|
98
|
+
const closingSequence = {
|
|
113
99
|
type: use > 1 ? types.strongSequence : types.emphasisSequence,
|
|
114
100
|
start: {...events[index][1].start},
|
|
115
101
|
end
|
|
116
102
|
}
|
|
117
|
-
text = {
|
|
103
|
+
const text = {
|
|
118
104
|
type: use > 1 ? types.strongText : types.emphasisText,
|
|
119
105
|
start: {...events[open][1].end},
|
|
120
106
|
end: {...events[index][1].start}
|
|
121
107
|
}
|
|
122
|
-
group = {
|
|
108
|
+
const group = {
|
|
123
109
|
type: use > 1 ? types.strong : types.emphasis,
|
|
124
110
|
start: {...openingSequence.start},
|
|
125
111
|
end: {...closingSequence.end}
|
|
@@ -170,6 +156,9 @@ function resolveAllAttention(events, context) {
|
|
|
170
156
|
['exit', group, context]
|
|
171
157
|
])
|
|
172
158
|
|
|
159
|
+
/** @type {number} */
|
|
160
|
+
let offset = 0
|
|
161
|
+
|
|
173
162
|
// If there are more markers in the closing, add them after.
|
|
174
163
|
if (events[index][1].end.offset - events[index][1].start.offset) {
|
|
175
164
|
offset = 2
|
|
@@ -177,8 +166,6 @@ function resolveAllAttention(events, context) {
|
|
|
177
166
|
['enter', events[index][1], context],
|
|
178
167
|
['exit', events[index][1], context]
|
|
179
168
|
])
|
|
180
|
-
} else {
|
|
181
|
-
offset = 0
|
|
182
169
|
}
|
|
183
170
|
|
|
184
171
|
splice(events, open - 1, index - open + 3, nextEvents)
|
|
@@ -261,14 +248,21 @@ function tokenizeAttention(effects, ok) {
|
|
|
261
248
|
// Always populated by defaults.
|
|
262
249
|
assert(attentionMarkers, 'expected `attentionMarkers` to be populated')
|
|
263
250
|
|
|
251
|
+
// Note: `*` and `_` are in `attentionMarkers` through core.
|
|
252
|
+
// They are excluded here as the loosening is meant for markers registered
|
|
253
|
+
// by *other* constructs (such as GFM strikethrough’s `~`).
|
|
264
254
|
const open =
|
|
265
255
|
!after ||
|
|
266
256
|
(after === constants.characterGroupPunctuation && before) ||
|
|
267
|
-
attentionMarkers.includes(code)
|
|
257
|
+
(attentionMarkers.includes(code) &&
|
|
258
|
+
code !== codes.asterisk &&
|
|
259
|
+
code !== codes.underscore)
|
|
268
260
|
const close =
|
|
269
261
|
!before ||
|
|
270
262
|
(before === constants.characterGroupPunctuation && after) ||
|
|
271
|
-
attentionMarkers.includes(previous)
|
|
263
|
+
(attentionMarkers.includes(previous) &&
|
|
264
|
+
previous !== codes.asterisk &&
|
|
265
|
+
previous !== codes.underscore)
|
|
272
266
|
|
|
273
267
|
token._open = Boolean(
|
|
274
268
|
marker === codes.asterisk ? open : open && (before || !close)
|
|
@@ -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"}
|
|
@@ -12,12 +12,7 @@ import {ok as assert} from 'devlop'
|
|
|
12
12
|
import {factorySpace} from 'micromark-factory-space'
|
|
13
13
|
import {markdownLineEnding, markdownSpace} from 'micromark-util-character'
|
|
14
14
|
import {codes, constants, types} from 'micromark-util-symbol'
|
|
15
|
-
|
|
16
|
-
/** @type {Construct} */
|
|
17
|
-
const nonLazyContinuation = {
|
|
18
|
-
partial: true,
|
|
19
|
-
tokenize: tokenizeNonLazyContinuation
|
|
20
|
-
}
|
|
15
|
+
import {nonLazyContinuation} from './partial-non-lazy-continuation.js'
|
|
21
16
|
|
|
22
17
|
/** @type {Construct} */
|
|
23
18
|
export const codeFenced = {
|
|
@@ -475,40 +470,3 @@ function tokenizeCodeFenced(effects, ok, nok) {
|
|
|
475
470
|
}
|
|
476
471
|
}
|
|
477
472
|
}
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* @this {TokenizeContext}
|
|
481
|
-
* Context.
|
|
482
|
-
* @type {Tokenizer}
|
|
483
|
-
*/
|
|
484
|
-
function tokenizeNonLazyContinuation(effects, ok, nok) {
|
|
485
|
-
const self = this
|
|
486
|
-
|
|
487
|
-
return start
|
|
488
|
-
|
|
489
|
-
/**
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
* @type {State}
|
|
493
|
-
*/
|
|
494
|
-
function start(code) {
|
|
495
|
-
if (code === codes.eof) {
|
|
496
|
-
return nok(code)
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
assert(markdownLineEnding(code), 'expected eol')
|
|
500
|
-
effects.enter(types.lineEnding)
|
|
501
|
-
effects.consume(code)
|
|
502
|
-
effects.exit(types.lineEnding)
|
|
503
|
-
return lineStart
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
*
|
|
508
|
-
*
|
|
509
|
-
* @type {State}
|
|
510
|
-
*/
|
|
511
|
-
function lineStart(code) {
|
|
512
|
-
return self.parser.lazy[self.now().line] ? nok(code) : ok(code)
|
|
513
|
-
}
|
|
514
|
-
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import {ok as assert} from 'devlop'
|
|
11
|
-
import {
|
|
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
|
-
|
|
52
|
-
// so that we can drop the next state.
|
|
53
|
-
return factorySpace(
|
|
50
|
+
return factorySpaceMinMax(
|
|
54
51
|
effects,
|
|
55
|
-
|
|
52
|
+
atBreak,
|
|
53
|
+
nok,
|
|
56
54
|
types.linePrefix,
|
|
57
|
-
constants.tabSize
|
|
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
|
-
|
|
153
|
+
ok,
|
|
154
|
+
onNotEnoughPrefix,
|
|
177
155
|
types.linePrefix,
|
|
178
|
-
constants.tabSize
|
|
156
|
+
constants.tabSize,
|
|
157
|
+
constants.tabSize
|
|
179
158
|
)(code)
|
|
180
159
|
}
|
|
181
160
|
|
|
182
161
|
/**
|
|
183
|
-
*
|
|
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
|
|
193
|
-
|
|
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":"
|
|
1
|
+
{"version":3,"file":"html-flow.d.ts","sourceRoot":"","sources":["html-flow.js"],"names":[],"mappings":"AAwBA,wBAAwB;AACxB,uBADW,SAAS,CAMnB;+BAtBS,sBAAsB"}
|