securemark 0.293.1 → 0.293.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +7 -10
- package/dist/index.js +329 -150
- package/package.json +1 -1
- package/src/combinator/control/manipulation/indent.test.ts +6 -1
- package/src/combinator/control/manipulation/indent.ts +1 -1
- package/src/combinator/control/manipulation/scope.ts +3 -4
- package/src/combinator/control/manipulation/surround.ts +2 -1
- package/src/combinator/data/parser/context/delimiter.ts +7 -12
- package/src/combinator/data/parser/some.ts +4 -8
- package/src/parser/api/parse.test.ts +2 -2
- package/src/parser/block/olist.test.ts +8 -6
- package/src/parser/block/olist.ts +2 -2
- package/src/parser/block/sidefence.ts +2 -2
- package/src/parser/block/table.ts +2 -2
- package/src/parser/block.ts +38 -36
- package/src/parser/inline/annotation.test.ts +1 -1
- package/src/parser/inline/autolink/url.test.ts +5 -5
- package/src/parser/inline/bracket.test.ts +6 -4
- package/src/parser/inline/bracket.ts +114 -88
- package/src/parser/inline/html.ts +24 -13
- package/src/parser/inline/italic.test.ts +9 -9
- package/src/parser/inline/link.ts +1 -1
- package/src/parser/inline/mark.test.ts +5 -5
- package/src/parser/inline/math.ts +2 -2
- package/src/parser/inline/media.ts +3 -2
- package/src/parser/inline/reference.test.ts +1 -1
- package/src/parser/inline/remark.ts +2 -2
- package/src/parser/inline/template.ts +1 -1
- package/src/parser/inline.test.ts +24 -23
- package/src/parser/inline.ts +46 -47
- package/src/parser/segment.ts +12 -12
- package/src/parser/source/escapable.test.ts +1 -1
- package/src/parser/source/escapable.ts +7 -4
- package/src/parser/source/text.ts +162 -25
- package/src/parser/source/unescapable.ts +5 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.293.
|
|
1
|
+
/*! securemark v0.293.3 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -2768,7 +2768,7 @@ function indent(opener, parser = false, separation = false) {
|
|
|
2768
2768
|
if (typeof opener === 'function') {
|
|
2769
2769
|
separation = parser;
|
|
2770
2770
|
parser = opener;
|
|
2771
|
-
opener = /
|
|
2771
|
+
opener = / {1,4}|\t{1,2}/y;
|
|
2772
2772
|
}
|
|
2773
2773
|
return (0, parser_1.failsafe)((0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, ({
|
|
2774
2774
|
context
|
|
@@ -2906,7 +2906,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2906
2906
|
exports.rewrite = exports.focus = void 0;
|
|
2907
2907
|
const parser_1 = __webpack_require__(605);
|
|
2908
2908
|
const combinator_1 = __webpack_require__(3484);
|
|
2909
|
-
function focus(scope, parser
|
|
2909
|
+
function focus(scope, parser) {
|
|
2910
2910
|
const match = (0, combinator_1.matcher)(scope, false);
|
|
2911
2911
|
return (0, parser_1.failsafe)(({
|
|
2912
2912
|
context
|
|
@@ -2920,7 +2920,6 @@ function focus(scope, parser, cost = true) {
|
|
|
2920
2920
|
context
|
|
2921
2921
|
}))?.[0] ?? '';
|
|
2922
2922
|
if (src === '') return;
|
|
2923
|
-
cost && (0, combinator_1.consume)(src.length, context);
|
|
2924
2923
|
context.range = src.length;
|
|
2925
2924
|
context.offset ??= 0;
|
|
2926
2925
|
context.offset += position;
|
|
@@ -3075,8 +3074,10 @@ function isBacktrack(context, backtracks, position = context.position, length =
|
|
|
3075
3074
|
exports.isBacktrack = isBacktrack;
|
|
3076
3075
|
function setBacktrack(context, backtracks, position, length = 1) {
|
|
3077
3076
|
const {
|
|
3078
|
-
source
|
|
3077
|
+
source,
|
|
3078
|
+
state = 0
|
|
3079
3079
|
} = context;
|
|
3080
|
+
if (state === 0) return;
|
|
3080
3081
|
if (position === source.length) return;
|
|
3081
3082
|
if (length === 0) return;
|
|
3082
3083
|
for (const backtrack of backtracks) {
|
|
@@ -3456,19 +3457,18 @@ class Delimiters {
|
|
|
3456
3457
|
this.states = [];
|
|
3457
3458
|
}
|
|
3458
3459
|
// 手間を惜しまなければ規定のパターンはすべて配列のインデクスに変換可能。
|
|
3459
|
-
static signature(pattern
|
|
3460
|
+
static signature(pattern) {
|
|
3460
3461
|
switch (typeof pattern) {
|
|
3461
3462
|
case 'undefined':
|
|
3462
|
-
return
|
|
3463
|
+
return 1 << 7;
|
|
3463
3464
|
case 'string':
|
|
3464
3465
|
if (pattern.length === 1) {
|
|
3465
3466
|
const code = pattern.charCodeAt(0);
|
|
3466
|
-
|
|
3467
|
-
if ((code & 1 << 7) === 0) return code | +linebreakable << 7;
|
|
3467
|
+
return code;
|
|
3468
3468
|
}
|
|
3469
|
-
return `s:${pattern}
|
|
3469
|
+
return `s:${pattern}`;
|
|
3470
3470
|
case 'object':
|
|
3471
|
-
return `r/${pattern.source}
|
|
3471
|
+
return `r/${pattern.source}`;
|
|
3472
3472
|
}
|
|
3473
3473
|
}
|
|
3474
3474
|
static matcher(pattern) {
|
|
@@ -3503,8 +3503,7 @@ class Delimiters {
|
|
|
3503
3503
|
const {
|
|
3504
3504
|
signature,
|
|
3505
3505
|
matcher,
|
|
3506
|
-
precedence
|
|
3507
|
-
linebreakable
|
|
3506
|
+
precedence
|
|
3508
3507
|
} = delims[i];
|
|
3509
3508
|
const memory = this.registry(signature);
|
|
3510
3509
|
const index = memory[0]?.index ?? delimiters.length;
|
|
@@ -3515,7 +3514,6 @@ class Delimiters {
|
|
|
3515
3514
|
signature,
|
|
3516
3515
|
matcher,
|
|
3517
3516
|
precedence,
|
|
3518
|
-
linebreakable,
|
|
3519
3517
|
state: true
|
|
3520
3518
|
};
|
|
3521
3519
|
delimiters[index] = delimiter;
|
|
@@ -3571,8 +3569,7 @@ class Delimiters {
|
|
|
3571
3569
|
}
|
|
3572
3570
|
match(input) {
|
|
3573
3571
|
const {
|
|
3574
|
-
precedence = 0
|
|
3575
|
-
linebreak = 0
|
|
3572
|
+
precedence = 0
|
|
3576
3573
|
} = input.context;
|
|
3577
3574
|
const {
|
|
3578
3575
|
delimiters
|
|
@@ -3582,7 +3579,6 @@ class Delimiters {
|
|
|
3582
3579
|
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3583
3580
|
switch (delimiter.matcher(input)) {
|
|
3584
3581
|
case true:
|
|
3585
|
-
if (!delimiter.linebreakable && linebreak > 0) return false;
|
|
3586
3582
|
return true;
|
|
3587
3583
|
case false:
|
|
3588
3584
|
return false;
|
|
@@ -3685,15 +3681,13 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3685
3681
|
exports.some = void 0;
|
|
3686
3682
|
const parser_1 = __webpack_require__(605);
|
|
3687
3683
|
const delimiter_1 = __webpack_require__(5691);
|
|
3688
|
-
const array_1 = __webpack_require__(6876);
|
|
3689
3684
|
function some(parser, end, delimiters = [], limit = -1) {
|
|
3690
3685
|
if (typeof end === 'number') return some(parser, undefined, delimiters, end);
|
|
3691
3686
|
const match = delimiter_1.Delimiters.matcher(end);
|
|
3692
|
-
const delims = delimiters.map(([delimiter, precedence
|
|
3693
|
-
signature: delimiter_1.Delimiters.signature(delimiter
|
|
3687
|
+
const delims = delimiters.map(([delimiter, precedence]) => ({
|
|
3688
|
+
signature: delimiter_1.Delimiters.signature(delimiter),
|
|
3694
3689
|
matcher: delimiter_1.Delimiters.matcher(delimiter),
|
|
3695
|
-
precedence
|
|
3696
|
-
linebreakable
|
|
3690
|
+
precedence
|
|
3697
3691
|
}));
|
|
3698
3692
|
return input => {
|
|
3699
3693
|
const {
|
|
@@ -3715,7 +3709,7 @@ function some(parser, end, delimiters = [], limit = -1) {
|
|
|
3715
3709
|
if (context.delimiters?.match(input)) break;
|
|
3716
3710
|
const result = parser(input);
|
|
3717
3711
|
if (result === undefined) break;
|
|
3718
|
-
nodes = nodes ? nodes.
|
|
3712
|
+
nodes = nodes ? (nodes.push(...(0, parser_1.eval)(result)), nodes) : (0, parser_1.eval)(result);
|
|
3719
3713
|
if (limit >= 0 && context.position - position > limit) break;
|
|
3720
3714
|
}
|
|
3721
3715
|
if (delims.length > 0) {
|
|
@@ -4322,46 +4316,52 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4322
4316
|
}
|
|
4323
4317
|
} = input;
|
|
4324
4318
|
if (position === source.length) return;
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
case '
|
|
4331
|
-
return (0, codeblock_1.codeblock)(input);
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
return (0,
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4319
|
+
const fst = source[position];
|
|
4320
|
+
switch (fst) {
|
|
4321
|
+
case '=':
|
|
4322
|
+
if (source.startsWith('===', position)) return (0, pagebreak_1.pagebreak)(input);
|
|
4323
|
+
break;
|
|
4324
|
+
case '`':
|
|
4325
|
+
if (source.startsWith('```', position)) return (0, codeblock_1.codeblock)(input);
|
|
4326
|
+
break;
|
|
4327
|
+
case '~':
|
|
4328
|
+
if (source.startsWith('~~~', position)) return (0, extension_1.extension)(input);
|
|
4329
|
+
if (source[position + 1] === ' ') return (0, dlist_1.dlist)(input);
|
|
4330
|
+
break;
|
|
4331
|
+
case '-':
|
|
4332
|
+
if (source[position + 1] === ' ') return (0, ulist_1.ulist)(input) || (0, ilist_1.ilist)(input);
|
|
4333
|
+
break;
|
|
4334
|
+
case '+':
|
|
4335
|
+
case '*':
|
|
4336
|
+
if (source[position + 1] === ' ') return (0, ilist_1.ilist)(input);
|
|
4337
|
+
break;
|
|
4338
|
+
case '[':
|
|
4339
|
+
switch (source[position + 1]) {
|
|
4340
|
+
case '$':
|
|
4341
|
+
return (0, extension_1.extension)(input);
|
|
4342
|
+
case '!':
|
|
4343
|
+
return (0, mediablock_1.mediablock)(input);
|
|
4344
|
+
}
|
|
4345
|
+
break;
|
|
4346
|
+
case '!':
|
|
4347
|
+
if (source[position + 1] === '>') return (0, blockquote_1.blockquote)(input);
|
|
4339
4348
|
return (0, mediablock_1.mediablock)(input);
|
|
4340
|
-
case '
|
|
4349
|
+
case '>':
|
|
4350
|
+
if (source[position + 1] === '>') return (0, blockquote_1.blockquote)(input) || (0, reply_1.reply)(input);
|
|
4341
4351
|
return (0, blockquote_1.blockquote)(input);
|
|
4342
|
-
case '>>':
|
|
4343
|
-
return (0, blockquote_1.blockquote)(input) || (0, reply_1.reply)(input);
|
|
4344
|
-
case '- ':
|
|
4345
|
-
return (0, ulist_1.ulist)(input) || (0, ilist_1.ilist)(input);
|
|
4346
|
-
case '+ ':
|
|
4347
|
-
case '* ':
|
|
4348
|
-
return (0, ilist_1.ilist)(input);
|
|
4349
|
-
case '~ ':
|
|
4350
|
-
return (0, dlist_1.dlist)(input);
|
|
4351
|
-
}
|
|
4352
|
-
switch (source[position]) {
|
|
4353
4352
|
case '#':
|
|
4354
4353
|
return (0, heading_1.heading)(input);
|
|
4355
|
-
case '|':
|
|
4356
|
-
return (0, table_1.table)(input) || (0, sidefence_1.sidefence)(input);
|
|
4357
4354
|
case '$':
|
|
4355
|
+
if (source[position + 1] === '$') return (0, mathblock_1.mathblock)(input);
|
|
4358
4356
|
return (0, extension_1.extension)(input);
|
|
4359
|
-
case '
|
|
4360
|
-
return (0,
|
|
4361
|
-
case '
|
|
4362
|
-
return (0,
|
|
4357
|
+
case '|':
|
|
4358
|
+
return (0, table_1.table)(input) || (0, sidefence_1.sidefence)(input);
|
|
4359
|
+
case '(':
|
|
4360
|
+
return (0, olist_1.olist)(input);
|
|
4361
|
+
default:
|
|
4362
|
+
if ('0' <= fst && fst <= '9') return (0, olist_1.olist)(input);
|
|
4363
4363
|
}
|
|
4364
|
-
}, source_1.emptyline,
|
|
4364
|
+
}, source_1.emptyline, paragraph_1.paragraph])));
|
|
4365
4365
|
function error(parser) {
|
|
4366
4366
|
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}.*\n`);
|
|
4367
4367
|
return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)("\u0007" /* Command.Error */, ({
|
|
@@ -5290,7 +5290,7 @@ const openers = {
|
|
|
5290
5290
|
'.': /([0-9]+|[a-z]+|[A-Z]+)(?:-(?=$|[0-9\n])[0-9]*)*(?:\.?(?:$|[\n])|\. )/y,
|
|
5291
5291
|
'(': /\((?=$|[0-9a-z\n])([0-9]*|[a-z]*)(?=$|[)\n])\)?(?:-(?=$|[0-9\n])[0-9]*)*(?:$|[ \n])/y
|
|
5292
5292
|
};
|
|
5293
|
-
exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/([0-9]
|
|
5293
|
+
exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/(?:[0-9]+)(?:-[0-9]+)*\. /y.source, /\((?:[0-9]+)\)(?:-[0-9]+)* /y.source].join('|'), 'y'), exports.olist_)));
|
|
5294
5294
|
exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => idx(ms[1]), [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => idx(ms[1]), []))])));
|
|
5295
5295
|
const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => [(0, dom_1.html)('li', {
|
|
5296
5296
|
'data-index': (0, inline_1.dataindex)(ns),
|
|
@@ -5543,13 +5543,13 @@ const autolink_1 = __webpack_require__(1671);
|
|
|
5543
5543
|
const source_1 = __webpack_require__(8745);
|
|
5544
5544
|
const util_1 = __webpack_require__(4992);
|
|
5545
5545
|
const dom_1 = __webpack_require__(394);
|
|
5546
|
-
exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/(?=\|+(?:[^\S\n]|\n\|))(?:\|+(?:[^\S\n][^\n]*)?(?:$|\n))+$/y, (0, combinator_1.union)([source])
|
|
5546
|
+
exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/(?=\|+(?:[^\S\n]|\n\|))(?:\|+(?:[^\S\n][^\n]*)?(?:$|\n))+$/y, (0, combinator_1.union)([source])), ([el]) => [(0, dom_1.define)(el, {
|
|
5547
5547
|
class: 'invalid',
|
|
5548
5548
|
...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
|
|
5549
5549
|
})])));
|
|
5550
5550
|
const opener = /(?=\|\|+(?:$|\s))/y;
|
|
5551
5551
|
const unindent = source => source.replace(/(?<=^|\n)\|(?:[^\S\n]|(?=\|*(?:$|\s)))|\n$/g, '');
|
|
5552
|
-
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?:[^\S\n][^\n]*)?(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, false, true)
|
|
5552
|
+
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?:[^\S\n][^\n]*)?(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => [(0, dom_1.html)('pre', (0, dom_1.defrag)(ns))]), false, true))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
|
|
5553
5553
|
|
|
5554
5554
|
/***/ },
|
|
5555
5555
|
|
|
@@ -5584,11 +5584,11 @@ const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_
|
|
|
5584
5584
|
context: {
|
|
5585
5585
|
source
|
|
5586
5586
|
}
|
|
5587
|
-
}) => [[source.at(-1) === ':' ? 'center' : 'start']]
|
|
5587
|
+
}) => [[source.at(-1) === ':' ? 'center' : 'start']]), (0, combinator_1.focus)(/-+:?/y, ({
|
|
5588
5588
|
context: {
|
|
5589
5589
|
source
|
|
5590
5590
|
}
|
|
5591
|
-
}) => [[source.at(-1) === ':' ? 'end' : '']]
|
|
5591
|
+
}) => [[source.at(-1) === ':' ? 'end' : '']])])), ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
|
|
5592
5592
|
const cell = (0, combinator_1.surround)(/\|\s*(?=\S)/y, (0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.media, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.shortmedia, /\s*(?=\||$)/y), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /\|/y, [[/[|\\]?\s*$/y, 9]]))]), /[^|]*/y, true);
|
|
5593
5593
|
const head = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, dom_1.defrag)(ns))]);
|
|
5594
5594
|
const data = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
|
|
@@ -5759,55 +5759,55 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
5759
5759
|
}
|
|
5760
5760
|
} = input;
|
|
5761
5761
|
if (position === source.length) return;
|
|
5762
|
-
switch (source.slice(position, position + 2)) {
|
|
5763
|
-
case '((':
|
|
5764
|
-
return (0, annotation_1.annotation)(input) || (0, bracket_1.bracket)(input);
|
|
5765
|
-
case '[[':
|
|
5766
|
-
return (0, reference_1.reference)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5767
|
-
case '{{':
|
|
5768
|
-
return (0, template_1.template)(input) || (0, bracket_1.bracket)(input);
|
|
5769
|
-
case '[%':
|
|
5770
|
-
return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5771
|
-
case '[#':
|
|
5772
|
-
case '[$':
|
|
5773
|
-
case '[:':
|
|
5774
|
-
case '[^':
|
|
5775
|
-
case '[|':
|
|
5776
|
-
return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5777
|
-
case '${':
|
|
5778
|
-
return (0, math_1.math)(input);
|
|
5779
|
-
case '++':
|
|
5780
|
-
return (0, insertion_1.insertion)(input);
|
|
5781
|
-
case '~~':
|
|
5782
|
-
return (0, deletion_1.deletion)(input);
|
|
5783
|
-
case '==':
|
|
5784
|
-
return (0, mark_1.mark)(input);
|
|
5785
|
-
case '//':
|
|
5786
|
-
return (0, italic_1.italic)(input);
|
|
5787
|
-
case '**':
|
|
5788
|
-
return (0, emstrong_1.emstrong)(input) || (0, strong_1.strong)(input) || stars(input);
|
|
5789
|
-
}
|
|
5790
5762
|
switch (source[position]) {
|
|
5763
|
+
case '(':
|
|
5764
|
+
if (source[position + 1] === '(') return (0, annotation_1.annotation)(input) || (0, bracket_1.bracket)(input);
|
|
5765
|
+
return (0, bracket_1.bracket)(input);
|
|
5791
5766
|
case '[':
|
|
5767
|
+
switch (source[position + 1]) {
|
|
5768
|
+
case '[':
|
|
5769
|
+
return (0, reference_1.reference)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5770
|
+
case '%':
|
|
5771
|
+
return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5772
|
+
case '#':
|
|
5773
|
+
case '$':
|
|
5774
|
+
case ':':
|
|
5775
|
+
case '^':
|
|
5776
|
+
case '|':
|
|
5777
|
+
return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5778
|
+
}
|
|
5792
5779
|
return (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input) || (0, bracket_1.bracket)(input);
|
|
5793
5780
|
case '{':
|
|
5781
|
+
if (source[position + 1] === '{') return (0, template_1.template)(input) || (0, bracket_1.bracket)(input);
|
|
5794
5782
|
return (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
5783
|
+
case '"':
|
|
5784
|
+
case '(':
|
|
5785
|
+
case '[':
|
|
5786
|
+
case '{':
|
|
5787
|
+
return (0, bracket_1.bracket)(input);
|
|
5795
5788
|
case '<':
|
|
5796
5789
|
return (0, html_1.html)(input);
|
|
5797
5790
|
case '$':
|
|
5791
|
+
if (source[position + 1] === '{') return (0, math_1.math)(input);
|
|
5798
5792
|
return (0, extension_1.extension)(input) || (0, math_1.math)(input);
|
|
5793
|
+
case '+':
|
|
5794
|
+
if (source[position + 1] === '+') return (0, insertion_1.insertion)(input);
|
|
5795
|
+
break;
|
|
5796
|
+
case '~':
|
|
5797
|
+
if (source[position + 1] === '~') return (0, deletion_1.deletion)(input);
|
|
5798
|
+
break;
|
|
5799
|
+
case '=':
|
|
5800
|
+
if (source[position + 1] === '=') return (0, mark_1.mark)(input);
|
|
5801
|
+
break;
|
|
5802
|
+
case '/':
|
|
5803
|
+
if (source[position + 1] === '/' && source[position + 2] === '/') return (0, italic_1.italic)(input);
|
|
5804
|
+
break;
|
|
5805
|
+
case '*':
|
|
5806
|
+
return source[position + 1] === '*' ? source[position + 2] === '*' ? (0, emstrong_1.emstrong)(input) || stars(input) : (0, strong_1.strong)(input) || stars(input) : (0, emphasis_1.emphasis)(input);
|
|
5799
5807
|
case '`':
|
|
5800
5808
|
return (0, code_1.code)(input);
|
|
5801
|
-
case '*':
|
|
5802
|
-
return (0, emphasis_1.emphasis)(input) || stars(input);
|
|
5803
5809
|
case '&':
|
|
5804
5810
|
return (0, htmlentity_1.htmlentity)(input);
|
|
5805
|
-
case '(':
|
|
5806
|
-
case '(':
|
|
5807
|
-
case '[':
|
|
5808
|
-
case '{':
|
|
5809
|
-
case '"':
|
|
5810
|
-
return (0, bracket_1.bracket)(input);
|
|
5811
5811
|
}
|
|
5812
5812
|
}, autolink_1.autolink, source_1.text]));
|
|
5813
5813
|
var indexee_1 = __webpack_require__(7610);
|
|
@@ -6128,7 +6128,31 @@ const array_1 = __webpack_require__(6876);
|
|
|
6128
6128
|
const dom_1 = __webpack_require__(394);
|
|
6129
6129
|
const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
|
|
6130
6130
|
const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
|
|
6131
|
-
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
6131
|
+
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
|
|
6132
|
+
const {
|
|
6133
|
+
context: {
|
|
6134
|
+
source,
|
|
6135
|
+
position
|
|
6136
|
+
}
|
|
6137
|
+
} = input;
|
|
6138
|
+
switch (source[position]) {
|
|
6139
|
+
case '(':
|
|
6140
|
+
return p1(input);
|
|
6141
|
+
case '(':
|
|
6142
|
+
return p2(input);
|
|
6143
|
+
case '[':
|
|
6144
|
+
return s1(input);
|
|
6145
|
+
case '[':
|
|
6146
|
+
return s2(input);
|
|
6147
|
+
case '{':
|
|
6148
|
+
return c1(input);
|
|
6149
|
+
case '{':
|
|
6150
|
+
return c2(input);
|
|
6151
|
+
case '"':
|
|
6152
|
+
return d1(input);
|
|
6153
|
+
}
|
|
6154
|
+
}]));
|
|
6155
|
+
const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
|
|
6132
6156
|
source,
|
|
6133
6157
|
position,
|
|
6134
6158
|
range = 0
|
|
@@ -6137,7 +6161,8 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{
|
|
|
6137
6161
|
return indexA.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
|
|
6138
6162
|
class: 'paren'
|
|
6139
6163
|
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
|
|
6140
|
-
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */])
|
|
6164
|
+
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6165
|
+
const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], {
|
|
6141
6166
|
source,
|
|
6142
6167
|
position,
|
|
6143
6168
|
range = 0
|
|
@@ -6146,7 +6171,8 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{
|
|
|
6146
6171
|
return indexF.test(str) ? [[as[0], str, cs[0]]] : [[(0, dom_1.html)('span', {
|
|
6147
6172
|
class: 'paren'
|
|
6148
6173
|
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))]];
|
|
6149
|
-
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]
|
|
6174
|
+
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6175
|
+
const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, ([as, bs = [], cs], context) => {
|
|
6150
6176
|
if (context.state & 8 /* State.link */) {
|
|
6151
6177
|
const {
|
|
6152
6178
|
source,
|
|
@@ -6170,9 +6196,13 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/[([{
|
|
|
6170
6196
|
}
|
|
6171
6197
|
}
|
|
6172
6198
|
return [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)];
|
|
6173
|
-
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */])
|
|
6174
|
-
|
|
6175
|
-
(0, combinator_1.surround)((0, source_1.str)('
|
|
6199
|
+
}, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6200
|
+
const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6201
|
+
const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6202
|
+
const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6203
|
+
const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
|
|
6204
|
+
// 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
|
|
6205
|
+
(0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = []]) => [(0, array_1.unshift)(as, bs)], [2 | 64 /* Backtrack.bracket */]));
|
|
6176
6206
|
|
|
6177
6207
|
/***/ },
|
|
6178
6208
|
|
|
@@ -6709,7 +6739,12 @@ Object.setPrototypeOf(attrspecs, null);
|
|
|
6709
6739
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
6710
6740
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[^\S\n]|>)/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
6711
6741
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6712
|
-
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]]), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs]) => [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)], ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]),
|
|
6742
|
+
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]]), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs]) => [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)], ([as, bs = []]) => [(0, array_1.unshift)(as, bs)]),
|
|
6743
|
+
// 不可視のHTML構造が可視構造を変化させるべきでない。
|
|
6744
|
+
// 可視のHTMLは優先度変更を検討する。
|
|
6745
|
+
// このため<>は将来的に共通構造を変化させる可能性があり
|
|
6746
|
+
// 共通構造を変更させない非構造文字列としては依然としてエスケープを要する。
|
|
6747
|
+
(0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], context) => [[elem(tag, true, as, bs, cs, context)]], ([as, bs = []], context) => [[elem(tag, true, as, bs, [], context)]]), ([, tag]) => tag, new Map())), (0, combinator_1.surround)(
|
|
6713
6748
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6714
6749
|
(0, source_1.str)(/<[a-z]+(?=[^\S\n]|>)/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/[^\S\n]*/y), (0, source_1.str)('>'), true), true, ([as, bs = [], cs], context) => [[elem(as[0].slice(1), false, (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [], context)]], ([as, bs = []], context) => [[elem(as[0].slice(1), false, (0, array_1.unshift)(as, bs), [], [], context)]])])));
|
|
6715
6750
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/yi), (0, source_1.str)(/[^\S\n]+[^\s<>]+/y)]);
|
|
@@ -6720,7 +6755,7 @@ function elem(tag, content, as, bs, cs, context) {
|
|
|
6720
6755
|
if (bs.length === 0) return ielem('content', `Missing the content`, context);
|
|
6721
6756
|
if (!(0, visibility_1.isLooseNodeStart)(bs)) return ielem('content', `Missing the visible content in the same line`, context);
|
|
6722
6757
|
}
|
|
6723
|
-
const attrs = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
|
|
6758
|
+
const [attrs] = attributes('html', attrspecs[tag], as.slice(1, as.at(-1) === '>' ? -1 : as.length));
|
|
6724
6759
|
if (/(?<!\S)invalid(?!\S)/.test(attrs['class'] ?? '')) return ielem('attribute', 'Invalid HTML attribute', context);
|
|
6725
6760
|
if (as.at(-1) !== '>') return ielem('tag', `Missing the closing symbol ">"`, context);
|
|
6726
6761
|
return (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
|
|
@@ -6733,6 +6768,7 @@ function ielem(type, message, context) {
|
|
|
6733
6768
|
}
|
|
6734
6769
|
const requiredAttributes = (0, memoize_1.memoize)(spec => Object.entries(spec).flatMap(([k, v]) => v && Object.isFrozen(v) ? [k] : []), new WeakMap());
|
|
6735
6770
|
function attributes(syntax, spec, params) {
|
|
6771
|
+
const remains = [];
|
|
6736
6772
|
let invalidation = false;
|
|
6737
6773
|
const attrs = {};
|
|
6738
6774
|
for (let i = 0; i < params.length; ++i) {
|
|
@@ -6741,16 +6777,23 @@ function attributes(syntax, spec, params) {
|
|
|
6741
6777
|
const name = param.split('=', 1)[0];
|
|
6742
6778
|
const value = param !== name ? param.slice(name.length + 2, -1).replace(/\\(.?)/g, '$1') : undefined;
|
|
6743
6779
|
invalidation ||= name === '' || !spec || name in attrs;
|
|
6744
|
-
if (name === ''
|
|
6745
|
-
spec
|
|
6746
|
-
|
|
6780
|
+
if (name === '') continue;
|
|
6781
|
+
if (spec && name in spec && !spec[name]) {
|
|
6782
|
+
remains.push(params[i]);
|
|
6783
|
+
continue;
|
|
6784
|
+
}
|
|
6785
|
+
if (spec?.[name]?.includes(value) || spec?.[name]?.length === 0 && value !== undefined) {
|
|
6786
|
+
attrs[name] = value ?? '';
|
|
6787
|
+
} else {
|
|
6788
|
+
invalidation ||= !!spec;
|
|
6789
|
+
}
|
|
6747
6790
|
}
|
|
6748
6791
|
invalidation ||= !!spec && !requiredAttributes(spec).every(name => name in attrs);
|
|
6749
6792
|
if (invalidation) {
|
|
6750
6793
|
attrs['class'] = 'invalid';
|
|
6751
6794
|
Object.assign(attrs, (0, util_1.invalid)(syntax, 'argument', 'Invalid argument'));
|
|
6752
6795
|
}
|
|
6753
|
-
return attrs;
|
|
6796
|
+
return [attrs, remains];
|
|
6754
6797
|
}
|
|
6755
6798
|
exports.attributes = attributes;
|
|
6756
6799
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
@@ -6910,7 +6953,7 @@ function parse(content, params, context) {
|
|
|
6910
6953
|
uri = new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
6911
6954
|
} catch {}
|
|
6912
6955
|
const el = elem(INSECURE_URI, content, uri, context.host?.origin || location.origin);
|
|
6913
|
-
return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params));
|
|
6956
|
+
return el.classList.contains('invalid') ? el : (0, dom_1.define)(el, (0, html_1.attributes)('link', optspec, params)[0]);
|
|
6914
6957
|
}
|
|
6915
6958
|
function elem(INSECURE_URI, content, uri, origin) {
|
|
6916
6959
|
let type;
|
|
@@ -7044,7 +7087,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7044
7087
|
const util_1 = __webpack_require__(4992);
|
|
7045
7088
|
const dom_1 = __webpack_require__(394);
|
|
7046
7089
|
const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
|
|
7047
|
-
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(
|
|
7090
|
+
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, undefined, undefined, [3 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, undefined, undefined, [3 | 64 /* Backtrack.bracket */])]), ({
|
|
7048
7091
|
context: {
|
|
7049
7092
|
source,
|
|
7050
7093
|
caches: {
|
|
@@ -7118,7 +7161,8 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7118
7161
|
});
|
|
7119
7162
|
el.setAttribute('alt', text);
|
|
7120
7163
|
if (!sanitize(el, uri)) return [[el]];
|
|
7121
|
-
|
|
7164
|
+
const [attrs, linkparams] = (0, html_1.attributes)('media', optspec, params);
|
|
7165
|
+
(0, dom_1.define)(el, attrs);
|
|
7122
7166
|
// Awaiting the generic support for attr().
|
|
7123
7167
|
if (el.hasAttribute('aspect-ratio')) {
|
|
7124
7168
|
el.style.aspectRatio = el.getAttribute('aspect-ratio');
|
|
@@ -7136,7 +7180,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7136
7180
|
class: null,
|
|
7137
7181
|
target: '_blank'
|
|
7138
7182
|
}, [el])];
|
|
7139
|
-
})((0, parser_1.subinput)(`{ ${INSECURE_URI}${
|
|
7183
|
+
})((0, parser_1.subinput)(`{ ${INSECURE_URI}${linkparams.join('')} }`, context));
|
|
7140
7184
|
})))));
|
|
7141
7185
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */])])));
|
|
7142
7186
|
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/[^\S\n]+/y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[^\S\n]|})/y), false, ([[a], [b], [c]]) => [b === 'x' ? [`width="${a}"`, `height="${c}"`] : [`aspect-ratio="${a}/${c}"`]]), link_1.option]));
|
|
@@ -7307,7 +7351,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7307
7351
|
const util_1 = __webpack_require__(4992);
|
|
7308
7352
|
const array_1 = __webpack_require__(6876);
|
|
7309
7353
|
const dom_1 = __webpack_require__(394);
|
|
7310
|
-
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(
|
|
7354
|
+
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /\s%\]/y, [[/\s%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = [], cs]) => [[(0, dom_1.html)('span', {
|
|
7311
7355
|
class: 'remark'
|
|
7312
7356
|
}, [(0, dom_1.html)('input', {
|
|
7313
7357
|
type: 'checkbox'
|
|
@@ -7472,7 +7516,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
|
|
|
7472
7516
|
class: 'invalid',
|
|
7473
7517
|
...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
|
|
7474
7518
|
}, context.source.slice(context.position - context.range, context.position))]], [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */]));
|
|
7475
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource,
|
|
7519
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[]], [3 | 4 /* Backtrack.escbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], context) => context.linebreak === 0 ? [(0, array_1.push)((0, array_1.unshift)(as, bs), cs)] : (context.position -= 1, [(0, array_1.unshift)(as, bs)]), ([as, bs]) => bs && [(0, array_1.unshift)(as, bs)], [3 | 4 /* Backtrack.escbracket */])]));
|
|
7476
7520
|
|
|
7477
7521
|
/***/ },
|
|
7478
7522
|
|
|
@@ -7810,19 +7854,19 @@ const parser = (0, combinator_1.union)([input => {
|
|
|
7810
7854
|
}
|
|
7811
7855
|
} = input;
|
|
7812
7856
|
if (position === source.length) return;
|
|
7813
|
-
switch (source.slice(position, position + 3)) {
|
|
7814
|
-
case '~~~':
|
|
7815
|
-
return (0, extension_1.segment)(input);
|
|
7816
|
-
case '```':
|
|
7817
|
-
return (0, codeblock_1.segment)(input);
|
|
7818
|
-
}
|
|
7819
|
-
switch (source.slice(position, position + 2)) {
|
|
7820
|
-
case '$$':
|
|
7821
|
-
return (0, mathblock_1.segment)(input);
|
|
7822
|
-
case '[$':
|
|
7823
|
-
return (0, extension_1.segment)(input);
|
|
7824
|
-
}
|
|
7825
7857
|
switch (source[position]) {
|
|
7858
|
+
case '`':
|
|
7859
|
+
if (source.startsWith('```', position)) return (0, codeblock_1.segment)(input);
|
|
7860
|
+
break;
|
|
7861
|
+
case '~':
|
|
7862
|
+
if (source.startsWith('~~~', position)) return (0, extension_1.segment)(input);
|
|
7863
|
+
break;
|
|
7864
|
+
case '$':
|
|
7865
|
+
if (source[position + 1] === '$') return (0, mathblock_1.segment)(input);
|
|
7866
|
+
break;
|
|
7867
|
+
case '[':
|
|
7868
|
+
if (source[position + 1] === '$') return (0, extension_1.segment)(input);
|
|
7869
|
+
break;
|
|
7826
7870
|
case '#':
|
|
7827
7871
|
return (0, heading_1.segment)(input);
|
|
7828
7872
|
case '$':
|
|
@@ -7949,8 +7993,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7949
7993
|
exports.escsource = void 0;
|
|
7950
7994
|
const combinator_1 = __webpack_require__(3484);
|
|
7951
7995
|
const text_1 = __webpack_require__(5655);
|
|
7952
|
-
const unescapable_1 = __webpack_require__(8407);
|
|
7953
7996
|
const dom_1 = __webpack_require__(394);
|
|
7997
|
+
const delimiter = /(?=[\\$"`\[\](){}\r\n]|\s(?:\$)|:\/\/)/g;
|
|
7954
7998
|
const escsource = ({
|
|
7955
7999
|
context
|
|
7956
8000
|
}) => {
|
|
@@ -7988,7 +8032,7 @@ const escsource = ({
|
|
|
7988
8032
|
if (context.sequential) return [[char]];
|
|
7989
8033
|
text_1.nonWhitespace.lastIndex = position + 1;
|
|
7990
8034
|
const b = (0, text_1.isBlank)(source, position);
|
|
7991
|
-
let i = b ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position,
|
|
8035
|
+
let i = b ? source[position + 1] === '\n' ? position + 1 : text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, delimiter);
|
|
7992
8036
|
i -= position;
|
|
7993
8037
|
(0, combinator_1.consume)(i - 1, context);
|
|
7994
8038
|
context.position += i - 1;
|
|
@@ -8101,10 +8145,10 @@ exports.strs = strs;
|
|
|
8101
8145
|
Object.defineProperty(exports, "__esModule", ({
|
|
8102
8146
|
value: true
|
|
8103
8147
|
}));
|
|
8104
|
-
exports.
|
|
8148
|
+
exports.isWhitespace = exports.isBlank = exports.backToEmailHead = exports.backToUrlHead = exports.next = exports.linebreak = exports.txt = exports.text = exports.nonWhitespace = void 0;
|
|
8105
8149
|
const combinator_1 = __webpack_require__(3484);
|
|
8106
8150
|
const dom_1 = __webpack_require__(394);
|
|
8107
|
-
|
|
8151
|
+
//const delimiter = /(?=[\\!@#$&"`\[\](){}<>()[]{}*%|\r\n]|([+~=])\1|\/{3}|\s(?:\\?(?:$|\s)|[$%])|:\/\/)/g;
|
|
8108
8152
|
exports.nonWhitespace = /[\S\r\n]/g;
|
|
8109
8153
|
const text = input => {
|
|
8110
8154
|
const {
|
|
@@ -8141,7 +8185,7 @@ const text = input => {
|
|
|
8141
8185
|
if (context.sequential) return [[char]];
|
|
8142
8186
|
exports.nonWhitespace.lastIndex = position + 1;
|
|
8143
8187
|
const b = isBlank(source, position);
|
|
8144
|
-
let i = b ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position
|
|
8188
|
+
let i = b ? source[position + 1] === '\n' ? position + 1 : exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
|
|
8145
8189
|
const lineend = false || b && i === source.length || b && source[i] === '\n' || b && source[i] === '\\' && source[i + 1] === '\n';
|
|
8146
8190
|
i -= position;
|
|
8147
8191
|
i = lineend ? i : i - +b || 1;
|
|
@@ -8157,9 +8201,14 @@ exports.text = text;
|
|
|
8157
8201
|
exports.txt = (0, combinator_1.union)([exports.text]);
|
|
8158
8202
|
exports.linebreak = (0, combinator_1.focus)(/[\r\n]/y, (0, combinator_1.union)([exports.text]));
|
|
8159
8203
|
function next(source, position, delimiter) {
|
|
8160
|
-
|
|
8161
|
-
delimiter
|
|
8162
|
-
|
|
8204
|
+
let index;
|
|
8205
|
+
if (delimiter) {
|
|
8206
|
+
delimiter.lastIndex = position + 1;
|
|
8207
|
+
delimiter.test(source);
|
|
8208
|
+
index = delimiter.lastIndex;
|
|
8209
|
+
} else {
|
|
8210
|
+
index = seek(source, position);
|
|
8211
|
+
}
|
|
8163
8212
|
if (index === 0) return source.length;
|
|
8164
8213
|
const char = source[index];
|
|
8165
8214
|
switch (char) {
|
|
@@ -8170,16 +8219,6 @@ function next(source, position, delimiter) {
|
|
|
8170
8219
|
index = backToEmailHead(source, position, index);
|
|
8171
8220
|
break;
|
|
8172
8221
|
}
|
|
8173
|
-
if (index > position + 1) switch (char) {
|
|
8174
|
-
case '*':
|
|
8175
|
-
case '+':
|
|
8176
|
-
case '~':
|
|
8177
|
-
case '=':
|
|
8178
|
-
case '/':
|
|
8179
|
-
case '%':
|
|
8180
|
-
case '|':
|
|
8181
|
-
index -= /\s/.test(source[index - 1]) ? 1 : 0;
|
|
8182
|
-
}
|
|
8183
8222
|
return index;
|
|
8184
8223
|
}
|
|
8185
8224
|
exports.next = next;
|
|
@@ -8240,17 +8279,157 @@ function backToEmailHead(source, position, index) {
|
|
|
8240
8279
|
return index + offset;
|
|
8241
8280
|
}
|
|
8242
8281
|
exports.backToEmailHead = backToEmailHead;
|
|
8282
|
+
function isAlphanumeric(char) {
|
|
8283
|
+
if (char < '0' || '\x7F' < char) return false;
|
|
8284
|
+
return '0' <= char && char <= '9' || 'a' <= char && char <= 'z' || 'A' <= char && char <= 'Z';
|
|
8285
|
+
}
|
|
8286
|
+
//const dict = new class {
|
|
8287
|
+
// constructor() {
|
|
8288
|
+
// [
|
|
8289
|
+
// '\\',
|
|
8290
|
+
// '!',
|
|
8291
|
+
// '@',
|
|
8292
|
+
// '#',
|
|
8293
|
+
// '$',
|
|
8294
|
+
// '&',
|
|
8295
|
+
// '"',
|
|
8296
|
+
// '`',
|
|
8297
|
+
// '[',
|
|
8298
|
+
// ']',
|
|
8299
|
+
// '(',
|
|
8300
|
+
// ')',
|
|
8301
|
+
// '{',
|
|
8302
|
+
// '}',
|
|
8303
|
+
// '<',
|
|
8304
|
+
// '>',
|
|
8305
|
+
// '(',
|
|
8306
|
+
// ')',
|
|
8307
|
+
// '[',
|
|
8308
|
+
// ']',
|
|
8309
|
+
// '{',
|
|
8310
|
+
// '}',
|
|
8311
|
+
// '*',
|
|
8312
|
+
// '%',
|
|
8313
|
+
// '|',
|
|
8314
|
+
// '\r',
|
|
8315
|
+
// '\n',
|
|
8316
|
+
// ].forEach(c =>
|
|
8317
|
+
// this[c.charCodeAt(0)] = undefined);
|
|
8318
|
+
// }
|
|
8319
|
+
//};
|
|
8320
|
+
const delimiter = /\s(?:\\?(?:$|\s)|[$%])/y;
|
|
8321
|
+
function seek(source, position) {
|
|
8322
|
+
for (let i = position + 1; i < source.length; ++i) {
|
|
8323
|
+
const fst = source[i];
|
|
8324
|
+
//if (fst.charCodeAt(0) in dict) return i;
|
|
8325
|
+
switch (fst) {
|
|
8326
|
+
case '\\':
|
|
8327
|
+
case '!':
|
|
8328
|
+
case '@':
|
|
8329
|
+
case '#':
|
|
8330
|
+
case '$':
|
|
8331
|
+
case '&':
|
|
8332
|
+
case '"':
|
|
8333
|
+
case '`':
|
|
8334
|
+
case '[':
|
|
8335
|
+
case ']':
|
|
8336
|
+
case '(':
|
|
8337
|
+
case ')':
|
|
8338
|
+
case '{':
|
|
8339
|
+
case '}':
|
|
8340
|
+
case '<':
|
|
8341
|
+
case '>':
|
|
8342
|
+
case '(':
|
|
8343
|
+
case ')':
|
|
8344
|
+
case '[':
|
|
8345
|
+
case ']':
|
|
8346
|
+
case '{':
|
|
8347
|
+
case '}':
|
|
8348
|
+
case '*':
|
|
8349
|
+
case '%':
|
|
8350
|
+
case '|':
|
|
8351
|
+
case '\r':
|
|
8352
|
+
case '\n':
|
|
8353
|
+
return i;
|
|
8354
|
+
case '+':
|
|
8355
|
+
case '~':
|
|
8356
|
+
case '=':
|
|
8357
|
+
if (source[i + 1] === fst) return i;
|
|
8358
|
+
continue;
|
|
8359
|
+
case '/':
|
|
8360
|
+
if (source[i + 1] === fst && source[i + 2] === fst) return i;
|
|
8361
|
+
continue;
|
|
8362
|
+
case ':':
|
|
8363
|
+
if (source[i + 1] === '/' && source[i + 2] === '/') return i;
|
|
8364
|
+
continue;
|
|
8365
|
+
//case ' ':
|
|
8366
|
+
//case '\t':
|
|
8367
|
+
//case ' ':
|
|
8368
|
+
// if (i + 1 === source.length) return i;
|
|
8369
|
+
// switch (source[i + 1]) {
|
|
8370
|
+
// case ' ':
|
|
8371
|
+
// case '\t':
|
|
8372
|
+
// case '\r':
|
|
8373
|
+
// case '\n':
|
|
8374
|
+
// case ' ':
|
|
8375
|
+
// case '$':
|
|
8376
|
+
// case '%':
|
|
8377
|
+
// return i;
|
|
8378
|
+
// case '\\':
|
|
8379
|
+
// if (i + 2 === source.length) return i;
|
|
8380
|
+
// switch (source[i + 2]) {
|
|
8381
|
+
// case ' ':
|
|
8382
|
+
// case '\t':
|
|
8383
|
+
// case '\r':
|
|
8384
|
+
// case '\n':
|
|
8385
|
+
// case ' ':
|
|
8386
|
+
// return i;
|
|
8387
|
+
// }
|
|
8388
|
+
// }
|
|
8389
|
+
// continue;
|
|
8390
|
+
default:
|
|
8391
|
+
delimiter.lastIndex = i;
|
|
8392
|
+
if (delimiter.test(source)) return i;
|
|
8393
|
+
continue;
|
|
8394
|
+
}
|
|
8395
|
+
}
|
|
8396
|
+
return source.length;
|
|
8397
|
+
}
|
|
8243
8398
|
const blank = /\s(?:$|\s|\\\n)/y;
|
|
8244
8399
|
function isBlank(source, position) {
|
|
8245
8400
|
blank.lastIndex = position;
|
|
8246
8401
|
return blank.test(source);
|
|
8402
|
+
// removed by dead control flow
|
|
8403
|
+
|
|
8404
|
+
// removed by dead control flow
|
|
8405
|
+
|
|
8406
|
+
// removed by dead control flow
|
|
8407
|
+
|
|
8408
|
+
// removed by dead control flow
|
|
8409
|
+
|
|
8410
|
+
// removed by dead control flow
|
|
8411
|
+
|
|
8412
|
+
// removed by dead control flow
|
|
8413
|
+
|
|
8414
|
+
// removed by dead control flow
|
|
8415
|
+
|
|
8247
8416
|
}
|
|
8248
8417
|
exports.isBlank = isBlank;
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8418
|
+
const whitespace = /\s/;
|
|
8419
|
+
function isWhitespace(char) {
|
|
8420
|
+
whitespace;
|
|
8421
|
+
switch (char) {
|
|
8422
|
+
case ' ':
|
|
8423
|
+
case '\t':
|
|
8424
|
+
case '\r':
|
|
8425
|
+
case '\n':
|
|
8426
|
+
case ' ':
|
|
8427
|
+
return true;
|
|
8428
|
+
default:
|
|
8429
|
+
return false;
|
|
8430
|
+
}
|
|
8252
8431
|
}
|
|
8253
|
-
exports.
|
|
8432
|
+
exports.isWhitespace = isWhitespace;
|
|
8254
8433
|
|
|
8255
8434
|
/***/ },
|
|
8256
8435
|
|
|
@@ -8294,7 +8473,7 @@ const unescsource = ({
|
|
|
8294
8473
|
if (context.sequential) return [[char]];
|
|
8295
8474
|
text_1.nonWhitespace.lastIndex = position + 1;
|
|
8296
8475
|
const b = (0, text_1.isBlank)(source, position);
|
|
8297
|
-
let i = b ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
|
|
8476
|
+
let i = b ? source[position + 1] === '\n' ? position + 1 : text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
|
|
8298
8477
|
i -= position;
|
|
8299
8478
|
(0, combinator_1.consume)(i - 1, context);
|
|
8300
8479
|
context.position += i - 1;
|