@uiw/react-md-editor 3.20.8 → 3.20.10
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/dist/mdeditor.css +1 -1
- package/dist/mdeditor.js +1283 -509
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/esm/Editor.d.ts +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/lib/Editor.d.ts +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +12 -0
- package/package.json +1 -1
- package/src/Editor.tsx +1 -1
- package/src/index.tsx +1 -0
package/dist/mdeditor.js
CHANGED
|
@@ -17389,6 +17389,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
17389
17389
|
"group": () => (/* reexport */ group),
|
|
17390
17390
|
"hr": () => (/* reexport */ hr),
|
|
17391
17391
|
"image": () => (/* reexport */ commands_image_image),
|
|
17392
|
+
"insertAtLineStart": () => (/* reexport */ insertAtLineStart),
|
|
17393
|
+
"insertTextAtPosition": () => (/* reexport */ insertTextAtPosition),
|
|
17392
17394
|
"italic": () => (/* reexport */ italic),
|
|
17393
17395
|
"link": () => (/* reexport */ commands_link_link),
|
|
17394
17396
|
"orderedListCommand": () => (/* reexport */ orderedListCommand),
|
|
@@ -17406,7 +17408,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
17406
17408
|
"unorderedListCommand": () => (/* reexport */ unorderedListCommand)
|
|
17407
17409
|
});
|
|
17408
17410
|
|
|
17409
|
-
// NAMESPACE OBJECT: ../node_modules/micromark/lib/constructs.js
|
|
17411
|
+
// NAMESPACE OBJECT: ../node_modules/react-markdown/node_modules/micromark/lib/constructs.js
|
|
17410
17412
|
var constructs_namespaceObject = {};
|
|
17411
17413
|
__webpack_require__.r(constructs_namespaceObject);
|
|
17412
17414
|
__webpack_require__.d(constructs_namespaceObject, {
|
|
@@ -17659,7 +17661,7 @@ function _extends() {
|
|
|
17659
17661
|
}
|
|
17660
17662
|
// EXTERNAL MODULE: ../node_modules/is-buffer/index.js
|
|
17661
17663
|
var is_buffer = __webpack_require__(5372);
|
|
17662
|
-
;// CONCATENATED MODULE: ../node_modules/unist-util-stringify-position/lib/index.js
|
|
17664
|
+
;// CONCATENATED MODULE: ../node_modules/vfile-message/node_modules/unist-util-stringify-position/lib/index.js
|
|
17663
17665
|
/**
|
|
17664
17666
|
* @typedef {import('unist').Node} Node
|
|
17665
17667
|
* @typedef {import('unist').Point} Point
|
|
@@ -19836,7 +19838,7 @@ function looksLikeAVFileValue(value) {
|
|
|
19836
19838
|
return typeof value === 'string' || is_buffer(value)
|
|
19837
19839
|
}
|
|
19838
19840
|
|
|
19839
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-string/lib/index.js
|
|
19841
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/mdast-util-to-string/lib/index.js
|
|
19840
19842
|
/**
|
|
19841
19843
|
* @typedef {import('mdast').Root|import('mdast').Content} Node
|
|
19842
19844
|
*
|
|
@@ -20390,7 +20392,7 @@ function factorySpace(effects, ok, type, max) {
|
|
|
20390
20392
|
}
|
|
20391
20393
|
}
|
|
20392
20394
|
|
|
20393
|
-
;// CONCATENATED MODULE: ../node_modules/micromark/lib/initialize/content.js
|
|
20395
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/initialize/content.js
|
|
20394
20396
|
/**
|
|
20395
20397
|
* @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
|
|
20396
20398
|
* @typedef {import('micromark-util-types').Initializer} Initializer
|
|
@@ -20471,7 +20473,7 @@ function initializeContent(effects) {
|
|
|
20471
20473
|
}
|
|
20472
20474
|
}
|
|
20473
20475
|
|
|
20474
|
-
;// CONCATENATED MODULE: ../node_modules/micromark/lib/initialize/document.js
|
|
20476
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/initialize/document.js
|
|
20475
20477
|
/**
|
|
20476
20478
|
* @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
|
|
20477
20479
|
* @typedef {import('micromark-util-types').Initializer} Initializer
|
|
@@ -21246,7 +21248,7 @@ function tokenizeContinuation(effects, ok, nok) {
|
|
|
21246
21248
|
}
|
|
21247
21249
|
}
|
|
21248
21250
|
|
|
21249
|
-
;// CONCATENATED MODULE: ../node_modules/micromark/lib/initialize/flow.js
|
|
21251
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/initialize/flow.js
|
|
21250
21252
|
/**
|
|
21251
21253
|
* @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
|
|
21252
21254
|
* @typedef {import('micromark-util-types').Initializer} Initializer
|
|
@@ -21313,7 +21315,7 @@ function initializeFlow(effects) {
|
|
|
21313
21315
|
}
|
|
21314
21316
|
}
|
|
21315
21317
|
|
|
21316
|
-
;// CONCATENATED MODULE: ../node_modules/micromark/lib/initialize/text.js
|
|
21318
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/initialize/text.js
|
|
21317
21319
|
/**
|
|
21318
21320
|
* @typedef {import('micromark-util-types').Resolver} Resolver
|
|
21319
21321
|
* @typedef {import('micromark-util-types').Initializer} Initializer
|
|
@@ -21565,7 +21567,7 @@ function resolveAll(constructs, events, context) {
|
|
|
21565
21567
|
return events
|
|
21566
21568
|
}
|
|
21567
21569
|
|
|
21568
|
-
;// CONCATENATED MODULE: ../node_modules/micromark/lib/create-tokenizer.js
|
|
21570
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/create-tokenizer.js
|
|
21569
21571
|
/**
|
|
21570
21572
|
* @typedef {import('micromark-util-types').Code} Code
|
|
21571
21573
|
* @typedef {import('micromark-util-types').Chunk} Chunk
|
|
@@ -26170,7 +26172,7 @@ function tokenizeCodeText(effects, ok, nok) {
|
|
|
26170
26172
|
}
|
|
26171
26173
|
}
|
|
26172
26174
|
|
|
26173
|
-
;// CONCATENATED MODULE: ../node_modules/micromark/lib/constructs.js
|
|
26175
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/constructs.js
|
|
26174
26176
|
/**
|
|
26175
26177
|
* @typedef {import('micromark-util-types').Extension} Extension
|
|
26176
26178
|
*/
|
|
@@ -26256,7 +26258,7 @@ const disable = {
|
|
|
26256
26258
|
null: []
|
|
26257
26259
|
}
|
|
26258
26260
|
|
|
26259
|
-
;// CONCATENATED MODULE: ../node_modules/micromark/lib/parse.js
|
|
26261
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/parse.js
|
|
26260
26262
|
/**
|
|
26261
26263
|
* @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct
|
|
26262
26264
|
* @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension
|
|
@@ -26310,7 +26312,7 @@ function parse_parse(options = {}) {
|
|
|
26310
26312
|
}
|
|
26311
26313
|
}
|
|
26312
26314
|
|
|
26313
|
-
;// CONCATENATED MODULE: ../node_modules/micromark/lib/preprocess.js
|
|
26315
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/preprocess.js
|
|
26314
26316
|
/**
|
|
26315
26317
|
* @typedef {import('micromark-util-types').Encoding} Encoding
|
|
26316
26318
|
* @typedef {import('micromark-util-types').Value} Value
|
|
@@ -26441,7 +26443,7 @@ function preprocess() {
|
|
|
26441
26443
|
}
|
|
26442
26444
|
}
|
|
26443
26445
|
|
|
26444
|
-
;// CONCATENATED MODULE: ../node_modules/micromark/lib/postprocess.js
|
|
26446
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/micromark/lib/postprocess.js
|
|
26445
26447
|
/**
|
|
26446
26448
|
* @typedef {import('micromark-util-types').Event} Event
|
|
26447
26449
|
*/
|
|
@@ -26533,7 +26535,93 @@ function decode($0, $1, $2) {
|
|
|
26533
26535
|
return decodeNamedCharacterReference($2) || $0
|
|
26534
26536
|
}
|
|
26535
26537
|
|
|
26536
|
-
;// CONCATENATED MODULE: ../node_modules/
|
|
26538
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/unist-util-stringify-position/lib/index.js
|
|
26539
|
+
/**
|
|
26540
|
+
* @typedef {import('unist').Node} Node
|
|
26541
|
+
* @typedef {import('unist').Point} Point
|
|
26542
|
+
* @typedef {import('unist').Position} Position
|
|
26543
|
+
*/
|
|
26544
|
+
|
|
26545
|
+
/**
|
|
26546
|
+
* @typedef NodeLike
|
|
26547
|
+
* @property {string} type
|
|
26548
|
+
* @property {PositionLike | null | undefined} [position]
|
|
26549
|
+
*
|
|
26550
|
+
* @typedef PositionLike
|
|
26551
|
+
* @property {PointLike | null | undefined} [start]
|
|
26552
|
+
* @property {PointLike | null | undefined} [end]
|
|
26553
|
+
*
|
|
26554
|
+
* @typedef PointLike
|
|
26555
|
+
* @property {number | null | undefined} [line]
|
|
26556
|
+
* @property {number | null | undefined} [column]
|
|
26557
|
+
* @property {number | null | undefined} [offset]
|
|
26558
|
+
*/
|
|
26559
|
+
|
|
26560
|
+
/**
|
|
26561
|
+
* Serialize the positional info of a point, position (start and end points),
|
|
26562
|
+
* or node.
|
|
26563
|
+
*
|
|
26564
|
+
* @param {Node | NodeLike | Position | PositionLike | Point | PointLike | null | undefined} [value]
|
|
26565
|
+
* Node, position, or point.
|
|
26566
|
+
* @returns {string}
|
|
26567
|
+
* Pretty printed positional info of a node (`string`).
|
|
26568
|
+
*
|
|
26569
|
+
* In the format of a range `ls:cs-le:ce` (when given `node` or `position`)
|
|
26570
|
+
* or a point `l:c` (when given `point`), where `l` stands for line, `c` for
|
|
26571
|
+
* column, `s` for `start`, and `e` for end.
|
|
26572
|
+
* An empty string (`''`) is returned if the given value is neither `node`,
|
|
26573
|
+
* `position`, nor `point`.
|
|
26574
|
+
*/
|
|
26575
|
+
function lib_stringifyPosition(value) {
|
|
26576
|
+
// Nothing.
|
|
26577
|
+
if (!value || typeof value !== 'object') {
|
|
26578
|
+
return ''
|
|
26579
|
+
}
|
|
26580
|
+
|
|
26581
|
+
// Node.
|
|
26582
|
+
if ('position' in value || 'type' in value) {
|
|
26583
|
+
return lib_position(value.position)
|
|
26584
|
+
}
|
|
26585
|
+
|
|
26586
|
+
// Position.
|
|
26587
|
+
if ('start' in value || 'end' in value) {
|
|
26588
|
+
return lib_position(value)
|
|
26589
|
+
}
|
|
26590
|
+
|
|
26591
|
+
// Point.
|
|
26592
|
+
if ('line' in value || 'column' in value) {
|
|
26593
|
+
return lib_point(value)
|
|
26594
|
+
}
|
|
26595
|
+
|
|
26596
|
+
// ?
|
|
26597
|
+
return ''
|
|
26598
|
+
}
|
|
26599
|
+
|
|
26600
|
+
/**
|
|
26601
|
+
* @param {Point | PointLike | null | undefined} point
|
|
26602
|
+
* @returns {string}
|
|
26603
|
+
*/
|
|
26604
|
+
function lib_point(point) {
|
|
26605
|
+
return lib_index(point && point.line) + ':' + lib_index(point && point.column)
|
|
26606
|
+
}
|
|
26607
|
+
|
|
26608
|
+
/**
|
|
26609
|
+
* @param {Position | PositionLike | null | undefined} pos
|
|
26610
|
+
* @returns {string}
|
|
26611
|
+
*/
|
|
26612
|
+
function lib_position(pos) {
|
|
26613
|
+
return lib_point(pos && pos.start) + '-' + lib_point(pos && pos.end)
|
|
26614
|
+
}
|
|
26615
|
+
|
|
26616
|
+
/**
|
|
26617
|
+
* @param {number | null | undefined} value
|
|
26618
|
+
* @returns {number}
|
|
26619
|
+
*/
|
|
26620
|
+
function lib_index(value) {
|
|
26621
|
+
return value && typeof value === 'number' ? value : 1
|
|
26622
|
+
}
|
|
26623
|
+
|
|
26624
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/mdast-util-from-markdown/lib/index.js
|
|
26537
26625
|
/**
|
|
26538
26626
|
* @typedef {import('micromark-util-types').Encoding} Encoding
|
|
26539
26627
|
* @typedef {import('micromark-util-types').Event} Event
|
|
@@ -26907,7 +26995,7 @@ function compiler(options) {
|
|
|
26907
26995
|
|
|
26908
26996
|
// Figure out `root` position.
|
|
26909
26997
|
tree.position = {
|
|
26910
|
-
start:
|
|
26998
|
+
start: mdast_util_from_markdown_lib_point(
|
|
26911
26999
|
events.length > 0
|
|
26912
27000
|
? events[0][1].start
|
|
26913
27001
|
: {
|
|
@@ -26916,7 +27004,7 @@ function compiler(options) {
|
|
|
26916
27004
|
offset: 0
|
|
26917
27005
|
}
|
|
26918
27006
|
),
|
|
26919
|
-
end:
|
|
27007
|
+
end: mdast_util_from_markdown_lib_point(
|
|
26920
27008
|
events.length > 0
|
|
26921
27009
|
? events[events.length - 2][1].end
|
|
26922
27010
|
: {
|
|
@@ -27154,7 +27242,7 @@ function compiler(options) {
|
|
|
27154
27242
|
this.tokenStack.push([token, errorHandler])
|
|
27155
27243
|
// @ts-expect-error: `end` will be patched later.
|
|
27156
27244
|
node.position = {
|
|
27157
|
-
start:
|
|
27245
|
+
start: mdast_util_from_markdown_lib_point(token.start)
|
|
27158
27246
|
}
|
|
27159
27247
|
return node
|
|
27160
27248
|
}
|
|
@@ -27199,7 +27287,7 @@ function compiler(options) {
|
|
|
27199
27287
|
'Cannot close `' +
|
|
27200
27288
|
token.type +
|
|
27201
27289
|
'` (' +
|
|
27202
|
-
|
|
27290
|
+
lib_stringifyPosition({
|
|
27203
27291
|
start: token.start,
|
|
27204
27292
|
end: token.end
|
|
27205
27293
|
}) +
|
|
@@ -27213,7 +27301,7 @@ function compiler(options) {
|
|
|
27213
27301
|
handler.call(this, token, open[0])
|
|
27214
27302
|
}
|
|
27215
27303
|
}
|
|
27216
|
-
node.position.end =
|
|
27304
|
+
node.position.end = mdast_util_from_markdown_lib_point(token.end)
|
|
27217
27305
|
return node
|
|
27218
27306
|
}
|
|
27219
27307
|
|
|
@@ -27384,7 +27472,7 @@ function compiler(options) {
|
|
|
27384
27472
|
tail = text()
|
|
27385
27473
|
// @ts-expect-error: we’ll add `end` later.
|
|
27386
27474
|
tail.position = {
|
|
27387
|
-
start:
|
|
27475
|
+
start: mdast_util_from_markdown_lib_point(token.start)
|
|
27388
27476
|
}
|
|
27389
27477
|
// @ts-expect-error: Assume `parent` accepts `text`.
|
|
27390
27478
|
node.children.push(tail)
|
|
@@ -27400,7 +27488,7 @@ function compiler(options) {
|
|
|
27400
27488
|
function onexitdata(token) {
|
|
27401
27489
|
const tail = this.stack.pop()
|
|
27402
27490
|
tail.value += this.sliceSerialize(token)
|
|
27403
|
-
tail.position.end =
|
|
27491
|
+
tail.position.end = mdast_util_from_markdown_lib_point(token.end)
|
|
27404
27492
|
}
|
|
27405
27493
|
|
|
27406
27494
|
/**
|
|
@@ -27413,7 +27501,7 @@ function compiler(options) {
|
|
|
27413
27501
|
// If we’re at a hard break, include the line ending in there.
|
|
27414
27502
|
if (getData('atHardBreak')) {
|
|
27415
27503
|
const tail = context.children[context.children.length - 1]
|
|
27416
|
-
tail.position.end =
|
|
27504
|
+
tail.position.end = mdast_util_from_markdown_lib_point(token.end)
|
|
27417
27505
|
setData('atHardBreak')
|
|
27418
27506
|
return
|
|
27419
27507
|
}
|
|
@@ -27650,7 +27738,7 @@ function compiler(options) {
|
|
|
27650
27738
|
}
|
|
27651
27739
|
const tail = this.stack.pop()
|
|
27652
27740
|
tail.value += value
|
|
27653
|
-
tail.position.end =
|
|
27741
|
+
tail.position.end = mdast_util_from_markdown_lib_point(token.end)
|
|
27654
27742
|
}
|
|
27655
27743
|
|
|
27656
27744
|
/**
|
|
@@ -27836,7 +27924,7 @@ function compiler(options) {
|
|
|
27836
27924
|
* @returns {Point}
|
|
27837
27925
|
* unist point.
|
|
27838
27926
|
*/
|
|
27839
|
-
function
|
|
27927
|
+
function mdast_util_from_markdown_lib_point(d) {
|
|
27840
27928
|
return {
|
|
27841
27929
|
line: d.line,
|
|
27842
27930
|
column: d.column,
|
|
@@ -27898,14 +27986,14 @@ function defaultOnError(left, right) {
|
|
|
27898
27986
|
'Cannot close `' +
|
|
27899
27987
|
left.type +
|
|
27900
27988
|
'` (' +
|
|
27901
|
-
|
|
27989
|
+
lib_stringifyPosition({
|
|
27902
27990
|
start: left.start,
|
|
27903
27991
|
end: left.end
|
|
27904
27992
|
}) +
|
|
27905
27993
|
'): a different token (`' +
|
|
27906
27994
|
right.type +
|
|
27907
27995
|
'`, ' +
|
|
27908
|
-
|
|
27996
|
+
lib_stringifyPosition({
|
|
27909
27997
|
start: right.start,
|
|
27910
27998
|
end: right.end
|
|
27911
27999
|
}) +
|
|
@@ -27916,7 +28004,7 @@ function defaultOnError(left, right) {
|
|
|
27916
28004
|
'Cannot close document, a token (`' +
|
|
27917
28005
|
right.type +
|
|
27918
28006
|
'`, ' +
|
|
27919
|
-
|
|
28007
|
+
lib_stringifyPosition({
|
|
27920
28008
|
start: right.start,
|
|
27921
28009
|
end: right.end
|
|
27922
28010
|
}) +
|
|
@@ -27925,7 +28013,7 @@ function defaultOnError(left, right) {
|
|
|
27925
28013
|
}
|
|
27926
28014
|
}
|
|
27927
28015
|
|
|
27928
|
-
;// CONCATENATED MODULE: ../node_modules/remark-parse/lib/index.js
|
|
28016
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/remark-parse/lib/index.js
|
|
27929
28017
|
/**
|
|
27930
28018
|
* @typedef {import('mdast').Root} Root
|
|
27931
28019
|
* @typedef {import('mdast-util-from-markdown').Options} Options
|
|
@@ -27955,7 +28043,7 @@ function remarkParse(options) {
|
|
|
27955
28043
|
Object.assign(this, {Parser: parser})
|
|
27956
28044
|
}
|
|
27957
28045
|
|
|
27958
|
-
;// CONCATENATED MODULE: ../node_modules/remark-parse/index.js
|
|
28046
|
+
;// CONCATENATED MODULE: ../node_modules/react-markdown/node_modules/remark-parse/index.js
|
|
27959
28047
|
|
|
27960
28048
|
|
|
27961
28049
|
/* harmony default export */ const remark_parse = (remarkParse);
|
|
@@ -28992,7 +29080,7 @@ const pointEnd = unist_util_position_lib_point('end')
|
|
|
28992
29080
|
* @returns {Position}
|
|
28993
29081
|
* Position.
|
|
28994
29082
|
*/
|
|
28995
|
-
function
|
|
29083
|
+
function unist_util_position_lib_position(node) {
|
|
28996
29084
|
return {start: pointStart(node), end: pointEnd(node)}
|
|
28997
29085
|
}
|
|
28998
29086
|
|
|
@@ -30719,7 +30807,7 @@ function createState(tree, options) {
|
|
|
30719
30807
|
* Nothing.
|
|
30720
30808
|
*/
|
|
30721
30809
|
function patch(from, to) {
|
|
30722
|
-
if (from.position) to.position =
|
|
30810
|
+
if (from.position) to.position = unist_util_position_lib_position(from)
|
|
30723
30811
|
}
|
|
30724
30812
|
|
|
30725
30813
|
/**
|
|
@@ -33348,17 +33436,19 @@ ReactMarkdown.propTypes = {
|
|
|
33348
33436
|
|
|
33349
33437
|
;// CONCATENATED MODULE: ../node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js
|
|
33350
33438
|
/**
|
|
33351
|
-
* @typedef {import('micromark-util-types').
|
|
33439
|
+
* @typedef {import('micromark-util-types').Code} Code
|
|
33352
33440
|
* @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord
|
|
33353
|
-
* @typedef {import('micromark-util-types').
|
|
33441
|
+
* @typedef {import('micromark-util-types').Event} Event
|
|
33442
|
+
* @typedef {import('micromark-util-types').Extension} Extension
|
|
33354
33443
|
* @typedef {import('micromark-util-types').Previous} Previous
|
|
33355
33444
|
* @typedef {import('micromark-util-types').State} State
|
|
33356
|
-
* @typedef {import('micromark-util-types').
|
|
33357
|
-
* @typedef {import('micromark-util-types').
|
|
33445
|
+
* @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext
|
|
33446
|
+
* @typedef {import('micromark-util-types').Tokenizer} Tokenizer
|
|
33358
33447
|
*/
|
|
33359
33448
|
|
|
33360
|
-
|
|
33361
|
-
|
|
33449
|
+
|
|
33450
|
+
const wwwPrefix = {
|
|
33451
|
+
tokenize: tokenizeWwwPrefix,
|
|
33362
33452
|
partial: true
|
|
33363
33453
|
}
|
|
33364
33454
|
const domain = {
|
|
@@ -33369,546 +33459,886 @@ const syntax_path = {
|
|
|
33369
33459
|
tokenize: tokenizePath,
|
|
33370
33460
|
partial: true
|
|
33371
33461
|
}
|
|
33372
|
-
const
|
|
33373
|
-
tokenize:
|
|
33462
|
+
const trail = {
|
|
33463
|
+
tokenize: tokenizeTrail,
|
|
33374
33464
|
partial: true
|
|
33375
33465
|
}
|
|
33376
|
-
const
|
|
33377
|
-
tokenize:
|
|
33466
|
+
const emailDomainDotTrail = {
|
|
33467
|
+
tokenize: tokenizeEmailDomainDotTrail,
|
|
33378
33468
|
partial: true
|
|
33379
33469
|
}
|
|
33380
33470
|
const wwwAutolink = {
|
|
33381
33471
|
tokenize: tokenizeWwwAutolink,
|
|
33382
33472
|
previous: previousWww
|
|
33383
33473
|
}
|
|
33384
|
-
const
|
|
33385
|
-
tokenize:
|
|
33386
|
-
previous:
|
|
33474
|
+
const protocolAutolink = {
|
|
33475
|
+
tokenize: tokenizeProtocolAutolink,
|
|
33476
|
+
previous: previousProtocol
|
|
33387
33477
|
}
|
|
33388
33478
|
const emailAutolink = {
|
|
33389
33479
|
tokenize: tokenizeEmailAutolink,
|
|
33390
33480
|
previous: previousEmail
|
|
33391
33481
|
}
|
|
33392
|
-
/** @type {ConstructRecord} */
|
|
33393
33482
|
|
|
33483
|
+
/** @type {ConstructRecord} */
|
|
33394
33484
|
const syntax_text = {}
|
|
33395
|
-
/** @type {Extension} */
|
|
33396
33485
|
|
|
33486
|
+
// To do: next major: expose functions that yields extension.
|
|
33487
|
+
|
|
33488
|
+
/**
|
|
33489
|
+
* Extension for `micromark` that can be passed in `extensions` to enable GFM
|
|
33490
|
+
* autolink literal syntax.
|
|
33491
|
+
*
|
|
33492
|
+
* @type {Extension}
|
|
33493
|
+
*/
|
|
33397
33494
|
const gfmAutolinkLiteral = {
|
|
33398
33495
|
text: syntax_text
|
|
33399
33496
|
}
|
|
33400
|
-
let syntax_code = 48
|
|
33497
|
+
let syntax_code = 48
|
|
33401
33498
|
|
|
33499
|
+
// Add alphanumerics.
|
|
33402
33500
|
while (syntax_code < 123) {
|
|
33403
33501
|
syntax_text[syntax_code] = emailAutolink
|
|
33404
33502
|
syntax_code++
|
|
33405
33503
|
if (syntax_code === 58) syntax_code = 65
|
|
33406
33504
|
else if (syntax_code === 91) syntax_code = 97
|
|
33407
33505
|
}
|
|
33408
|
-
|
|
33409
33506
|
syntax_text[43] = emailAutolink
|
|
33410
33507
|
syntax_text[45] = emailAutolink
|
|
33411
33508
|
syntax_text[46] = emailAutolink
|
|
33412
33509
|
syntax_text[95] = emailAutolink
|
|
33413
|
-
syntax_text[72] = [emailAutolink,
|
|
33414
|
-
syntax_text[104] = [emailAutolink,
|
|
33510
|
+
syntax_text[72] = [emailAutolink, protocolAutolink]
|
|
33511
|
+
syntax_text[104] = [emailAutolink, protocolAutolink]
|
|
33415
33512
|
syntax_text[87] = [emailAutolink, wwwAutolink]
|
|
33416
33513
|
syntax_text[119] = [emailAutolink, wwwAutolink]
|
|
33417
|
-
/** @type {Tokenizer} */
|
|
33418
33514
|
|
|
33515
|
+
// To do: perform email autolink literals on events, afterwards.
|
|
33516
|
+
// That’s where `markdown-rs` and `cmark-gfm` perform it.
|
|
33517
|
+
// It should look for `@`, then for atext backwards, and then for a label
|
|
33518
|
+
// forwards.
|
|
33519
|
+
// To do: `mailto:`, `xmpp:` protocol as prefix.
|
|
33520
|
+
|
|
33521
|
+
/**
|
|
33522
|
+
* Email autolink literal.
|
|
33523
|
+
*
|
|
33524
|
+
* ```markdown
|
|
33525
|
+
* > | a contact@example.org b
|
|
33526
|
+
* ^^^^^^^^^^^^^^^^^^^
|
|
33527
|
+
* ```
|
|
33528
|
+
*
|
|
33529
|
+
* @this {TokenizeContext}
|
|
33530
|
+
* @type {Tokenizer}
|
|
33531
|
+
*/
|
|
33419
33532
|
function tokenizeEmailAutolink(effects, ok, nok) {
|
|
33420
33533
|
const self = this
|
|
33534
|
+
/** @type {boolean | undefined} */
|
|
33535
|
+
let dot
|
|
33421
33536
|
/** @type {boolean} */
|
|
33422
|
-
|
|
33423
|
-
let hasDot
|
|
33424
|
-
/** @type {boolean|undefined} */
|
|
33425
|
-
|
|
33426
|
-
let hasDigitInLastSegment
|
|
33537
|
+
let data
|
|
33427
33538
|
return start
|
|
33428
|
-
/** @type {State} */
|
|
33429
33539
|
|
|
33540
|
+
/**
|
|
33541
|
+
* Start of email autolink literal.
|
|
33542
|
+
*
|
|
33543
|
+
* ```markdown
|
|
33544
|
+
* > | a contact@example.org b
|
|
33545
|
+
* ^
|
|
33546
|
+
* ```
|
|
33547
|
+
*
|
|
33548
|
+
* @type {State}
|
|
33549
|
+
*/
|
|
33430
33550
|
function start(code) {
|
|
33431
33551
|
if (
|
|
33432
33552
|
!gfmAtext(code) ||
|
|
33433
|
-
!previousEmail(self.previous) ||
|
|
33553
|
+
!previousEmail.call(self, self.previous) ||
|
|
33434
33554
|
previousUnbalanced(self.events)
|
|
33435
33555
|
) {
|
|
33436
33556
|
return nok(code)
|
|
33437
33557
|
}
|
|
33438
|
-
|
|
33439
33558
|
effects.enter('literalAutolink')
|
|
33440
33559
|
effects.enter('literalAutolinkEmail')
|
|
33441
33560
|
return atext(code)
|
|
33442
33561
|
}
|
|
33443
|
-
/** @type {State} */
|
|
33444
33562
|
|
|
33563
|
+
/**
|
|
33564
|
+
* In email atext.
|
|
33565
|
+
*
|
|
33566
|
+
* ```markdown
|
|
33567
|
+
* > | a contact@example.org b
|
|
33568
|
+
* ^
|
|
33569
|
+
* ```
|
|
33570
|
+
*
|
|
33571
|
+
* @type {State}
|
|
33572
|
+
*/
|
|
33445
33573
|
function atext(code) {
|
|
33446
33574
|
if (gfmAtext(code)) {
|
|
33447
33575
|
effects.consume(code)
|
|
33448
33576
|
return atext
|
|
33449
33577
|
}
|
|
33450
|
-
|
|
33451
33578
|
if (code === 64) {
|
|
33452
33579
|
effects.consume(code)
|
|
33453
|
-
return
|
|
33580
|
+
return emailDomain
|
|
33454
33581
|
}
|
|
33455
|
-
|
|
33456
33582
|
return nok(code)
|
|
33457
33583
|
}
|
|
33458
|
-
/** @type {State} */
|
|
33459
33584
|
|
|
33460
|
-
|
|
33585
|
+
/**
|
|
33586
|
+
* In email domain.
|
|
33587
|
+
*
|
|
33588
|
+
* The reference code is a bit overly complex as it handles the `@`, of which
|
|
33589
|
+
* there may be just one.
|
|
33590
|
+
* Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L318>
|
|
33591
|
+
*
|
|
33592
|
+
* ```markdown
|
|
33593
|
+
* > | a contact@example.org b
|
|
33594
|
+
* ^
|
|
33595
|
+
* ```
|
|
33596
|
+
*
|
|
33597
|
+
* @type {State}
|
|
33598
|
+
*/
|
|
33599
|
+
function emailDomain(code) {
|
|
33600
|
+
// Dot followed by alphanumerical (not `-` or `_`).
|
|
33461
33601
|
if (code === 46) {
|
|
33462
|
-
return effects.check(
|
|
33463
|
-
|
|
33464
|
-
|
|
33465
|
-
|
|
33466
|
-
|
|
33602
|
+
return effects.check(
|
|
33603
|
+
emailDomainDotTrail,
|
|
33604
|
+
emailDomainAfter,
|
|
33605
|
+
emailDomainDot
|
|
33606
|
+
)(code)
|
|
33467
33607
|
}
|
|
33468
33608
|
|
|
33469
|
-
|
|
33470
|
-
|
|
33471
|
-
|
|
33472
|
-
}
|
|
33473
|
-
|
|
33609
|
+
// Alphanumerical, `-`, and `_`.
|
|
33610
|
+
if (code === 45 || code === 95 || asciiAlphanumeric(code)) {
|
|
33611
|
+
data = true
|
|
33474
33612
|
effects.consume(code)
|
|
33475
|
-
return
|
|
33613
|
+
return emailDomain
|
|
33476
33614
|
}
|
|
33477
33615
|
|
|
33478
|
-
|
|
33479
|
-
}
|
|
33480
|
-
/** @type {State} */
|
|
33616
|
+
// To do: `/` if xmpp.
|
|
33481
33617
|
|
|
33482
|
-
|
|
33483
|
-
|
|
33484
|
-
|
|
33485
|
-
|
|
33486
|
-
return
|
|
33618
|
+
// Note: normally we’d truncate trailing punctuation from the link.
|
|
33619
|
+
// However, email autolink literals cannot contain any of those markers,
|
|
33620
|
+
// except for `.`, but that can only occur if it isn’t trailing.
|
|
33621
|
+
// So we can ignore truncating!
|
|
33622
|
+
return emailDomainAfter(code)
|
|
33487
33623
|
}
|
|
33488
|
-
/** @type {State} */
|
|
33489
33624
|
|
|
33490
|
-
|
|
33625
|
+
/**
|
|
33626
|
+
* In email domain, on dot that is not a trail.
|
|
33627
|
+
*
|
|
33628
|
+
* ```markdown
|
|
33629
|
+
* > | a contact@example.org b
|
|
33630
|
+
* ^
|
|
33631
|
+
* ```
|
|
33632
|
+
*
|
|
33633
|
+
* @type {State}
|
|
33634
|
+
*/
|
|
33635
|
+
function emailDomainDot(code) {
|
|
33491
33636
|
effects.consume(code)
|
|
33492
|
-
|
|
33493
|
-
|
|
33494
|
-
/** @type {State} */
|
|
33495
|
-
|
|
33496
|
-
function afterDashOrUnderscore(code) {
|
|
33497
|
-
if (code === 46) {
|
|
33498
|
-
return effects.check(punctuation, nok, dotContinuation)(code)
|
|
33499
|
-
}
|
|
33500
|
-
|
|
33501
|
-
return label(code)
|
|
33637
|
+
dot = true
|
|
33638
|
+
return emailDomain
|
|
33502
33639
|
}
|
|
33503
|
-
/** @type {State} */
|
|
33504
33640
|
|
|
33505
|
-
|
|
33506
|
-
|
|
33641
|
+
/**
|
|
33642
|
+
* After email domain.
|
|
33643
|
+
*
|
|
33644
|
+
* ```markdown
|
|
33645
|
+
* > | a contact@example.org b
|
|
33646
|
+
* ^
|
|
33647
|
+
* ```
|
|
33648
|
+
*
|
|
33649
|
+
* @type {State}
|
|
33650
|
+
*/
|
|
33651
|
+
function emailDomainAfter(code) {
|
|
33652
|
+
// Domain must not be empty, must include a dot, and must end in alphabetical.
|
|
33653
|
+
// Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L332>.
|
|
33654
|
+
if (data && dot && asciiAlpha(self.previous)) {
|
|
33507
33655
|
effects.exit('literalAutolinkEmail')
|
|
33508
33656
|
effects.exit('literalAutolink')
|
|
33509
33657
|
return ok(code)
|
|
33510
33658
|
}
|
|
33511
|
-
|
|
33512
33659
|
return nok(code)
|
|
33513
33660
|
}
|
|
33514
33661
|
}
|
|
33515
|
-
/** @type {Tokenizer} */
|
|
33516
33662
|
|
|
33663
|
+
/**
|
|
33664
|
+
* `www` autolink literal.
|
|
33665
|
+
*
|
|
33666
|
+
* ```markdown
|
|
33667
|
+
* > | a www.example.org b
|
|
33668
|
+
* ^^^^^^^^^^^^^^^
|
|
33669
|
+
* ```
|
|
33670
|
+
*
|
|
33671
|
+
* @this {TokenizeContext}
|
|
33672
|
+
* @type {Tokenizer}
|
|
33673
|
+
*/
|
|
33517
33674
|
function tokenizeWwwAutolink(effects, ok, nok) {
|
|
33518
33675
|
const self = this
|
|
33519
|
-
return
|
|
33520
|
-
/** @type {State} */
|
|
33676
|
+
return wwwStart
|
|
33521
33677
|
|
|
33522
|
-
|
|
33678
|
+
/**
|
|
33679
|
+
* Start of www autolink literal.
|
|
33680
|
+
*
|
|
33681
|
+
* ```markdown
|
|
33682
|
+
* > | www.example.com/a?b#c
|
|
33683
|
+
* ^
|
|
33684
|
+
* ```
|
|
33685
|
+
*
|
|
33686
|
+
* @type {State}
|
|
33687
|
+
*/
|
|
33688
|
+
function wwwStart(code) {
|
|
33523
33689
|
if (
|
|
33524
33690
|
(code !== 87 && code !== 119) ||
|
|
33525
|
-
!previousWww(self.previous) ||
|
|
33691
|
+
!previousWww.call(self, self.previous) ||
|
|
33526
33692
|
previousUnbalanced(self.events)
|
|
33527
33693
|
) {
|
|
33528
33694
|
return nok(code)
|
|
33529
33695
|
}
|
|
33530
|
-
|
|
33531
33696
|
effects.enter('literalAutolink')
|
|
33532
|
-
effects.enter('literalAutolinkWww')
|
|
33533
|
-
//
|
|
33534
|
-
//
|
|
33535
|
-
|
|
33697
|
+
effects.enter('literalAutolinkWww')
|
|
33698
|
+
// Note: we *check*, so we can discard the `www.` we parsed.
|
|
33699
|
+
// If it worked, we consider it as a part of the domain.
|
|
33536
33700
|
return effects.check(
|
|
33537
|
-
|
|
33538
|
-
effects.attempt(domain, effects.attempt(syntax_path,
|
|
33701
|
+
wwwPrefix,
|
|
33702
|
+
effects.attempt(domain, effects.attempt(syntax_path, wwwAfter), nok),
|
|
33539
33703
|
nok
|
|
33540
33704
|
)(code)
|
|
33541
33705
|
}
|
|
33542
|
-
/** @type {State} */
|
|
33543
33706
|
|
|
33544
|
-
|
|
33707
|
+
/**
|
|
33708
|
+
* After a www autolink literal.
|
|
33709
|
+
*
|
|
33710
|
+
* ```markdown
|
|
33711
|
+
* > | www.example.com/a?b#c
|
|
33712
|
+
* ^
|
|
33713
|
+
* ```
|
|
33714
|
+
*
|
|
33715
|
+
* @type {State}
|
|
33716
|
+
*/
|
|
33717
|
+
function wwwAfter(code) {
|
|
33545
33718
|
effects.exit('literalAutolinkWww')
|
|
33546
33719
|
effects.exit('literalAutolink')
|
|
33547
33720
|
return ok(code)
|
|
33548
33721
|
}
|
|
33549
33722
|
}
|
|
33550
|
-
/** @type {Tokenizer} */
|
|
33551
33723
|
|
|
33552
|
-
|
|
33724
|
+
/**
|
|
33725
|
+
* Protocol autolink literal.
|
|
33726
|
+
*
|
|
33727
|
+
* ```markdown
|
|
33728
|
+
* > | a https://example.org b
|
|
33729
|
+
* ^^^^^^^^^^^^^^^^^^^
|
|
33730
|
+
* ```
|
|
33731
|
+
*
|
|
33732
|
+
* @this {TokenizeContext}
|
|
33733
|
+
* @type {Tokenizer}
|
|
33734
|
+
*/
|
|
33735
|
+
function tokenizeProtocolAutolink(effects, ok, nok) {
|
|
33553
33736
|
const self = this
|
|
33554
|
-
|
|
33555
|
-
|
|
33737
|
+
let buffer = ''
|
|
33738
|
+
let seen = false
|
|
33739
|
+
return protocolStart
|
|
33556
33740
|
|
|
33557
|
-
|
|
33741
|
+
/**
|
|
33742
|
+
* Start of protocol autolink literal.
|
|
33743
|
+
*
|
|
33744
|
+
* ```markdown
|
|
33745
|
+
* > | https://example.com/a?b#c
|
|
33746
|
+
* ^
|
|
33747
|
+
* ```
|
|
33748
|
+
*
|
|
33749
|
+
* @type {State}
|
|
33750
|
+
*/
|
|
33751
|
+
function protocolStart(code) {
|
|
33558
33752
|
if (
|
|
33559
|
-
(code
|
|
33560
|
-
|
|
33561
|
-
previousUnbalanced(self.events)
|
|
33753
|
+
(code === 72 || code === 104) &&
|
|
33754
|
+
previousProtocol.call(self, self.previous) &&
|
|
33755
|
+
!previousUnbalanced(self.events)
|
|
33562
33756
|
) {
|
|
33563
|
-
|
|
33564
|
-
|
|
33565
|
-
|
|
33566
|
-
effects.enter('literalAutolink')
|
|
33567
|
-
effects.enter('literalAutolinkHttp')
|
|
33568
|
-
effects.consume(code)
|
|
33569
|
-
return t1
|
|
33570
|
-
}
|
|
33571
|
-
/** @type {State} */
|
|
33572
|
-
|
|
33573
|
-
function t1(code) {
|
|
33574
|
-
if (code === 84 || code === 116) {
|
|
33757
|
+
effects.enter('literalAutolink')
|
|
33758
|
+
effects.enter('literalAutolinkHttp')
|
|
33759
|
+
buffer += String.fromCodePoint(code)
|
|
33575
33760
|
effects.consume(code)
|
|
33576
|
-
return
|
|
33761
|
+
return protocolPrefixInside
|
|
33577
33762
|
}
|
|
33578
|
-
|
|
33579
33763
|
return nok(code)
|
|
33580
33764
|
}
|
|
33581
|
-
/** @type {State} */
|
|
33582
33765
|
|
|
33583
|
-
|
|
33584
|
-
|
|
33585
|
-
|
|
33586
|
-
|
|
33587
|
-
|
|
33588
|
-
|
|
33589
|
-
|
|
33590
|
-
|
|
33591
|
-
|
|
33592
|
-
|
|
33593
|
-
function
|
|
33594
|
-
|
|
33595
|
-
|
|
33596
|
-
|
|
33597
|
-
}
|
|
33598
|
-
|
|
33599
|
-
return nok(code)
|
|
33600
|
-
}
|
|
33601
|
-
/** @type {State} */
|
|
33602
|
-
|
|
33603
|
-
function s(code) {
|
|
33604
|
-
if (code === 83 || code === 115) {
|
|
33766
|
+
/**
|
|
33767
|
+
* In protocol.
|
|
33768
|
+
*
|
|
33769
|
+
* ```markdown
|
|
33770
|
+
* > | https://example.com/a?b#c
|
|
33771
|
+
* ^^^^^
|
|
33772
|
+
* ```
|
|
33773
|
+
*
|
|
33774
|
+
* @type {State}
|
|
33775
|
+
*/
|
|
33776
|
+
function protocolPrefixInside(code) {
|
|
33777
|
+
// `5` is size of `https`
|
|
33778
|
+
if (asciiAlpha(code) && buffer.length < 5) {
|
|
33779
|
+
buffer += String.fromCodePoint(code)
|
|
33605
33780
|
effects.consume(code)
|
|
33606
|
-
return
|
|
33781
|
+
return protocolPrefixInside
|
|
33607
33782
|
}
|
|
33608
|
-
|
|
33609
|
-
return colon(code)
|
|
33610
|
-
}
|
|
33611
|
-
/** @type {State} */
|
|
33612
|
-
|
|
33613
|
-
function colon(code) {
|
|
33614
33783
|
if (code === 58) {
|
|
33615
|
-
|
|
33616
|
-
|
|
33617
|
-
|
|
33618
|
-
|
|
33619
|
-
|
|
33620
|
-
}
|
|
33621
|
-
/** @type {State} */
|
|
33622
|
-
|
|
33623
|
-
function slash1(code) {
|
|
33624
|
-
if (code === 47) {
|
|
33625
|
-
effects.consume(code)
|
|
33626
|
-
return slash2
|
|
33784
|
+
const protocol = buffer.toLowerCase()
|
|
33785
|
+
if (protocol === 'http' || protocol === 'https') {
|
|
33786
|
+
effects.consume(code)
|
|
33787
|
+
return protocolSlashesInside
|
|
33788
|
+
}
|
|
33627
33789
|
}
|
|
33628
|
-
|
|
33629
33790
|
return nok(code)
|
|
33630
33791
|
}
|
|
33631
|
-
/** @type {State} */
|
|
33632
33792
|
|
|
33633
|
-
|
|
33793
|
+
/**
|
|
33794
|
+
* In slashes.
|
|
33795
|
+
*
|
|
33796
|
+
* ```markdown
|
|
33797
|
+
* > | https://example.com/a?b#c
|
|
33798
|
+
* ^^
|
|
33799
|
+
* ```
|
|
33800
|
+
*
|
|
33801
|
+
* @type {State}
|
|
33802
|
+
*/
|
|
33803
|
+
function protocolSlashesInside(code) {
|
|
33634
33804
|
if (code === 47) {
|
|
33635
33805
|
effects.consume(code)
|
|
33636
|
-
|
|
33806
|
+
if (seen) {
|
|
33807
|
+
return afterProtocol
|
|
33808
|
+
}
|
|
33809
|
+
seen = true
|
|
33810
|
+
return protocolSlashesInside
|
|
33637
33811
|
}
|
|
33638
|
-
|
|
33639
33812
|
return nok(code)
|
|
33640
33813
|
}
|
|
33641
|
-
/** @type {State} */
|
|
33642
33814
|
|
|
33643
|
-
|
|
33815
|
+
/**
|
|
33816
|
+
* After protocol, before domain.
|
|
33817
|
+
*
|
|
33818
|
+
* ```markdown
|
|
33819
|
+
* > | https://example.com/a?b#c
|
|
33820
|
+
* ^
|
|
33821
|
+
* ```
|
|
33822
|
+
*
|
|
33823
|
+
* @type {State}
|
|
33824
|
+
*/
|
|
33825
|
+
function afterProtocol(code) {
|
|
33826
|
+
// To do: this is different from `markdown-rs`:
|
|
33827
|
+
// https://github.com/wooorm/markdown-rs/blob/b3a921c761309ae00a51fe348d8a43adbc54b518/src/construct/gfm_autolink_literal.rs#L172-L182
|
|
33644
33828
|
return code === null ||
|
|
33645
33829
|
asciiControl(code) ||
|
|
33830
|
+
markdownLineEndingOrSpace(code) ||
|
|
33646
33831
|
unicodeWhitespace(code) ||
|
|
33647
33832
|
unicodePunctuation(code)
|
|
33648
33833
|
? nok(code)
|
|
33649
|
-
: effects.attempt(domain, effects.attempt(syntax_path,
|
|
33834
|
+
: effects.attempt(domain, effects.attempt(syntax_path, protocolAfter), nok)(code)
|
|
33650
33835
|
}
|
|
33651
|
-
/** @type {State} */
|
|
33652
33836
|
|
|
33653
|
-
|
|
33837
|
+
/**
|
|
33838
|
+
* After a protocol autolink literal.
|
|
33839
|
+
*
|
|
33840
|
+
* ```markdown
|
|
33841
|
+
* > | https://example.com/a?b#c
|
|
33842
|
+
* ^
|
|
33843
|
+
* ```
|
|
33844
|
+
*
|
|
33845
|
+
* @type {State}
|
|
33846
|
+
*/
|
|
33847
|
+
function protocolAfter(code) {
|
|
33654
33848
|
effects.exit('literalAutolinkHttp')
|
|
33655
33849
|
effects.exit('literalAutolink')
|
|
33656
33850
|
return ok(code)
|
|
33657
33851
|
}
|
|
33658
33852
|
}
|
|
33659
|
-
/** @type {Tokenizer} */
|
|
33660
|
-
|
|
33661
|
-
function tokenizeWww(effects, ok, nok) {
|
|
33662
|
-
return start
|
|
33663
|
-
/** @type {State} */
|
|
33664
33853
|
|
|
33665
|
-
|
|
33666
|
-
|
|
33667
|
-
|
|
33668
|
-
|
|
33669
|
-
|
|
33670
|
-
|
|
33671
|
-
|
|
33672
|
-
|
|
33673
|
-
|
|
33674
|
-
|
|
33675
|
-
|
|
33676
|
-
|
|
33677
|
-
|
|
33678
|
-
|
|
33679
|
-
/** @type {State} */
|
|
33854
|
+
/**
|
|
33855
|
+
* `www` prefix.
|
|
33856
|
+
*
|
|
33857
|
+
* ```markdown
|
|
33858
|
+
* > | a www.example.org b
|
|
33859
|
+
* ^^^^
|
|
33860
|
+
* ```
|
|
33861
|
+
*
|
|
33862
|
+
* @this {TokenizeContext}
|
|
33863
|
+
* @type {Tokenizer}
|
|
33864
|
+
*/
|
|
33865
|
+
function tokenizeWwwPrefix(effects, ok, nok) {
|
|
33866
|
+
let size = 0
|
|
33867
|
+
return wwwPrefixInside
|
|
33680
33868
|
|
|
33681
|
-
|
|
33682
|
-
|
|
33869
|
+
/**
|
|
33870
|
+
* In www prefix.
|
|
33871
|
+
*
|
|
33872
|
+
* ```markdown
|
|
33873
|
+
* > | www.example.com
|
|
33874
|
+
* ^^^^
|
|
33875
|
+
* ```
|
|
33876
|
+
*
|
|
33877
|
+
* @type {State}
|
|
33878
|
+
*/
|
|
33879
|
+
function wwwPrefixInside(code) {
|
|
33880
|
+
if ((code === 87 || code === 119) && size < 3) {
|
|
33881
|
+
size++
|
|
33683
33882
|
effects.consume(code)
|
|
33684
|
-
return
|
|
33883
|
+
return wwwPrefixInside
|
|
33685
33884
|
}
|
|
33686
|
-
|
|
33687
|
-
return nok(code)
|
|
33688
|
-
}
|
|
33689
|
-
/** @type {State} */
|
|
33690
|
-
|
|
33691
|
-
function dot(code) {
|
|
33692
|
-
if (code === 46) {
|
|
33885
|
+
if (code === 46 && size === 3) {
|
|
33693
33886
|
effects.consume(code)
|
|
33694
|
-
return
|
|
33887
|
+
return wwwPrefixAfter
|
|
33695
33888
|
}
|
|
33696
|
-
|
|
33697
33889
|
return nok(code)
|
|
33698
33890
|
}
|
|
33699
|
-
/** @type {State} */
|
|
33700
33891
|
|
|
33701
|
-
|
|
33702
|
-
|
|
33892
|
+
/**
|
|
33893
|
+
* After www prefix.
|
|
33894
|
+
*
|
|
33895
|
+
* ```markdown
|
|
33896
|
+
* > | www.example.com
|
|
33897
|
+
* ^
|
|
33898
|
+
* ```
|
|
33899
|
+
*
|
|
33900
|
+
* @type {State}
|
|
33901
|
+
*/
|
|
33902
|
+
function wwwPrefixAfter(code) {
|
|
33903
|
+
// If there is *anything*, we can link.
|
|
33904
|
+
return code === null ? nok(code) : ok(code)
|
|
33703
33905
|
}
|
|
33704
33906
|
}
|
|
33705
|
-
/** @type {Tokenizer} */
|
|
33706
33907
|
|
|
33908
|
+
/**
|
|
33909
|
+
* Domain.
|
|
33910
|
+
*
|
|
33911
|
+
* ```markdown
|
|
33912
|
+
* > | a https://example.org b
|
|
33913
|
+
* ^^^^^^^^^^^
|
|
33914
|
+
* ```
|
|
33915
|
+
*
|
|
33916
|
+
* @this {TokenizeContext}
|
|
33917
|
+
* @type {Tokenizer}
|
|
33918
|
+
*/
|
|
33707
33919
|
function tokenizeDomain(effects, ok, nok) {
|
|
33708
|
-
/** @type {boolean|undefined} */
|
|
33709
|
-
let
|
|
33710
|
-
/** @type {boolean|undefined} */
|
|
33711
|
-
|
|
33712
|
-
|
|
33713
|
-
|
|
33714
|
-
|
|
33920
|
+
/** @type {boolean | undefined} */
|
|
33921
|
+
let underscoreInLastSegment
|
|
33922
|
+
/** @type {boolean | undefined} */
|
|
33923
|
+
let underscoreInLastLastSegment
|
|
33924
|
+
/** @type {boolean | undefined} */
|
|
33925
|
+
let seen
|
|
33926
|
+
return domainInside
|
|
33715
33927
|
|
|
33716
|
-
|
|
33717
|
-
|
|
33718
|
-
|
|
33719
|
-
|
|
33720
|
-
|
|
33721
|
-
|
|
33722
|
-
|
|
33928
|
+
/**
|
|
33929
|
+
* In domain.
|
|
33930
|
+
*
|
|
33931
|
+
* ```markdown
|
|
33932
|
+
* > | https://example.com/a
|
|
33933
|
+
* ^^^^^^^^^^^
|
|
33934
|
+
* ```
|
|
33935
|
+
*
|
|
33936
|
+
* @type {State}
|
|
33937
|
+
*/
|
|
33938
|
+
function domainInside(code) {
|
|
33939
|
+
// Check whether this marker, which is a trailing punctuation
|
|
33940
|
+
// marker, optionally followed by more trailing markers, and then
|
|
33941
|
+
// followed by an end.
|
|
33942
|
+
if (code === 46 || code === 95) {
|
|
33943
|
+
return effects.check(trail, domainAfter, domainAtPunctuation)(code)
|
|
33723
33944
|
}
|
|
33724
33945
|
|
|
33725
|
-
|
|
33726
|
-
return effects.check(punctuation, done, punctuationContinuation)(code)
|
|
33727
|
-
} // GH documents that only alphanumerics (other than `-`, `.`, and `_`) can
|
|
33946
|
+
// GH documents that only alphanumerics (other than `-`, `.`, and `_`) can
|
|
33728
33947
|
// occur, which sounds like ASCII only, but they also support `www.點看.com`,
|
|
33729
33948
|
// so that’s Unicode.
|
|
33730
33949
|
// Instead of some new production for Unicode alphanumerics, markdown
|
|
33731
33950
|
// already has that for Unicode punctuation and whitespace, so use those.
|
|
33732
|
-
|
|
33951
|
+
// Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L12>.
|
|
33733
33952
|
if (
|
|
33734
33953
|
code === null ||
|
|
33735
|
-
|
|
33954
|
+
markdownLineEndingOrSpace(code) ||
|
|
33736
33955
|
unicodeWhitespace(code) ||
|
|
33737
33956
|
(code !== 45 && unicodePunctuation(code))
|
|
33738
33957
|
) {
|
|
33739
|
-
return
|
|
33958
|
+
return domainAfter(code)
|
|
33740
33959
|
}
|
|
33741
|
-
|
|
33960
|
+
seen = true
|
|
33742
33961
|
effects.consume(code)
|
|
33743
|
-
return
|
|
33962
|
+
return domainInside
|
|
33744
33963
|
}
|
|
33745
|
-
/** @type {State} */
|
|
33746
33964
|
|
|
33747
|
-
|
|
33748
|
-
|
|
33749
|
-
|
|
33750
|
-
|
|
33751
|
-
|
|
33752
|
-
|
|
33965
|
+
/**
|
|
33966
|
+
* In domain, at potential trailing punctuation, that was not trailing.
|
|
33967
|
+
*
|
|
33968
|
+
* ```markdown
|
|
33969
|
+
* > | https://example.com
|
|
33970
|
+
* ^
|
|
33971
|
+
* ```
|
|
33972
|
+
*
|
|
33973
|
+
* @type {State}
|
|
33974
|
+
*/
|
|
33975
|
+
function domainAtPunctuation(code) {
|
|
33976
|
+
// There is an underscore in the last segment of the domain
|
|
33977
|
+
if (code === 95) {
|
|
33978
|
+
underscoreInLastSegment = true
|
|
33979
|
+
}
|
|
33980
|
+
// Otherwise, it’s a `.`: save the last segment underscore in the
|
|
33981
|
+
// penultimate segment slot.
|
|
33982
|
+
else {
|
|
33983
|
+
underscoreInLastLastSegment = underscoreInLastSegment
|
|
33984
|
+
underscoreInLastSegment = undefined
|
|
33753
33985
|
}
|
|
33754
|
-
|
|
33755
|
-
if (code === 95) hasUnderscoreInLastSegment = true
|
|
33756
33986
|
effects.consume(code)
|
|
33757
|
-
return
|
|
33987
|
+
return domainInside
|
|
33758
33988
|
}
|
|
33759
|
-
/** @type {State} */
|
|
33760
33989
|
|
|
33761
|
-
|
|
33762
|
-
|
|
33763
|
-
|
|
33990
|
+
/**
|
|
33991
|
+
* After domain.
|
|
33992
|
+
*
|
|
33993
|
+
* ```markdown
|
|
33994
|
+
* > | https://example.com/a
|
|
33995
|
+
* ^
|
|
33996
|
+
* ```
|
|
33997
|
+
*
|
|
33998
|
+
* @type {State} */
|
|
33999
|
+
function domainAfter(code) {
|
|
34000
|
+
// Note: that’s GH says a dot is needed, but it’s not true:
|
|
34001
|
+
// <https://github.com/github/cmark-gfm/issues/279>
|
|
34002
|
+
if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {
|
|
34003
|
+
return nok(code)
|
|
33764
34004
|
}
|
|
33765
|
-
|
|
33766
|
-
return nok(code)
|
|
34005
|
+
return ok(code)
|
|
33767
34006
|
}
|
|
33768
34007
|
}
|
|
33769
|
-
/** @type {Tokenizer} */
|
|
33770
34008
|
|
|
34009
|
+
/**
|
|
34010
|
+
* Path.
|
|
34011
|
+
*
|
|
34012
|
+
* ```markdown
|
|
34013
|
+
* > | a https://example.org/stuff b
|
|
34014
|
+
* ^^^^^^
|
|
34015
|
+
* ```
|
|
34016
|
+
*
|
|
34017
|
+
* @this {TokenizeContext}
|
|
34018
|
+
* @type {Tokenizer}
|
|
34019
|
+
*/
|
|
33771
34020
|
function tokenizePath(effects, ok) {
|
|
33772
|
-
let
|
|
33773
|
-
|
|
33774
|
-
|
|
33775
|
-
|
|
33776
|
-
function inPath(code) {
|
|
33777
|
-
if (code === 38) {
|
|
33778
|
-
return effects.check(
|
|
33779
|
-
namedCharacterReference,
|
|
33780
|
-
ok,
|
|
33781
|
-
continuedPunctuation
|
|
33782
|
-
)(code)
|
|
33783
|
-
}
|
|
34021
|
+
let sizeOpen = 0
|
|
34022
|
+
let sizeClose = 0
|
|
34023
|
+
return pathInside
|
|
33784
34024
|
|
|
34025
|
+
/**
|
|
34026
|
+
* In path.
|
|
34027
|
+
*
|
|
34028
|
+
* ```markdown
|
|
34029
|
+
* > | https://example.com/a
|
|
34030
|
+
* ^^
|
|
34031
|
+
* ```
|
|
34032
|
+
*
|
|
34033
|
+
* @type {State}
|
|
34034
|
+
*/
|
|
34035
|
+
function pathInside(code) {
|
|
33785
34036
|
if (code === 40) {
|
|
33786
|
-
|
|
34037
|
+
sizeOpen++
|
|
34038
|
+
effects.consume(code)
|
|
34039
|
+
return pathInside
|
|
33787
34040
|
}
|
|
33788
34041
|
|
|
33789
|
-
|
|
33790
|
-
|
|
33791
|
-
|
|
33792
|
-
|
|
33793
|
-
|
|
33794
|
-
)(code)
|
|
34042
|
+
// To do: `markdown-rs` also needs this.
|
|
34043
|
+
// If this is a paren, and there are less closings than openings,
|
|
34044
|
+
// we don’t check for a trail.
|
|
34045
|
+
if (code === 41 && sizeClose < sizeOpen) {
|
|
34046
|
+
return pathAtPunctuation(code)
|
|
33795
34047
|
}
|
|
33796
34048
|
|
|
33797
|
-
|
|
33798
|
-
|
|
34049
|
+
// Check whether this trailing punctuation marker is optionally
|
|
34050
|
+
// followed by more trailing markers, and then followed
|
|
34051
|
+
// by an end.
|
|
34052
|
+
if (
|
|
34053
|
+
code === 33 ||
|
|
34054
|
+
code === 34 ||
|
|
34055
|
+
code === 38 ||
|
|
34056
|
+
code === 39 ||
|
|
34057
|
+
code === 41 ||
|
|
34058
|
+
code === 42 ||
|
|
34059
|
+
code === 44 ||
|
|
34060
|
+
code === 46 ||
|
|
34061
|
+
code === 58 ||
|
|
34062
|
+
code === 59 ||
|
|
34063
|
+
code === 60 ||
|
|
34064
|
+
code === 63 ||
|
|
34065
|
+
code === 93 ||
|
|
34066
|
+
code === 95 ||
|
|
34067
|
+
code === 126
|
|
34068
|
+
) {
|
|
34069
|
+
return effects.check(trail, ok, pathAtPunctuation)(code)
|
|
33799
34070
|
}
|
|
33800
|
-
|
|
33801
|
-
|
|
33802
|
-
|
|
34071
|
+
if (
|
|
34072
|
+
code === null ||
|
|
34073
|
+
markdownLineEndingOrSpace(code) ||
|
|
34074
|
+
unicodeWhitespace(code)
|
|
34075
|
+
) {
|
|
34076
|
+
return ok(code)
|
|
33803
34077
|
}
|
|
33804
|
-
|
|
33805
34078
|
effects.consume(code)
|
|
33806
|
-
return
|
|
34079
|
+
return pathInside
|
|
33807
34080
|
}
|
|
33808
|
-
/** @type {State} */
|
|
33809
34081
|
|
|
33810
|
-
|
|
34082
|
+
/**
|
|
34083
|
+
* In path, at potential trailing punctuation, that was not trailing.
|
|
34084
|
+
*
|
|
34085
|
+
* ```markdown
|
|
34086
|
+
* > | https://example.com/a"b
|
|
34087
|
+
* ^
|
|
34088
|
+
* ```
|
|
34089
|
+
*
|
|
34090
|
+
* @type {State}
|
|
34091
|
+
*/
|
|
34092
|
+
function pathAtPunctuation(code) {
|
|
34093
|
+
// Count closing parens.
|
|
34094
|
+
if (code === 41) {
|
|
34095
|
+
sizeClose++
|
|
34096
|
+
}
|
|
33811
34097
|
effects.consume(code)
|
|
33812
|
-
return
|
|
33813
|
-
}
|
|
33814
|
-
/** @type {State} */
|
|
33815
|
-
|
|
33816
|
-
function parenAtPathEnd(code) {
|
|
33817
|
-
balance--
|
|
33818
|
-
return balance < 0 ? ok(code) : continuedPunctuation(code)
|
|
34098
|
+
return pathInside
|
|
33819
34099
|
}
|
|
33820
34100
|
}
|
|
33821
|
-
/** @type {Tokenizer} */
|
|
33822
34101
|
|
|
33823
|
-
|
|
33824
|
-
|
|
33825
|
-
|
|
33826
|
-
|
|
33827
|
-
|
|
33828
|
-
|
|
33829
|
-
|
|
33830
|
-
|
|
33831
|
-
|
|
34102
|
+
/**
|
|
34103
|
+
* Trail.
|
|
34104
|
+
*
|
|
34105
|
+
* This calls `ok` if this *is* the trail, followed by an end, which means
|
|
34106
|
+
* the entire trail is not part of the link.
|
|
34107
|
+
* It calls `nok` if this *is* part of the link.
|
|
34108
|
+
*
|
|
34109
|
+
* ```markdown
|
|
34110
|
+
* > | https://example.com").
|
|
34111
|
+
* ^^^
|
|
34112
|
+
* ```
|
|
34113
|
+
*
|
|
34114
|
+
* @this {TokenizeContext}
|
|
34115
|
+
* @type {Tokenizer}
|
|
34116
|
+
*/
|
|
34117
|
+
function tokenizeTrail(effects, ok, nok) {
|
|
34118
|
+
return trail
|
|
33832
34119
|
|
|
33833
|
-
|
|
33834
|
-
|
|
34120
|
+
/**
|
|
34121
|
+
* In trail of domain or path.
|
|
34122
|
+
*
|
|
34123
|
+
* ```markdown
|
|
34124
|
+
* > | https://example.com").
|
|
34125
|
+
* ^
|
|
34126
|
+
* ```
|
|
34127
|
+
*
|
|
34128
|
+
* @type {State}
|
|
34129
|
+
*/
|
|
34130
|
+
function trail(code) {
|
|
34131
|
+
// Regular trailing punctuation.
|
|
34132
|
+
if (
|
|
34133
|
+
code === 33 ||
|
|
34134
|
+
code === 34 ||
|
|
34135
|
+
code === 39 ||
|
|
34136
|
+
code === 41 ||
|
|
34137
|
+
code === 42 ||
|
|
34138
|
+
code === 44 ||
|
|
34139
|
+
code === 46 ||
|
|
34140
|
+
code === 58 ||
|
|
34141
|
+
code === 59 ||
|
|
34142
|
+
code === 63 ||
|
|
34143
|
+
code === 95 ||
|
|
34144
|
+
code === 126
|
|
34145
|
+
) {
|
|
33835
34146
|
effects.consume(code)
|
|
33836
|
-
return
|
|
34147
|
+
return trail
|
|
33837
34148
|
}
|
|
33838
34149
|
|
|
33839
|
-
|
|
34150
|
+
// `&` followed by one or more alphabeticals and then a `;`, is
|
|
34151
|
+
// as a whole considered as trailing punctuation.
|
|
34152
|
+
// In all other cases, it is considered as continuation of the URL.
|
|
34153
|
+
if (code === 38) {
|
|
33840
34154
|
effects.consume(code)
|
|
33841
|
-
return
|
|
34155
|
+
return trailCharRefStart
|
|
33842
34156
|
}
|
|
33843
34157
|
|
|
34158
|
+
// Needed because we allow literals after `[`, as we fix:
|
|
34159
|
+
// <https://github.com/github/cmark-gfm/issues/278>.
|
|
34160
|
+
// Check that it is not followed by `(` or `[`.
|
|
34161
|
+
if (code === 93) {
|
|
34162
|
+
effects.consume(code)
|
|
34163
|
+
return trailBracketAfter
|
|
34164
|
+
}
|
|
34165
|
+
if (
|
|
34166
|
+
// `<` is an end.
|
|
34167
|
+
code === 60 ||
|
|
34168
|
+
// So is whitespace.
|
|
34169
|
+
code === null ||
|
|
34170
|
+
markdownLineEndingOrSpace(code) ||
|
|
34171
|
+
unicodeWhitespace(code)
|
|
34172
|
+
) {
|
|
34173
|
+
return ok(code)
|
|
34174
|
+
}
|
|
33844
34175
|
return nok(code)
|
|
33845
34176
|
}
|
|
33846
|
-
/** @type {State} */
|
|
33847
34177
|
|
|
33848
|
-
|
|
33849
|
-
|
|
33850
|
-
|
|
33851
|
-
|
|
34178
|
+
/**
|
|
34179
|
+
* In trail, after `]`.
|
|
34180
|
+
*
|
|
34181
|
+
* > 👉 **Note**: this deviates from `cmark-gfm` to fix a bug.
|
|
34182
|
+
* > See end of <https://github.com/github/cmark-gfm/issues/278> for more.
|
|
34183
|
+
*
|
|
34184
|
+
* ```markdown
|
|
34185
|
+
* > | https://example.com](
|
|
34186
|
+
* ^
|
|
34187
|
+
* ```
|
|
34188
|
+
*
|
|
34189
|
+
* @type {State}
|
|
34190
|
+
*/
|
|
34191
|
+
function trailBracketAfter(code) {
|
|
34192
|
+
// Whitespace or something that could start a resource or reference is the end.
|
|
34193
|
+
// Switch back to trail otherwise.
|
|
34194
|
+
if (
|
|
34195
|
+
code === null ||
|
|
34196
|
+
code === 40 ||
|
|
34197
|
+
code === 91 ||
|
|
34198
|
+
markdownLineEndingOrSpace(code) ||
|
|
34199
|
+
unicodeWhitespace(code)
|
|
34200
|
+
) {
|
|
34201
|
+
return ok(code)
|
|
34202
|
+
}
|
|
34203
|
+
return trail(code)
|
|
34204
|
+
}
|
|
34205
|
+
|
|
34206
|
+
/**
|
|
34207
|
+
* In character-reference like trail, after `&`.
|
|
34208
|
+
*
|
|
34209
|
+
* ```markdown
|
|
34210
|
+
* > | https://example.com&).
|
|
34211
|
+
* ^
|
|
34212
|
+
* ```
|
|
34213
|
+
*
|
|
34214
|
+
* @type {State}
|
|
34215
|
+
*/
|
|
34216
|
+
function trailCharRefStart(code) {
|
|
34217
|
+
// When non-alpha, it’s not a trail.
|
|
34218
|
+
return asciiAlpha(code) ? trailCharRefInside(code) : nok(code)
|
|
34219
|
+
}
|
|
34220
|
+
|
|
34221
|
+
/**
|
|
34222
|
+
* In character-reference like trail.
|
|
34223
|
+
*
|
|
34224
|
+
* ```markdown
|
|
34225
|
+
* > | https://example.com&).
|
|
34226
|
+
* ^
|
|
34227
|
+
* ```
|
|
34228
|
+
*
|
|
34229
|
+
* @type {State}
|
|
34230
|
+
*/
|
|
34231
|
+
function trailCharRefInside(code) {
|
|
34232
|
+
// Switch back to trail if this is well-formed.
|
|
34233
|
+
if (code === 59) {
|
|
34234
|
+
effects.consume(code)
|
|
34235
|
+
return trail
|
|
34236
|
+
}
|
|
34237
|
+
if (asciiAlpha(code)) {
|
|
34238
|
+
effects.consume(code)
|
|
34239
|
+
return trailCharRefInside
|
|
34240
|
+
}
|
|
34241
|
+
|
|
34242
|
+
// It’s not a trail.
|
|
34243
|
+
return nok(code)
|
|
33852
34244
|
}
|
|
33853
34245
|
}
|
|
33854
|
-
/** @type {Tokenizer} */
|
|
33855
34246
|
|
|
33856
|
-
|
|
34247
|
+
/**
|
|
34248
|
+
* Dot in email domain trail.
|
|
34249
|
+
*
|
|
34250
|
+
* This calls `ok` if this *is* the trail, followed by an end, which means
|
|
34251
|
+
* the trail is not part of the link.
|
|
34252
|
+
* It calls `nok` if this *is* part of the link.
|
|
34253
|
+
*
|
|
34254
|
+
* ```markdown
|
|
34255
|
+
* > | contact@example.org.
|
|
34256
|
+
* ^
|
|
34257
|
+
* ```
|
|
34258
|
+
*
|
|
34259
|
+
* @this {TokenizeContext}
|
|
34260
|
+
* @type {Tokenizer}
|
|
34261
|
+
*/
|
|
34262
|
+
function tokenizeEmailDomainDotTrail(effects, ok, nok) {
|
|
33857
34263
|
return start
|
|
33858
|
-
/** @type {State} */
|
|
33859
34264
|
|
|
34265
|
+
/**
|
|
34266
|
+
* Dot.
|
|
34267
|
+
*
|
|
34268
|
+
* ```markdown
|
|
34269
|
+
* > | contact@example.org.
|
|
34270
|
+
* ^ ^
|
|
34271
|
+
* ```
|
|
34272
|
+
*
|
|
34273
|
+
* @type {State}
|
|
34274
|
+
*/
|
|
33860
34275
|
function start(code) {
|
|
34276
|
+
// Must be dot.
|
|
33861
34277
|
effects.consume(code)
|
|
33862
34278
|
return after
|
|
33863
34279
|
}
|
|
33864
|
-
/** @type {State} */
|
|
33865
34280
|
|
|
34281
|
+
/**
|
|
34282
|
+
* After dot.
|
|
34283
|
+
*
|
|
34284
|
+
* ```markdown
|
|
34285
|
+
* > | contact@example.org.
|
|
34286
|
+
* ^ ^
|
|
34287
|
+
* ```
|
|
34288
|
+
*
|
|
34289
|
+
* @type {State}
|
|
34290
|
+
*/
|
|
33866
34291
|
function after(code) {
|
|
33867
|
-
//
|
|
33868
|
-
|
|
33869
|
-
effects.consume(code)
|
|
33870
|
-
return after
|
|
33871
|
-
} // If the punctuation marker is followed by the end of the path, it’s not
|
|
33872
|
-
// continued punctuation.
|
|
33873
|
-
|
|
33874
|
-
return pathEnd(code) ? ok(code) : nok(code)
|
|
34292
|
+
// Not a trail if alphanumeric.
|
|
34293
|
+
return asciiAlphanumeric(code) ? nok(code) : ok(code)
|
|
33875
34294
|
}
|
|
33876
34295
|
}
|
|
34296
|
+
|
|
33877
34297
|
/**
|
|
33878
|
-
*
|
|
33879
|
-
*
|
|
34298
|
+
* See:
|
|
34299
|
+
* <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L156>.
|
|
34300
|
+
*
|
|
34301
|
+
* @type {Previous}
|
|
33880
34302
|
*/
|
|
33881
|
-
|
|
33882
|
-
function trailingPunctuation(code) {
|
|
34303
|
+
function previousWww(code) {
|
|
33883
34304
|
return (
|
|
33884
|
-
code ===
|
|
33885
|
-
code ===
|
|
33886
|
-
code === 39 ||
|
|
33887
|
-
code === 41 ||
|
|
34305
|
+
code === null ||
|
|
34306
|
+
code === 40 ||
|
|
33888
34307
|
code === 42 ||
|
|
33889
|
-
code === 44 ||
|
|
33890
|
-
code === 46 ||
|
|
33891
|
-
code === 58 ||
|
|
33892
|
-
code === 59 ||
|
|
33893
|
-
code === 60 ||
|
|
33894
|
-
code === 63 ||
|
|
33895
34308
|
code === 95 ||
|
|
33896
|
-
code ===
|
|
34309
|
+
code === 91 ||
|
|
34310
|
+
code === 93 ||
|
|
34311
|
+
code === 126 ||
|
|
34312
|
+
markdownLineEndingOrSpace(code)
|
|
33897
34313
|
)
|
|
33898
34314
|
}
|
|
34315
|
+
|
|
33899
34316
|
/**
|
|
33900
|
-
*
|
|
33901
|
-
*
|
|
34317
|
+
* See:
|
|
34318
|
+
* <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L214>.
|
|
34319
|
+
*
|
|
34320
|
+
* @type {Previous}
|
|
33902
34321
|
*/
|
|
34322
|
+
function previousProtocol(code) {
|
|
34323
|
+
return !asciiAlpha(code)
|
|
34324
|
+
}
|
|
33903
34325
|
|
|
33904
|
-
|
|
33905
|
-
|
|
34326
|
+
/**
|
|
34327
|
+
* @this {TokenizeContext}
|
|
34328
|
+
* @type {Previous}
|
|
34329
|
+
*/
|
|
34330
|
+
function previousEmail(code) {
|
|
34331
|
+
// Do not allow a slash “inside” atext.
|
|
34332
|
+
// The reference code is a bit weird, but that’s what it results in.
|
|
34333
|
+
// Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L307>.
|
|
34334
|
+
// Other than slash, every preceding character is allowed.
|
|
34335
|
+
return !(code === 47 || gfmAtext(code))
|
|
33906
34336
|
}
|
|
34337
|
+
|
|
33907
34338
|
/**
|
|
33908
34339
|
* @param {Code} code
|
|
33909
34340
|
* @returns {boolean}
|
|
33910
34341
|
*/
|
|
33911
|
-
|
|
33912
34342
|
function gfmAtext(code) {
|
|
33913
34343
|
return (
|
|
33914
34344
|
code === 43 ||
|
|
@@ -33918,61 +34348,36 @@ function gfmAtext(code) {
|
|
|
33918
34348
|
asciiAlphanumeric(code)
|
|
33919
34349
|
)
|
|
33920
34350
|
}
|
|
33921
|
-
/** @type {Previous} */
|
|
33922
34351
|
|
|
33923
|
-
function previousWww(code) {
|
|
33924
|
-
return (
|
|
33925
|
-
code === null ||
|
|
33926
|
-
code === 40 ||
|
|
33927
|
-
code === 42 ||
|
|
33928
|
-
code === 95 ||
|
|
33929
|
-
code === 126 ||
|
|
33930
|
-
markdownLineEndingOrSpace(code)
|
|
33931
|
-
)
|
|
33932
|
-
}
|
|
33933
|
-
/** @type {Previous} */
|
|
33934
|
-
|
|
33935
|
-
function previousHttp(code) {
|
|
33936
|
-
return code === null || !asciiAlpha(code)
|
|
33937
|
-
}
|
|
33938
|
-
/** @type {Previous} */
|
|
33939
|
-
|
|
33940
|
-
function previousEmail(code) {
|
|
33941
|
-
return code !== 47 && previousHttp(code)
|
|
33942
|
-
}
|
|
33943
34352
|
/**
|
|
33944
34353
|
* @param {Array<Event>} events
|
|
33945
34354
|
* @returns {boolean}
|
|
33946
34355
|
*/
|
|
33947
|
-
|
|
33948
34356
|
function previousUnbalanced(events) {
|
|
33949
34357
|
let index = events.length
|
|
33950
34358
|
let result = false
|
|
33951
|
-
|
|
33952
34359
|
while (index--) {
|
|
33953
34360
|
const token = events[index][1]
|
|
33954
|
-
|
|
33955
34361
|
if (
|
|
33956
34362
|
(token.type === 'labelLink' || token.type === 'labelImage') &&
|
|
33957
34363
|
!token._balanced
|
|
33958
34364
|
) {
|
|
33959
34365
|
result = true
|
|
33960
34366
|
break
|
|
33961
|
-
}
|
|
33962
|
-
// having any unbalanced bracket before it, we can exit.
|
|
34367
|
+
}
|
|
33963
34368
|
|
|
34369
|
+
// @ts-expect-error If we’ve seen this token, and it was marked as not
|
|
34370
|
+
// having any unbalanced bracket before it, we can exit.
|
|
33964
34371
|
if (token._gfmAutolinkLiteralWalkedInto) {
|
|
33965
34372
|
result = false
|
|
33966
34373
|
break
|
|
33967
34374
|
}
|
|
33968
34375
|
}
|
|
33969
|
-
|
|
33970
34376
|
if (events.length > 0 && !result) {
|
|
33971
34377
|
// @ts-expect-error Mark the last token as “walked into” w/o finding
|
|
33972
34378
|
// anything.
|
|
33973
34379
|
events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true
|
|
33974
34380
|
}
|
|
33975
|
-
|
|
33976
34381
|
return result
|
|
33977
34382
|
}
|
|
33978
34383
|
|
|
@@ -36130,7 +36535,7 @@ function lib_previous(match, email) {
|
|
|
36130
36535
|
)
|
|
36131
36536
|
}
|
|
36132
36537
|
|
|
36133
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/association.js
|
|
36538
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/association.js
|
|
36134
36539
|
/**
|
|
36135
36540
|
* @typedef {import('../types.js').AssociationId} AssociationId
|
|
36136
36541
|
*/
|
|
@@ -36165,7 +36570,7 @@ function association(node) {
|
|
|
36165
36570
|
return decodeString(node.identifier)
|
|
36166
36571
|
}
|
|
36167
36572
|
|
|
36168
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/container-flow.js
|
|
36573
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/container-flow.js
|
|
36169
36574
|
/**
|
|
36170
36575
|
* @typedef {import('../types.js').FlowContent} FlowContent
|
|
36171
36576
|
* @typedef {import('../types.js').Node} Node
|
|
@@ -36254,7 +36659,7 @@ function between(left, right, parent, state) {
|
|
|
36254
36659
|
return '\n\n'
|
|
36255
36660
|
}
|
|
36256
36661
|
|
|
36257
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
|
|
36662
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/indent-lines.js
|
|
36258
36663
|
/**
|
|
36259
36664
|
* @typedef {import('../types.js').IndentLines} IndentLines
|
|
36260
36665
|
*/
|
|
@@ -36291,7 +36696,7 @@ function indentLines(value, map) {
|
|
|
36291
36696
|
}
|
|
36292
36697
|
}
|
|
36293
36698
|
|
|
36294
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
|
|
36699
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
|
|
36295
36700
|
/**
|
|
36296
36701
|
* @typedef {import('../types.js').Unsafe} Unsafe
|
|
36297
36702
|
*/
|
|
@@ -36318,7 +36723,7 @@ function patternCompile(pattern) {
|
|
|
36318
36723
|
return pattern._compiled
|
|
36319
36724
|
}
|
|
36320
36725
|
|
|
36321
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
|
|
36726
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js
|
|
36322
36727
|
/**
|
|
36323
36728
|
* @typedef {import('../types.js').Unsafe} Unsafe
|
|
36324
36729
|
* @typedef {import('../types.js').ConstructName} ConstructName
|
|
@@ -36362,7 +36767,7 @@ function listInScope(stack, list, none) {
|
|
|
36362
36767
|
return false
|
|
36363
36768
|
}
|
|
36364
36769
|
|
|
36365
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/safe.js
|
|
36770
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/safe.js
|
|
36366
36771
|
/**
|
|
36367
36772
|
* @typedef {import('../types.js').State} State
|
|
36368
36773
|
* @typedef {import('../types.js').SafeConfig} SafeConfig
|
|
@@ -36541,7 +36946,7 @@ function escapeBackslashes(value, after) {
|
|
|
36541
36946
|
return results.join('')
|
|
36542
36947
|
}
|
|
36543
36948
|
|
|
36544
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/track.js
|
|
36949
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-footnote/node_modules/mdast-util-to-markdown/lib/util/track.js
|
|
36545
36950
|
/**
|
|
36546
36951
|
* @typedef {import('../types.js').CreateTracker} CreateTracker
|
|
36547
36952
|
* @typedef {import('../types.js').TrackCurrent} TrackCurrent
|
|
@@ -36810,7 +37215,7 @@ function map(line, index, blank) {
|
|
|
36810
37215
|
return (blank ? '' : ' ') + line
|
|
36811
37216
|
}
|
|
36812
37217
|
|
|
36813
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
|
|
37218
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-strikethrough/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
|
|
36814
37219
|
/**
|
|
36815
37220
|
* @typedef {import('../types.js').Handle} Handle
|
|
36816
37221
|
* @typedef {import('../types.js').Info} Info
|
|
@@ -36909,113 +37314,299 @@ function containerPhrasing(parent, state, info) {
|
|
|
36909
37314
|
return results.join('')
|
|
36910
37315
|
}
|
|
36911
37316
|
|
|
36912
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-strikethrough/lib/
|
|
36913
|
-
/**
|
|
36914
|
-
* @typedef {import('
|
|
36915
|
-
*
|
|
36916
|
-
* @typedef {import('
|
|
36917
|
-
* @typedef {import('
|
|
36918
|
-
|
|
36919
|
-
|
|
36920
|
-
|
|
36921
|
-
*
|
|
36922
|
-
*
|
|
36923
|
-
|
|
36924
|
-
|
|
36925
|
-
|
|
36926
|
-
|
|
36927
|
-
|
|
36928
|
-
|
|
36929
|
-
|
|
36930
|
-
|
|
36931
|
-
|
|
36932
|
-
|
|
36933
|
-
|
|
36934
|
-
|
|
36935
|
-
|
|
36936
|
-
|
|
36937
|
-
|
|
36938
|
-
|
|
36939
|
-
|
|
36940
|
-
|
|
36941
|
-
|
|
36942
|
-
|
|
36943
|
-
|
|
36944
|
-
|
|
36945
|
-
|
|
36946
|
-
|
|
36947
|
-
|
|
36948
|
-
|
|
36949
|
-
|
|
36950
|
-
|
|
36951
|
-
|
|
37317
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-strikethrough/node_modules/mdast-util-to-markdown/lib/util/track.js
|
|
37318
|
+
/**
|
|
37319
|
+
* @typedef {import('../types.js').CreateTracker} CreateTracker
|
|
37320
|
+
* @typedef {import('../types.js').TrackCurrent} TrackCurrent
|
|
37321
|
+
* @typedef {import('../types.js').TrackMove} TrackMove
|
|
37322
|
+
* @typedef {import('../types.js').TrackShift} TrackShift
|
|
37323
|
+
*/
|
|
37324
|
+
|
|
37325
|
+
/**
|
|
37326
|
+
* Track positional info in the output.
|
|
37327
|
+
*
|
|
37328
|
+
* @type {CreateTracker}
|
|
37329
|
+
*/
|
|
37330
|
+
function track_track(config) {
|
|
37331
|
+
// Defaults are used to prevent crashes when older utilities somehow activate
|
|
37332
|
+
// this code.
|
|
37333
|
+
/* c8 ignore next 5 */
|
|
37334
|
+
const options = config || {}
|
|
37335
|
+
const now = options.now || {}
|
|
37336
|
+
let lineShift = options.lineShift || 0
|
|
37337
|
+
let line = now.line || 1
|
|
37338
|
+
let column = now.column || 1
|
|
37339
|
+
|
|
37340
|
+
return {move, current, shift}
|
|
37341
|
+
|
|
37342
|
+
/**
|
|
37343
|
+
* Get the current tracked info.
|
|
37344
|
+
*
|
|
37345
|
+
* @type {TrackCurrent}
|
|
37346
|
+
*/
|
|
37347
|
+
function current() {
|
|
37348
|
+
return {now: {line, column}, lineShift}
|
|
37349
|
+
}
|
|
37350
|
+
|
|
37351
|
+
/**
|
|
37352
|
+
* Define an increased line shift (the typical indent for lines).
|
|
37353
|
+
*
|
|
37354
|
+
* @type {TrackShift}
|
|
37355
|
+
*/
|
|
37356
|
+
function shift(value) {
|
|
37357
|
+
lineShift += value
|
|
37358
|
+
}
|
|
37359
|
+
|
|
37360
|
+
/**
|
|
37361
|
+
* Move past some generated markdown.
|
|
37362
|
+
*
|
|
37363
|
+
* @type {TrackMove}
|
|
37364
|
+
*/
|
|
37365
|
+
function move(input) {
|
|
37366
|
+
// eslint-disable-next-line unicorn/prefer-default-parameters
|
|
37367
|
+
const value = input || ''
|
|
37368
|
+
const chunks = value.split(/\r?\n|\r/g)
|
|
37369
|
+
const tail = chunks[chunks.length - 1]
|
|
37370
|
+
line += chunks.length - 1
|
|
37371
|
+
column =
|
|
37372
|
+
chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift
|
|
37373
|
+
return value
|
|
37374
|
+
}
|
|
37375
|
+
}
|
|
37376
|
+
|
|
37377
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-strikethrough/lib/index.js
|
|
37378
|
+
/**
|
|
37379
|
+
* @typedef {import('mdast').Delete} Delete
|
|
37380
|
+
*
|
|
37381
|
+
* @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
|
|
37382
|
+
* @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
|
|
37383
|
+
* @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
|
|
37384
|
+
*
|
|
37385
|
+
* @typedef {import('mdast-util-to-markdown').ConstructName} ConstructName
|
|
37386
|
+
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
|
|
37387
|
+
* @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
|
|
37388
|
+
*/
|
|
37389
|
+
|
|
37390
|
+
|
|
37391
|
+
|
|
37392
|
+
|
|
37393
|
+
// To do: next major: expose functions.
|
|
37394
|
+
// To do: next major: use `state`, state utilities.
|
|
37395
|
+
|
|
37396
|
+
/**
|
|
37397
|
+
* List of constructs that occur in phrasing (paragraphs, headings), but cannot
|
|
37398
|
+
* contain strikethrough.
|
|
37399
|
+
* So they sort of cancel each other out.
|
|
37400
|
+
* Note: could use a better name.
|
|
37401
|
+
*
|
|
37402
|
+
* Note: keep in sync with: <https://github.com/syntax-tree/mdast-util-to-markdown/blob/8ce8dbf/lib/unsafe.js#L14>
|
|
37403
|
+
*
|
|
37404
|
+
* @type {Array<ConstructName>}
|
|
37405
|
+
*/
|
|
37406
|
+
const constructsWithoutStrikethrough = [
|
|
37407
|
+
'autolink',
|
|
37408
|
+
'destinationLiteral',
|
|
37409
|
+
'destinationRaw',
|
|
37410
|
+
'reference',
|
|
37411
|
+
'titleQuote',
|
|
37412
|
+
'titleApostrophe'
|
|
37413
|
+
]
|
|
37414
|
+
|
|
37415
|
+
handleDelete.peek = peekDelete
|
|
37416
|
+
|
|
37417
|
+
/**
|
|
37418
|
+
* Extension for `mdast-util-from-markdown` to enable GFM strikethrough.
|
|
37419
|
+
*
|
|
37420
|
+
* @type {FromMarkdownExtension}
|
|
37421
|
+
*/
|
|
37422
|
+
const gfmStrikethroughFromMarkdown = {
|
|
37423
|
+
canContainEols: ['delete'],
|
|
37424
|
+
enter: {strikethrough: enterStrikethrough},
|
|
37425
|
+
exit: {strikethrough: exitStrikethrough}
|
|
37426
|
+
}
|
|
37427
|
+
|
|
37428
|
+
/**
|
|
37429
|
+
* Extension for `mdast-util-to-markdown` to enable GFM strikethrough.
|
|
37430
|
+
*
|
|
37431
|
+
* @type {ToMarkdownExtension}
|
|
37432
|
+
*/
|
|
37433
|
+
const gfmStrikethroughToMarkdown = {
|
|
37434
|
+
unsafe: [
|
|
37435
|
+
{
|
|
37436
|
+
character: '~',
|
|
37437
|
+
inConstruct: 'phrasing',
|
|
37438
|
+
notInConstruct: constructsWithoutStrikethrough
|
|
37439
|
+
}
|
|
37440
|
+
],
|
|
37441
|
+
handlers: {delete: handleDelete}
|
|
37442
|
+
}
|
|
37443
|
+
|
|
37444
|
+
/**
|
|
37445
|
+
* @this {CompileContext}
|
|
37446
|
+
* @type {FromMarkdownHandle}
|
|
37447
|
+
*/
|
|
37448
|
+
function enterStrikethrough(token) {
|
|
37449
|
+
this.enter({type: 'delete', children: []}, token)
|
|
37450
|
+
}
|
|
37451
|
+
|
|
37452
|
+
/**
|
|
37453
|
+
* @this {CompileContext}
|
|
37454
|
+
* @type {FromMarkdownHandle}
|
|
37455
|
+
*/
|
|
37456
|
+
function exitStrikethrough(token) {
|
|
37457
|
+
this.exit(token)
|
|
37458
|
+
}
|
|
37459
|
+
|
|
37460
|
+
/**
|
|
37461
|
+
* @type {ToMarkdownHandle}
|
|
37462
|
+
* @param {Delete} node
|
|
37463
|
+
*/
|
|
37464
|
+
function handleDelete(node, _, context, safeOptions) {
|
|
37465
|
+
const tracker = track_track(safeOptions)
|
|
37466
|
+
const exit = context.enter('strikethrough')
|
|
37467
|
+
let value = tracker.move('~~')
|
|
37468
|
+
value += containerPhrasing(node, context, {
|
|
37469
|
+
...tracker.current(),
|
|
37470
|
+
before: value,
|
|
37471
|
+
after: '~'
|
|
37472
|
+
})
|
|
37473
|
+
value += tracker.move('~~')
|
|
37474
|
+
exit()
|
|
37475
|
+
return value
|
|
37476
|
+
}
|
|
37477
|
+
|
|
37478
|
+
/** @type {ToMarkdownHandle} */
|
|
37479
|
+
function peekDelete() {
|
|
37480
|
+
return '~'
|
|
37481
|
+
}
|
|
37482
|
+
|
|
37483
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-table/node_modules/mdast-util-to-markdown/lib/util/container-phrasing.js
|
|
37484
|
+
/**
|
|
37485
|
+
* @typedef {import('../types.js').Handle} Handle
|
|
37486
|
+
* @typedef {import('../types.js').Info} Info
|
|
37487
|
+
* @typedef {import('../types.js').Parent} Parent
|
|
37488
|
+
* @typedef {import('../types.js').PhrasingContent} PhrasingContent
|
|
37489
|
+
* @typedef {import('../types.js').State} State
|
|
37490
|
+
*/
|
|
37491
|
+
|
|
37492
|
+
/**
|
|
37493
|
+
* Serialize the children of a parent that contains phrasing children.
|
|
37494
|
+
*
|
|
37495
|
+
* These children will be joined flush together.
|
|
37496
|
+
*
|
|
37497
|
+
* @param {Parent & {children: Array<PhrasingContent>}} parent
|
|
37498
|
+
* Parent of flow nodes.
|
|
37499
|
+
* @param {State} state
|
|
37500
|
+
* Info passed around about the current state.
|
|
37501
|
+
* @param {Info} info
|
|
37502
|
+
* Info on where we are in the document we are generating.
|
|
37503
|
+
* @returns {string}
|
|
37504
|
+
* Serialized children, joined together.
|
|
37505
|
+
*/
|
|
37506
|
+
function container_phrasing_containerPhrasing(parent, state, info) {
|
|
37507
|
+
const indexStack = state.indexStack
|
|
37508
|
+
const children = parent.children || []
|
|
37509
|
+
/** @type {Array<string>} */
|
|
37510
|
+
const results = []
|
|
37511
|
+
let index = -1
|
|
37512
|
+
let before = info.before
|
|
37513
|
+
|
|
37514
|
+
indexStack.push(-1)
|
|
37515
|
+
let tracker = state.createTracker(info)
|
|
37516
|
+
|
|
37517
|
+
while (++index < children.length) {
|
|
37518
|
+
const child = children[index]
|
|
37519
|
+
/** @type {string} */
|
|
37520
|
+
let after
|
|
37521
|
+
|
|
37522
|
+
indexStack[indexStack.length - 1] = index
|
|
37523
|
+
|
|
37524
|
+
if (index + 1 < children.length) {
|
|
37525
|
+
/** @type {Handle} */
|
|
37526
|
+
// @ts-expect-error: hush, it’s actually a `zwitch`.
|
|
37527
|
+
let handle = state.handle.handlers[children[index + 1].type]
|
|
37528
|
+
/** @type {Handle} */
|
|
37529
|
+
// @ts-expect-error: hush, it’s actually a `zwitch`.
|
|
37530
|
+
if (handle && handle.peek) handle = handle.peek
|
|
37531
|
+
after = handle
|
|
37532
|
+
? handle(children[index + 1], parent, state, {
|
|
37533
|
+
before: '',
|
|
37534
|
+
after: '',
|
|
37535
|
+
...tracker.current()
|
|
37536
|
+
}).charAt(0)
|
|
37537
|
+
: ''
|
|
37538
|
+
} else {
|
|
37539
|
+
after = info.after
|
|
37540
|
+
}
|
|
37541
|
+
|
|
37542
|
+
// In some cases, html (text) can be found in phrasing right after an eol.
|
|
37543
|
+
// When we’d serialize that, in most cases that would be seen as html
|
|
37544
|
+
// (flow).
|
|
37545
|
+
// As we can’t escape or so to prevent it from happening, we take a somewhat
|
|
37546
|
+
// reasonable approach: replace that eol with a space.
|
|
37547
|
+
// See: <https://github.com/syntax-tree/mdast-util-to-markdown/issues/15>
|
|
37548
|
+
if (
|
|
37549
|
+
results.length > 0 &&
|
|
37550
|
+
(before === '\r' || before === '\n') &&
|
|
37551
|
+
child.type === 'html'
|
|
37552
|
+
) {
|
|
37553
|
+
results[results.length - 1] = results[results.length - 1].replace(
|
|
37554
|
+
/(\r?\n|\r)$/,
|
|
37555
|
+
' '
|
|
37556
|
+
)
|
|
37557
|
+
before = ' '
|
|
37558
|
+
|
|
37559
|
+
// To do: does this work to reset tracker?
|
|
37560
|
+
tracker = state.createTracker(info)
|
|
37561
|
+
tracker.move(results.join(''))
|
|
37562
|
+
}
|
|
37563
|
+
|
|
37564
|
+
results.push(
|
|
37565
|
+
tracker.move(
|
|
37566
|
+
state.handle(child, parent, state, {
|
|
37567
|
+
...tracker.current(),
|
|
37568
|
+
before,
|
|
37569
|
+
after
|
|
37570
|
+
})
|
|
37571
|
+
)
|
|
37572
|
+
)
|
|
37573
|
+
|
|
37574
|
+
before = results[results.length - 1].slice(-1)
|
|
37575
|
+
}
|
|
37576
|
+
|
|
37577
|
+
indexStack.pop()
|
|
37578
|
+
|
|
37579
|
+
return results.join('')
|
|
37580
|
+
}
|
|
37581
|
+
|
|
37582
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-table/node_modules/mdast-util-to-markdown/lib/util/pattern-compile.js
|
|
36952
37583
|
/**
|
|
36953
|
-
*
|
|
36954
|
-
*
|
|
36955
|
-
* @type {FromMarkdownExtension}
|
|
36956
|
-
*/
|
|
36957
|
-
const gfmStrikethroughFromMarkdown = {
|
|
36958
|
-
canContainEols: ['delete'],
|
|
36959
|
-
enter: {strikethrough: enterStrikethrough},
|
|
36960
|
-
exit: {strikethrough: exitStrikethrough}
|
|
36961
|
-
}
|
|
36962
|
-
|
|
36963
|
-
/**
|
|
36964
|
-
* Extension for `mdast-util-to-markdown` to enable GFM strikethrough.
|
|
36965
|
-
*
|
|
36966
|
-
* @type {ToMarkdownExtension}
|
|
36967
|
-
*/
|
|
36968
|
-
const gfmStrikethroughToMarkdown = {
|
|
36969
|
-
unsafe: [
|
|
36970
|
-
{
|
|
36971
|
-
character: '~',
|
|
36972
|
-
inConstruct: 'phrasing',
|
|
36973
|
-
notInConstruct: constructsWithoutStrikethrough
|
|
36974
|
-
}
|
|
36975
|
-
],
|
|
36976
|
-
handlers: {delete: handleDelete}
|
|
36977
|
-
}
|
|
36978
|
-
|
|
36979
|
-
/**
|
|
36980
|
-
* @this {CompileContext}
|
|
36981
|
-
* @type {FromMarkdownHandle}
|
|
37584
|
+
* @typedef {import('../types.js').Unsafe} Unsafe
|
|
36982
37585
|
*/
|
|
36983
|
-
function enterStrikethrough(token) {
|
|
36984
|
-
this.enter({type: 'delete', children: []}, token)
|
|
36985
|
-
}
|
|
36986
37586
|
|
|
36987
37587
|
/**
|
|
36988
|
-
* @
|
|
36989
|
-
* @
|
|
37588
|
+
* @param {Unsafe} pattern
|
|
37589
|
+
* @returns {RegExp}
|
|
36990
37590
|
*/
|
|
36991
|
-
function
|
|
36992
|
-
|
|
36993
|
-
|
|
37591
|
+
function pattern_compile_patternCompile(pattern) {
|
|
37592
|
+
if (!pattern._compiled) {
|
|
37593
|
+
const before =
|
|
37594
|
+
(pattern.atBreak ? '[\\r\\n][\\t ]*' : '') +
|
|
37595
|
+
(pattern.before ? '(?:' + pattern.before + ')' : '')
|
|
36994
37596
|
|
|
36995
|
-
|
|
36996
|
-
|
|
36997
|
-
|
|
36998
|
-
|
|
36999
|
-
|
|
37000
|
-
|
|
37001
|
-
|
|
37002
|
-
|
|
37003
|
-
value += containerPhrasing(node, context, {
|
|
37004
|
-
...tracker.current(),
|
|
37005
|
-
before: value,
|
|
37006
|
-
after: '~'
|
|
37007
|
-
})
|
|
37008
|
-
value += tracker.move('~~')
|
|
37009
|
-
exit()
|
|
37010
|
-
return value
|
|
37011
|
-
}
|
|
37597
|
+
pattern._compiled = new RegExp(
|
|
37598
|
+
(before ? '(' + before + ')' : '') +
|
|
37599
|
+
(/[|\\{}()[\]^$+*?.-]/.test(pattern.character) ? '\\' : '') +
|
|
37600
|
+
pattern.character +
|
|
37601
|
+
(pattern.after ? '(?:' + pattern.after + ')' : ''),
|
|
37602
|
+
'g'
|
|
37603
|
+
)
|
|
37604
|
+
}
|
|
37012
37605
|
|
|
37013
|
-
|
|
37014
|
-
function peekDelete() {
|
|
37015
|
-
return '~'
|
|
37606
|
+
return pattern._compiled
|
|
37016
37607
|
}
|
|
37017
37608
|
|
|
37018
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
|
|
37609
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-table/node_modules/mdast-util-to-markdown/lib/handle/inline-code.js
|
|
37019
37610
|
/**
|
|
37020
37611
|
* @typedef {import('mdast').InlineCode} InlineCode
|
|
37021
37612
|
* @typedef {import('../types.js').Parent} Parent
|
|
@@ -37062,7 +37653,7 @@ function inline_code_inlineCode(node, _, state) {
|
|
|
37062
37653
|
// them out.
|
|
37063
37654
|
while (++index < state.unsafe.length) {
|
|
37064
37655
|
const pattern = state.unsafe[index]
|
|
37065
|
-
const expression =
|
|
37656
|
+
const expression = pattern_compile_patternCompile(pattern)
|
|
37066
37657
|
/** @type {RegExpExecArray | null} */
|
|
37067
37658
|
let match
|
|
37068
37659
|
|
|
@@ -37694,7 +38285,7 @@ function gfmTableToMarkdown(options) {
|
|
|
37694
38285
|
function handleTableCell(node, _, context, safeOptions) {
|
|
37695
38286
|
const exit = context.enter('tableCell')
|
|
37696
38287
|
const subexit = context.enter('phrasing')
|
|
37697
|
-
const value =
|
|
38288
|
+
const value = container_phrasing_containerPhrasing(node, context, {
|
|
37698
38289
|
...safeOptions,
|
|
37699
38290
|
before: around,
|
|
37700
38291
|
after: around
|
|
@@ -37789,7 +38380,7 @@ function gfmTableToMarkdown(options) {
|
|
|
37789
38380
|
}
|
|
37790
38381
|
}
|
|
37791
38382
|
|
|
37792
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
|
|
38383
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/check-bullet.js
|
|
37793
38384
|
/**
|
|
37794
38385
|
* @typedef {import('../types.js').State} State
|
|
37795
38386
|
* @typedef {import('../types.js').Options} Options
|
|
@@ -37813,7 +38404,7 @@ function checkBullet(state) {
|
|
|
37813
38404
|
return marker
|
|
37814
38405
|
}
|
|
37815
38406
|
|
|
37816
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
|
|
38407
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js
|
|
37817
38408
|
/**
|
|
37818
38409
|
* @typedef {import('../types.js').State} State
|
|
37819
38410
|
* @typedef {import('../types.js').Options} Options
|
|
@@ -37843,7 +38434,7 @@ function checkListItemIndent(state) {
|
|
|
37843
38434
|
return style
|
|
37844
38435
|
}
|
|
37845
38436
|
|
|
37846
|
-
;// CONCATENATED MODULE: ../node_modules/mdast-util-to-markdown/lib/handle/list-item.js
|
|
38437
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/handle/list-item.js
|
|
37847
38438
|
/**
|
|
37848
38439
|
* @typedef {import('mdast').ListItem} ListItem
|
|
37849
38440
|
* @typedef {import('../types.js').Map} Map
|
|
@@ -37910,6 +38501,66 @@ function list_item_listItem(node, parent, state, info) {
|
|
|
37910
38501
|
}
|
|
37911
38502
|
}
|
|
37912
38503
|
|
|
38504
|
+
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/node_modules/mdast-util-to-markdown/lib/util/track.js
|
|
38505
|
+
/**
|
|
38506
|
+
* @typedef {import('../types.js').CreateTracker} CreateTracker
|
|
38507
|
+
* @typedef {import('../types.js').TrackCurrent} TrackCurrent
|
|
38508
|
+
* @typedef {import('../types.js').TrackMove} TrackMove
|
|
38509
|
+
* @typedef {import('../types.js').TrackShift} TrackShift
|
|
38510
|
+
*/
|
|
38511
|
+
|
|
38512
|
+
/**
|
|
38513
|
+
* Track positional info in the output.
|
|
38514
|
+
*
|
|
38515
|
+
* @type {CreateTracker}
|
|
38516
|
+
*/
|
|
38517
|
+
function util_track_track(config) {
|
|
38518
|
+
// Defaults are used to prevent crashes when older utilities somehow activate
|
|
38519
|
+
// this code.
|
|
38520
|
+
/* c8 ignore next 5 */
|
|
38521
|
+
const options = config || {}
|
|
38522
|
+
const now = options.now || {}
|
|
38523
|
+
let lineShift = options.lineShift || 0
|
|
38524
|
+
let line = now.line || 1
|
|
38525
|
+
let column = now.column || 1
|
|
38526
|
+
|
|
38527
|
+
return {move, current, shift}
|
|
38528
|
+
|
|
38529
|
+
/**
|
|
38530
|
+
* Get the current tracked info.
|
|
38531
|
+
*
|
|
38532
|
+
* @type {TrackCurrent}
|
|
38533
|
+
*/
|
|
38534
|
+
function current() {
|
|
38535
|
+
return {now: {line, column}, lineShift}
|
|
38536
|
+
}
|
|
38537
|
+
|
|
38538
|
+
/**
|
|
38539
|
+
* Define an increased line shift (the typical indent for lines).
|
|
38540
|
+
*
|
|
38541
|
+
* @type {TrackShift}
|
|
38542
|
+
*/
|
|
38543
|
+
function shift(value) {
|
|
38544
|
+
lineShift += value
|
|
38545
|
+
}
|
|
38546
|
+
|
|
38547
|
+
/**
|
|
38548
|
+
* Move past some generated markdown.
|
|
38549
|
+
*
|
|
38550
|
+
* @type {TrackMove}
|
|
38551
|
+
*/
|
|
38552
|
+
function move(input) {
|
|
38553
|
+
// eslint-disable-next-line unicorn/prefer-default-parameters
|
|
38554
|
+
const value = input || ''
|
|
38555
|
+
const chunks = value.split(/\r?\n|\r/g)
|
|
38556
|
+
const tail = chunks[chunks.length - 1]
|
|
38557
|
+
line += chunks.length - 1
|
|
38558
|
+
column =
|
|
38559
|
+
chunks.length === 1 ? column + tail.length : 1 + tail.length + lineShift
|
|
38560
|
+
return value
|
|
38561
|
+
}
|
|
38562
|
+
}
|
|
38563
|
+
|
|
37913
38564
|
;// CONCATENATED MODULE: ../node_modules/mdast-util-gfm-task-list-item/lib/index.js
|
|
37914
38565
|
/**
|
|
37915
38566
|
* @typedef {import('mdast').Content} Content
|
|
@@ -38029,7 +38680,7 @@ function listItemWithTaskListItem(node, parent, context, safeOptions) {
|
|
|
38029
38680
|
const checkable =
|
|
38030
38681
|
typeof node.checked === 'boolean' && head && head.type === 'paragraph'
|
|
38031
38682
|
const checkbox = '[' + (node.checked ? 'x' : ' ') + '] '
|
|
38032
|
-
const tracker =
|
|
38683
|
+
const tracker = util_track_track(safeOptions)
|
|
38033
38684
|
|
|
38034
38685
|
if (checkable) {
|
|
38035
38686
|
tracker.move(checkbox)
|
|
@@ -45602,7 +46253,7 @@ function vbnet(Prism) {
|
|
|
45602
46253
|
})
|
|
45603
46254
|
}
|
|
45604
46255
|
|
|
45605
|
-
;// CONCATENATED MODULE: ../node_modules/character-entities-legacy/index.js
|
|
46256
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/character-entities-legacy/index.js
|
|
45606
46257
|
/**
|
|
45607
46258
|
* List of legacy HTML named character references that don’t need a trailing semicolon.
|
|
45608
46259
|
*
|
|
@@ -45717,7 +46368,7 @@ const characterEntitiesLegacy = [
|
|
|
45717
46368
|
'yuml'
|
|
45718
46369
|
]
|
|
45719
46370
|
|
|
45720
|
-
;// CONCATENATED MODULE: ../node_modules/character-reference-invalid/index.js
|
|
46371
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/character-reference-invalid/index.js
|
|
45721
46372
|
/**
|
|
45722
46373
|
* Map of invalid numeric character references to their replacements, according to HTML.
|
|
45723
46374
|
*
|
|
@@ -45754,7 +46405,7 @@ const characterReferenceInvalid = {
|
|
|
45754
46405
|
159: 'Ÿ'
|
|
45755
46406
|
}
|
|
45756
46407
|
|
|
45757
|
-
;// CONCATENATED MODULE: ../node_modules/is-decimal/index.js
|
|
46408
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-decimal/index.js
|
|
45758
46409
|
/**
|
|
45759
46410
|
* Check if the given character code, or the character code at the first
|
|
45760
46411
|
* character, is decimal.
|
|
@@ -45769,7 +46420,7 @@ function isDecimal(character) {
|
|
|
45769
46420
|
return code >= 48 && code <= 57 /* 0-9 */
|
|
45770
46421
|
}
|
|
45771
46422
|
|
|
45772
|
-
;// CONCATENATED MODULE: ../node_modules/is-hexadecimal/index.js
|
|
46423
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-hexadecimal/index.js
|
|
45773
46424
|
/**
|
|
45774
46425
|
* Check if the given character code, or the character code at the first
|
|
45775
46426
|
* character, is hexadecimal.
|
|
@@ -45788,7 +46439,7 @@ function isHexadecimal(character) {
|
|
|
45788
46439
|
)
|
|
45789
46440
|
}
|
|
45790
46441
|
|
|
45791
|
-
;// CONCATENATED MODULE: ../node_modules/is-alphabetical/index.js
|
|
46442
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-alphabetical/index.js
|
|
45792
46443
|
/**
|
|
45793
46444
|
* Check if the given character code, or the character code at the first
|
|
45794
46445
|
* character, is alphabetical.
|
|
@@ -45806,7 +46457,7 @@ function isAlphabetical(character) {
|
|
|
45806
46457
|
)
|
|
45807
46458
|
}
|
|
45808
46459
|
|
|
45809
|
-
;// CONCATENATED MODULE: ../node_modules/is-alphanumerical/index.js
|
|
46460
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/is-alphanumerical/index.js
|
|
45810
46461
|
|
|
45811
46462
|
|
|
45812
46463
|
|
|
@@ -45821,7 +46472,7 @@ function isAlphanumerical(character) {
|
|
|
45821
46472
|
return isAlphabetical(character) || isDecimal(character)
|
|
45822
46473
|
}
|
|
45823
46474
|
|
|
45824
|
-
;// CONCATENATED MODULE: ../node_modules/parse-entities/lib/index.js
|
|
46475
|
+
;// CONCATENATED MODULE: ../node_modules/refractor/node_modules/parse-entities/lib/index.js
|
|
45825
46476
|
/**
|
|
45826
46477
|
* @typedef {import('unist').Point} Point
|
|
45827
46478
|
* @typedef {import('unist').Position} Position
|
|
@@ -70245,7 +70896,6 @@ var octiconLink = {
|
|
|
70245
70896
|
}
|
|
70246
70897
|
}]
|
|
70247
70898
|
};
|
|
70248
|
-
|
|
70249
70899
|
;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/nodes/copy.js
|
|
70250
70900
|
function copyElement(str) {
|
|
70251
70901
|
if (str === void 0) {
|
|
@@ -70309,34 +70959,45 @@ function copyElement(str) {
|
|
|
70309
70959
|
}]
|
|
70310
70960
|
};
|
|
70311
70961
|
}
|
|
70312
|
-
|
|
70313
70962
|
// EXTERNAL MODULE: ../node_modules/@uiw/copy-to-clipboard/dist/copy-to-clipboard.umd.js
|
|
70314
70963
|
var copy_to_clipboard_umd = __webpack_require__(7071);
|
|
70315
70964
|
var copy_to_clipboard_umd_default = /*#__PURE__*/__webpack_require__.n(copy_to_clipboard_umd);
|
|
70316
70965
|
;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/plugins/useCopied.js
|
|
70317
70966
|
|
|
70318
70967
|
|
|
70968
|
+
function getParentElement(target) {
|
|
70969
|
+
if (!target) return null;
|
|
70970
|
+
var dom = target;
|
|
70971
|
+
if (dom.dataset.code && dom.classList.contains('copied')) {
|
|
70972
|
+
return dom;
|
|
70973
|
+
}
|
|
70974
|
+
if (dom.parentElement) {
|
|
70975
|
+
return getParentElement(dom.parentElement);
|
|
70976
|
+
}
|
|
70977
|
+
return null;
|
|
70978
|
+
}
|
|
70319
70979
|
function useCopied(container) {
|
|
70320
|
-
var handle =
|
|
70321
|
-
var target = event.
|
|
70980
|
+
var handle = event => {
|
|
70981
|
+
var target = getParentElement(event.target);
|
|
70982
|
+
if (!target) return;
|
|
70322
70983
|
target.classList.add('active');
|
|
70323
70984
|
copy_to_clipboard_umd_default()(target.dataset.code, function () {
|
|
70324
70985
|
setTimeout(() => {
|
|
70325
70986
|
target.classList.remove('active');
|
|
70326
70987
|
}, 2000);
|
|
70327
70988
|
});
|
|
70328
|
-
}
|
|
70989
|
+
};
|
|
70329
70990
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
|
|
70330
|
-
var _container$current;
|
|
70331
|
-
|
|
70332
|
-
|
|
70991
|
+
var _container$current, _container$current2;
|
|
70992
|
+
(_container$current = container.current) == null ? void 0 : _container$current.removeEventListener('click', handle, false);
|
|
70993
|
+
(_container$current2 = container.current) == null ? void 0 : _container$current2.addEventListener('click', handle, false);
|
|
70333
70994
|
return () => {
|
|
70334
|
-
|
|
70995
|
+
var _container$current3;
|
|
70996
|
+
(_container$current3 = container.current) == null ? void 0 : _container$current3.removeEventListener('click', handle, false);
|
|
70335
70997
|
};
|
|
70336
70998
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
70337
70999
|
}, [container]);
|
|
70338
71000
|
}
|
|
70339
|
-
|
|
70340
71001
|
;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/styles/markdown.css
|
|
70341
71002
|
// extracted by mini-css-extract-plugin
|
|
70342
71003
|
/* harmony default export */ const styles_markdown = ({});
|
|
@@ -70357,7 +71018,6 @@ var reservedMeta = function reservedMeta(options) {
|
|
|
70357
71018
|
});
|
|
70358
71019
|
};
|
|
70359
71020
|
};
|
|
70360
|
-
|
|
70361
71021
|
// EXTERNAL MODULE: ../node_modules/react/jsx-runtime.js
|
|
70362
71022
|
var jsx_runtime = __webpack_require__(3605);
|
|
70363
71023
|
;// CONCATENATED MODULE: ../node_modules/@uiw/react-markdown-preview/esm/index.js
|
|
@@ -70453,7 +71113,6 @@ var _excluded = ["prefixCls", "className", "source", "style", "disableCopy", "sk
|
|
|
70453
71113
|
}))
|
|
70454
71114
|
}));
|
|
70455
71115
|
}));
|
|
70456
|
-
|
|
70457
71116
|
;// CONCATENATED MODULE: ./src/Context.tsx
|
|
70458
71117
|
function reducer(state,action){return _objectSpread2(_objectSpread2({},state),action);}var EditorContext=/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createContext({markdown:''});
|
|
70459
71118
|
;// CONCATENATED MODULE: ./src/components/TextArea/shortcuts.ts
|
|
@@ -71000,6 +71659,121 @@ function toDecimal(code, next, omit) {
|
|
|
71000
71659
|
: value + ';'
|
|
71001
71660
|
}
|
|
71002
71661
|
|
|
71662
|
+
;// CONCATENATED MODULE: ../node_modules/stringify-entities/node_modules/character-entities-legacy/index.js
|
|
71663
|
+
/**
|
|
71664
|
+
* List of legacy HTML named character references that don’t need a trailing semicolon.
|
|
71665
|
+
*
|
|
71666
|
+
* @type {Array<string>}
|
|
71667
|
+
*/
|
|
71668
|
+
const character_entities_legacy_characterEntitiesLegacy = [
|
|
71669
|
+
'AElig',
|
|
71670
|
+
'AMP',
|
|
71671
|
+
'Aacute',
|
|
71672
|
+
'Acirc',
|
|
71673
|
+
'Agrave',
|
|
71674
|
+
'Aring',
|
|
71675
|
+
'Atilde',
|
|
71676
|
+
'Auml',
|
|
71677
|
+
'COPY',
|
|
71678
|
+
'Ccedil',
|
|
71679
|
+
'ETH',
|
|
71680
|
+
'Eacute',
|
|
71681
|
+
'Ecirc',
|
|
71682
|
+
'Egrave',
|
|
71683
|
+
'Euml',
|
|
71684
|
+
'GT',
|
|
71685
|
+
'Iacute',
|
|
71686
|
+
'Icirc',
|
|
71687
|
+
'Igrave',
|
|
71688
|
+
'Iuml',
|
|
71689
|
+
'LT',
|
|
71690
|
+
'Ntilde',
|
|
71691
|
+
'Oacute',
|
|
71692
|
+
'Ocirc',
|
|
71693
|
+
'Ograve',
|
|
71694
|
+
'Oslash',
|
|
71695
|
+
'Otilde',
|
|
71696
|
+
'Ouml',
|
|
71697
|
+
'QUOT',
|
|
71698
|
+
'REG',
|
|
71699
|
+
'THORN',
|
|
71700
|
+
'Uacute',
|
|
71701
|
+
'Ucirc',
|
|
71702
|
+
'Ugrave',
|
|
71703
|
+
'Uuml',
|
|
71704
|
+
'Yacute',
|
|
71705
|
+
'aacute',
|
|
71706
|
+
'acirc',
|
|
71707
|
+
'acute',
|
|
71708
|
+
'aelig',
|
|
71709
|
+
'agrave',
|
|
71710
|
+
'amp',
|
|
71711
|
+
'aring',
|
|
71712
|
+
'atilde',
|
|
71713
|
+
'auml',
|
|
71714
|
+
'brvbar',
|
|
71715
|
+
'ccedil',
|
|
71716
|
+
'cedil',
|
|
71717
|
+
'cent',
|
|
71718
|
+
'copy',
|
|
71719
|
+
'curren',
|
|
71720
|
+
'deg',
|
|
71721
|
+
'divide',
|
|
71722
|
+
'eacute',
|
|
71723
|
+
'ecirc',
|
|
71724
|
+
'egrave',
|
|
71725
|
+
'eth',
|
|
71726
|
+
'euml',
|
|
71727
|
+
'frac12',
|
|
71728
|
+
'frac14',
|
|
71729
|
+
'frac34',
|
|
71730
|
+
'gt',
|
|
71731
|
+
'iacute',
|
|
71732
|
+
'icirc',
|
|
71733
|
+
'iexcl',
|
|
71734
|
+
'igrave',
|
|
71735
|
+
'iquest',
|
|
71736
|
+
'iuml',
|
|
71737
|
+
'laquo',
|
|
71738
|
+
'lt',
|
|
71739
|
+
'macr',
|
|
71740
|
+
'micro',
|
|
71741
|
+
'middot',
|
|
71742
|
+
'nbsp',
|
|
71743
|
+
'not',
|
|
71744
|
+
'ntilde',
|
|
71745
|
+
'oacute',
|
|
71746
|
+
'ocirc',
|
|
71747
|
+
'ograve',
|
|
71748
|
+
'ordf',
|
|
71749
|
+
'ordm',
|
|
71750
|
+
'oslash',
|
|
71751
|
+
'otilde',
|
|
71752
|
+
'ouml',
|
|
71753
|
+
'para',
|
|
71754
|
+
'plusmn',
|
|
71755
|
+
'pound',
|
|
71756
|
+
'quot',
|
|
71757
|
+
'raquo',
|
|
71758
|
+
'reg',
|
|
71759
|
+
'sect',
|
|
71760
|
+
'shy',
|
|
71761
|
+
'sup1',
|
|
71762
|
+
'sup2',
|
|
71763
|
+
'sup3',
|
|
71764
|
+
'szlig',
|
|
71765
|
+
'thorn',
|
|
71766
|
+
'times',
|
|
71767
|
+
'uacute',
|
|
71768
|
+
'ucirc',
|
|
71769
|
+
'ugrave',
|
|
71770
|
+
'uml',
|
|
71771
|
+
'uuml',
|
|
71772
|
+
'yacute',
|
|
71773
|
+
'yen',
|
|
71774
|
+
'yuml'
|
|
71775
|
+
]
|
|
71776
|
+
|
|
71003
71777
|
;// CONCATENATED MODULE: ../node_modules/character-entities-html4/index.js
|
|
71004
71778
|
/**
|
|
71005
71779
|
* Map of named character references from HTML 4.
|
|
@@ -71320,7 +72094,7 @@ function toNamed(code, next, omit, attribute) {
|
|
|
71320
72094
|
|
|
71321
72095
|
if (
|
|
71322
72096
|
omit &&
|
|
71323
|
-
|
|
72097
|
+
character_entities_legacy_characterEntitiesLegacy.includes(name) &&
|
|
71324
72098
|
!dangerous.includes(name) &&
|
|
71325
72099
|
(!attribute ||
|
|
71326
72100
|
(next &&
|