securemark 0.283.7 → 0.285.0
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 +11 -11
- package/dist/index.js +182 -57
- package/markdown.d.ts +26 -17
- package/package.json +1 -1
- package/src/parser/context.ts +4 -4
- package/src/parser/inline/autolink/url.test.ts +1 -1
- package/src/parser/inline/bracket.test.ts +2 -2
- package/src/parser/inline/deletion.ts +15 -14
- package/src/parser/inline/emphasis.ts +2 -2
- package/src/parser/inline/emstrong.test.ts +115 -0
- package/src/parser/inline/emstrong.ts +71 -37
- package/src/parser/inline/extension/index.ts +2 -2
- package/src/parser/inline/extension/label.ts +1 -1
- package/src/parser/inline/extension/placeholder.ts +2 -2
- package/src/parser/inline/html.ts +2 -2
- package/src/parser/inline/insertion.ts +15 -14
- package/src/parser/inline/italic.test.ts +72 -0
- package/src/parser/inline/italic.ts +22 -0
- package/src/parser/inline/link.ts +1 -1
- package/src/parser/inline/mark.ts +22 -21
- package/src/parser/inline/math.ts +1 -1
- package/src/parser/inline/ruby.ts +6 -4
- package/src/parser/inline/strong.ts +2 -2
- package/src/parser/inline/template.ts +1 -1
- package/src/parser/inline.test.ts +12 -38
- package/src/parser/inline.ts +8 -4
- package/src/parser/source/text.ts +0 -3
- package/src/parser/util.ts +66 -1
- package/src/parser/visibility.ts +22 -19
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ Secure markdown renderer working on browsers for user input data.
|
|
|
47
47
|
- Blockquote (>, !>)
|
|
48
48
|
- Preformattedtext (```)
|
|
49
49
|
- Pagebreak (===)
|
|
50
|
-
- Inline markups (*, **, `, []{}, {}, ![]{}, !{}, \[](), ++, ~~, (()), ...)
|
|
50
|
+
- Inline markups (*, **, ///, `, []{}, {}, ![]{}, !{}, \[](), ++, ~~, (()), ...)
|
|
51
51
|
- Inline HTML tags (\<bdi>, \<bdo>)
|
|
52
52
|
- Autolink (https://host, user@host, @user)
|
|
53
53
|
- Shortmedia (!https://host/image.png, !https://youtu.be/...)
|
|
@@ -65,16 +65,16 @@ Secure markdown renderer working on browsers for user input data.
|
|
|
65
65
|
|
|
66
66
|
## Operator precedence
|
|
67
67
|
|
|
68
|
-
|P| Operators
|
|
69
|
-
|
|
70
|
-
|9| \n, \\\n
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
68
|
+
|P| Operators |
|
|
69
|
+
|-|------------------------------|
|
|
70
|
+
|9| \n, \\\n |
|
|
71
|
+
|6| ` |
|
|
72
|
+
|5| ${}$ |
|
|
73
|
+
|4| [% %] |
|
|
74
|
+
|3| \<tag>\</tag> |
|
|
75
|
+
|2| $, " |
|
|
76
|
+
|1| (), [], {}, (()), [[]], {{}} |
|
|
77
|
+
|0| *, **, ///, ==, ++, ~~ |
|
|
78
78
|
|
|
79
79
|
## Dependencies
|
|
80
80
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.285.0 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"));
|
|
@@ -500,26 +500,59 @@ const strong_1 = __webpack_require__(6591);
|
|
|
500
500
|
const emphasis_1 = __webpack_require__(1354);
|
|
501
501
|
const source_1 = __webpack_require__(8745);
|
|
502
502
|
const visibility_1 = __webpack_require__(6364);
|
|
503
|
+
const util_1 = __webpack_require__(4992);
|
|
503
504
|
const dom_1 = __webpack_require__(394);
|
|
504
505
|
const array_1 = __webpack_require__(6876);
|
|
505
506
|
const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong]))])));
|
|
506
507
|
const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
|
|
507
|
-
|
|
508
|
+
// 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず早く閉じるよう解析しなければならない。
|
|
509
|
+
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
510
|
+
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.validate)('***', (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)]))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
|
|
508
511
|
switch (cs[0]) {
|
|
509
512
|
case '***':
|
|
510
|
-
return [
|
|
513
|
+
return [bs, rest];
|
|
511
514
|
case '**':
|
|
512
|
-
return (0, combinator_1.bind)(subemphasis, (ds, rest) => rest.slice(0, 1) === '*' ? [[(0, dom_1.html)('em', (0, array_1.unshift)([(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(1)] : [(0, array_1.unshift)(['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], ds), rest])({
|
|
515
|
+
return (0, combinator_1.bind)(subemphasis, (ds, rest) => rest.slice(0, 1) === '*' ? [[(0, dom_1.html)('em', (0, array_1.unshift)([(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds))), "\u001F" /* Command.Separator */], rest.slice(1)] : [(0, array_1.push)((0, array_1.unshift)(['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], ds), ["\u001F" /* Command.Separator */]), rest])({
|
|
513
516
|
source: rest,
|
|
514
517
|
context
|
|
515
|
-
}) ?? [['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest];
|
|
518
|
+
}) ?? [['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs)), "\u001F" /* Command.Separator */], rest];
|
|
516
519
|
case '*':
|
|
517
|
-
return (0, combinator_1.bind)(substrong, (ds, rest) => rest.slice(0, 2) === '**' ? [[(0, dom_1.html)('strong', (0, array_1.unshift)([(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds)))], rest.slice(2)] : [(0, array_1.unshift)(['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], ds), rest])({
|
|
520
|
+
return (0, combinator_1.bind)(substrong, (ds, rest) => rest.slice(0, 2) === '**' ? [[(0, dom_1.html)('strong', (0, array_1.unshift)([(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], (0, dom_1.defrag)(ds))), "\u001F" /* Command.Separator */], rest.slice(2)] : [(0, array_1.push)((0, array_1.unshift)(['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], ds), ["\u001F" /* Command.Separator */]), rest])({
|
|
518
521
|
source: rest,
|
|
519
522
|
context
|
|
520
|
-
}) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest];
|
|
523
|
+
}) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs)), "\u001F" /* Command.Separator */], rest];
|
|
524
|
+
}
|
|
525
|
+
}, ([as, bs], rest) => [(0, array_1.push)((0, array_1.unshift)(as, bs), ["\u001B" /* Command.Escape */]), rest]),
|
|
526
|
+
// 3以上の`*`に対してemの適用を保証する
|
|
527
|
+
nodes => [(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(nodes))])], (acc, rest, prefix, postfix, state) => {
|
|
528
|
+
const nodes = [];
|
|
529
|
+
let i = postfix;
|
|
530
|
+
if (state) while (i > 0) {
|
|
531
|
+
switch (i) {
|
|
532
|
+
case 1:
|
|
533
|
+
acc = [[(0, dom_1.html)('em', acc.flat())]];
|
|
534
|
+
i -= 1;
|
|
535
|
+
break;
|
|
536
|
+
case 2:
|
|
537
|
+
acc = [[(0, dom_1.html)('strong', acc.flat())]];
|
|
538
|
+
i -= 2;
|
|
539
|
+
break;
|
|
540
|
+
default:
|
|
541
|
+
acc = [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', acc.flat())])]];
|
|
542
|
+
i -= 3;
|
|
543
|
+
}
|
|
521
544
|
}
|
|
522
|
-
|
|
545
|
+
if (prefix > postfix) {
|
|
546
|
+
nodes.push('*'.repeat(prefix - postfix));
|
|
547
|
+
}
|
|
548
|
+
for (let i = 0; i < acc.length; ++i) {
|
|
549
|
+
nodes.push(...acc[i]);
|
|
550
|
+
}
|
|
551
|
+
if (postfix > 0) {
|
|
552
|
+
rest = rest.slice(postfix);
|
|
553
|
+
}
|
|
554
|
+
return [nodes, rest];
|
|
555
|
+
})))));
|
|
523
556
|
|
|
524
557
|
/***/ },
|
|
525
558
|
|
|
@@ -1488,7 +1521,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
1488
1521
|
const visibility_1 = __webpack_require__(6364);
|
|
1489
1522
|
const array_1 = __webpack_require__(6876);
|
|
1490
1523
|
const dom_1 = __webpack_require__(394);
|
|
1491
|
-
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.surround)((0, source_1.str)('*', '*'), (0, combinator_1.precedence)(0, (0, visibility_1.
|
|
1524
|
+
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.surround)((0, source_1.str)('*', '*'), (0, combinator_1.precedence)(0, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])))), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
|
|
1492
1525
|
|
|
1493
1526
|
/***/ },
|
|
1494
1527
|
|
|
@@ -1966,7 +1999,7 @@ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://'
|
|
|
1966
1999
|
exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.focus)(/^!?https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, false, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink))), ({
|
|
1967
2000
|
source
|
|
1968
2001
|
}) => [[source], '']])]))));
|
|
1969
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(0, 6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), (0, source_1.str)(')'), true, undefined, undefined, 3 |
|
|
2002
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(0, 6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), (0, source_1.str)(')'), true, undefined, undefined, 3 | 4 /* Backtrack.url */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), (0, source_1.str)(']'), true, undefined, undefined, 3 | 4 /* Backtrack.url */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), (0, source_1.str)('}'), true, undefined, undefined, 3 | 4 /* Backtrack.url */), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)(source_1.unescsource, '"')), (0, source_1.str)('"'), true, undefined, undefined, 3 | 4 /* Backtrack.url */)])));
|
|
1970
2003
|
|
|
1971
2004
|
/***/ },
|
|
1972
2005
|
|
|
@@ -2426,7 +2459,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0,
|
|
|
2426
2459
|
'data-invalid-type': 'content',
|
|
2427
2460
|
'data-invalid-message': `"${source.match(forbiddenCommand)[0]}" command is forbidden`
|
|
2428
2461
|
}, source)], '']))));
|
|
2429
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(0, 6 /* Recursion.terminal */, (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /^
|
|
2462
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(0, 6 /* Recursion.terminal */, (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /^[{}$\n]/)])), (0, source_1.str)('}'), true)));
|
|
2430
2463
|
|
|
2431
2464
|
/***/ },
|
|
2432
2465
|
|
|
@@ -3234,7 +3267,7 @@ const optspec = {
|
|
|
3234
3267
|
rel: ['nofollow']
|
|
3235
3268
|
};
|
|
3236
3269
|
Object.setPrototypeOf(optspec, null);
|
|
3237
|
-
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, false, (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [['\n', 9], [']', 1]])), ']', true, undefined, undefined, 1 |
|
|
3270
|
+
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, false, (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [['\n', 9], [']', 1]])), ']', true, undefined, undefined, 1 | 8 /* Backtrack.bracket */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/, false, undefined, undefined, 3 | 20 /* Backtrack.link */))])), ([params, content = []], rest, context) => {
|
|
3238
3271
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
3239
3272
|
return [[parse((0, dom_1.defrag)(content), params, context)], rest];
|
|
3240
3273
|
}))))));
|
|
@@ -3917,6 +3950,28 @@ MultiHeap.min = Heap.min;
|
|
|
3917
3950
|
|
|
3918
3951
|
/***/ },
|
|
3919
3952
|
|
|
3953
|
+
/***/ 3744
|
|
3954
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3955
|
+
|
|
3956
|
+
"use strict";
|
|
3957
|
+
|
|
3958
|
+
|
|
3959
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
3960
|
+
value: true
|
|
3961
|
+
}));
|
|
3962
|
+
exports.italic = void 0;
|
|
3963
|
+
const combinator_1 = __webpack_require__(3484);
|
|
3964
|
+
const inline_1 = __webpack_require__(7973);
|
|
3965
|
+
const visibility_1 = __webpack_require__(6364);
|
|
3966
|
+
const util_1 = __webpack_require__(4992);
|
|
3967
|
+
const array_1 = __webpack_require__(6876);
|
|
3968
|
+
const dom_1 = __webpack_require__(394);
|
|
3969
|
+
// 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
|
|
3970
|
+
// ある程度の長さのある文に使うのが望ましい。
|
|
3971
|
+
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.validate)('///', (0, combinator_1.precedence)(0, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('///')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '/'), exports.italic)]))), '///', false, ([, bs], rest) => [bs, rest], ([, bs], rest) => [(0, array_1.push)(bs, ["\u001B" /* Command.Escape */]), rest]), nodes => [(0, dom_1.html)('i', (0, dom_1.defrag)(nodes))])))));
|
|
3972
|
+
|
|
3973
|
+
/***/ },
|
|
3974
|
+
|
|
3920
3975
|
/***/ 3770
|
|
3921
3976
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
3922
3977
|
|
|
@@ -4288,7 +4343,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
4288
4343
|
const dom_1 = __webpack_require__(394);
|
|
4289
4344
|
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, false, (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 4 /* State.media */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [['\n', 9], [')', 1]])))), '))', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', {
|
|
4290
4345
|
class: 'annotation'
|
|
4291
|
-
}, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, 1 |
|
|
4346
|
+
}, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, 1 | 8 /* Backtrack.bracket */))));
|
|
4292
4347
|
|
|
4293
4348
|
/***/ },
|
|
4294
4349
|
|
|
@@ -4959,7 +5014,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
4959
5014
|
exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('{{', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
|
|
4960
5015
|
class: 'template'
|
|
4961
5016
|
}, `{{${ns.join('')}}}`)], rest], undefined, 3 | 28 /* Backtrack.template */)));
|
|
4962
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(0, 6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)(source_1.escsource, /^"
|
|
5017
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(0, 6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)(source_1.escsource, /^["\n]/)), (0, source_1.str)('"'), true, undefined, undefined, 3 | 28 /* Backtrack.template */)])));
|
|
4963
5018
|
|
|
4964
5019
|
/***/ },
|
|
4965
5020
|
|
|
@@ -4975,11 +5030,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4975
5030
|
exports.insertion = void 0;
|
|
4976
5031
|
const combinator_1 = __webpack_require__(3484);
|
|
4977
5032
|
const inline_1 = __webpack_require__(7973);
|
|
4978
|
-
const source_1 = __webpack_require__(8745);
|
|
4979
5033
|
const visibility_1 = __webpack_require__(6364);
|
|
5034
|
+
const util_1 = __webpack_require__(4992);
|
|
4980
5035
|
const array_1 = __webpack_require__(6876);
|
|
4981
5036
|
const dom_1 = __webpack_require__(394);
|
|
4982
|
-
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.
|
|
5037
|
+
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.validate)('++', (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(exports.insertion, '+'), true)])), '++', false, ([, bs], rest) => [bs, rest], ([, bs], rest) => [(0, array_1.push)(bs, ["\u001B" /* Command.Escape */]), rest]), nodes => [(0, dom_1.html)('ins', (0, dom_1.defrag)(nodes))])))));
|
|
4983
5038
|
|
|
4984
5039
|
/***/ },
|
|
4985
5040
|
|
|
@@ -5002,9 +5057,9 @@ const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
|
|
|
5002
5057
|
const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
|
|
5003
5058
|
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, source_1.str)(indexA))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
|
|
5004
5059
|
class: 'paren'
|
|
5005
|
-
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 |
|
|
5060
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 8 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, source_1.str)(indexF))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
|
|
5006
5061
|
class: 'paren'
|
|
5007
|
-
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 |
|
|
5062
|
+
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 8 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 8 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]),
|
|
5008
5063
|
// 改行禁止はバックトラックなしでは内側の構文を破壊するため安易に行えない。
|
|
5009
5064
|
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '"', [['\n', 9], ['"', 2]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('“'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '”', [['\n', 9], ['”', 2]]))), (0, source_1.str)('”'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('‘'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '’', [['\n', 9], ['’', 2]]))), (0, source_1.str)('’'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('「'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '」', [['\n', 9], ['」', 2]]))), (0, source_1.str)('」'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('『'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '』', [['\n', 9], ['』', 2]]))), (0, source_1.str)('』'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
|
|
5010
5065
|
|
|
@@ -5086,9 +5141,9 @@ const indexee_1 = __webpack_require__(7610);
|
|
|
5086
5141
|
const source_1 = __webpack_require__(8745);
|
|
5087
5142
|
const visibility_1 = __webpack_require__(6364);
|
|
5088
5143
|
const dom_1 = __webpack_require__(394);
|
|
5089
|
-
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, false, (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, visibility_1.
|
|
5144
|
+
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, false, (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [['\n', 9], [']', 1]])))), ']', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('a', {
|
|
5090
5145
|
'data-index': dataindex(ns)
|
|
5091
|
-
}, (0, dom_1.defrag)(ns))], rest] : undefined, undefined, 1 |
|
|
5146
|
+
}, (0, dom_1.defrag)(ns))], rest] : undefined, undefined, 1 | 8 /* Backtrack.bracket */)), ([el]) => [(0, dom_1.define)(el, {
|
|
5092
5147
|
id: el.id ? null : undefined,
|
|
5093
5148
|
class: 'index',
|
|
5094
5149
|
href: el.id ? `#${el.id}` : undefined
|
|
@@ -5203,13 +5258,80 @@ exports.mathblock = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0,
|
|
|
5203
5258
|
Object.defineProperty(exports, "__esModule", ({
|
|
5204
5259
|
value: true
|
|
5205
5260
|
}));
|
|
5206
|
-
exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.lineable = void 0;
|
|
5261
|
+
exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.repeat = exports.lineable = void 0;
|
|
5262
|
+
const alias_1 = __webpack_require__(5413);
|
|
5263
|
+
const parser_1 = __webpack_require__(605);
|
|
5207
5264
|
const combinator_1 = __webpack_require__(3484);
|
|
5208
5265
|
const dom_1 = __webpack_require__(394);
|
|
5209
5266
|
function lineable(parser) {
|
|
5210
5267
|
return (0, combinator_1.convert)(source => `\r${source}`, parser);
|
|
5211
5268
|
}
|
|
5212
5269
|
exports.lineable = lineable;
|
|
5270
|
+
function repeat(symbol, parser, cons, termination = (acc, rest, prefix, postfix) => {
|
|
5271
|
+
const nodes = [];
|
|
5272
|
+
if (prefix > 0) {
|
|
5273
|
+
nodes.push(symbol[0].repeat(prefix));
|
|
5274
|
+
}
|
|
5275
|
+
for (let i = 0; i < acc.length; ++i) {
|
|
5276
|
+
nodes.push(...acc[i]);
|
|
5277
|
+
}
|
|
5278
|
+
if (postfix > 0) {
|
|
5279
|
+
nodes.push(rest.slice(0, postfix));
|
|
5280
|
+
rest = rest.slice(postfix);
|
|
5281
|
+
}
|
|
5282
|
+
return [nodes, rest];
|
|
5283
|
+
}) {
|
|
5284
|
+
return input => {
|
|
5285
|
+
const {
|
|
5286
|
+
source,
|
|
5287
|
+
context
|
|
5288
|
+
} = input;
|
|
5289
|
+
let acc = [];
|
|
5290
|
+
let i = symbol.length;
|
|
5291
|
+
while (source[i] === source[0]) ++i;
|
|
5292
|
+
let rest = source.slice(i);
|
|
5293
|
+
let state = false;
|
|
5294
|
+
for (; i >= symbol.length; i -= symbol.length) {
|
|
5295
|
+
if (acc.length > 0 && rest.startsWith(symbol)) {
|
|
5296
|
+
acc = [cons(acc.flat(), context)];
|
|
5297
|
+
rest = rest.slice(symbol.length);
|
|
5298
|
+
continue;
|
|
5299
|
+
}
|
|
5300
|
+
const result = parser({
|
|
5301
|
+
source: rest,
|
|
5302
|
+
context
|
|
5303
|
+
});
|
|
5304
|
+
if (result === undefined) break;
|
|
5305
|
+
const nodes = (0, parser_1.eval)(result);
|
|
5306
|
+
rest = (0, parser_1.exec)(result);
|
|
5307
|
+
acc.push(nodes);
|
|
5308
|
+
switch (nodes.at(-1)) {
|
|
5309
|
+
case "\u001B" /* Command.Escape */:
|
|
5310
|
+
nodes.pop();
|
|
5311
|
+
state = false;
|
|
5312
|
+
break;
|
|
5313
|
+
case "\u001F" /* Command.Separator */:
|
|
5314
|
+
nodes.pop();
|
|
5315
|
+
state = true;
|
|
5316
|
+
continue;
|
|
5317
|
+
default:
|
|
5318
|
+
acc = [cons(acc.flat(), context)];
|
|
5319
|
+
state = true;
|
|
5320
|
+
continue;
|
|
5321
|
+
}
|
|
5322
|
+
break;
|
|
5323
|
+
}
|
|
5324
|
+
if (acc.length === 0) return;
|
|
5325
|
+
const prefix = i;
|
|
5326
|
+
i = 0;
|
|
5327
|
+
for (let len = (0, alias_1.min)(prefix, rest.length); i < len && rest[i] === symbol[0];) {
|
|
5328
|
+
++i;
|
|
5329
|
+
}
|
|
5330
|
+
const postfix = i;
|
|
5331
|
+
return termination(acc, rest, prefix, postfix, state);
|
|
5332
|
+
};
|
|
5333
|
+
}
|
|
5334
|
+
exports.repeat = repeat;
|
|
5213
5335
|
function markInvalid(el, syntax, type, message) {
|
|
5214
5336
|
return (0, dom_1.define)(el, {
|
|
5215
5337
|
class: void el.classList.add('invalid'),
|
|
@@ -5282,7 +5404,7 @@ function elem(tag, as, bs, cs) {
|
|
|
5282
5404
|
if (!tags.includes(tag)) return invalid('tag', `Invalid HTML tag name "${tag}"`, as, bs, cs);
|
|
5283
5405
|
if (cs.length === 0) return invalid('tag', `Missing the closing HTML tag "</${tag}>"`, as, bs, cs);
|
|
5284
5406
|
if (bs.length === 0) return invalid('content', `Missing the content`, as, bs, cs);
|
|
5285
|
-
if (!(0, visibility_1.
|
|
5407
|
+
if (!(0, visibility_1.isLooseNodeStart)(bs)) return invalid('content', `Missing the visible content in the same line`, as, bs, cs);
|
|
5286
5408
|
const attrs = attributes('html', [], attrspecs[tag], as.slice(1, -1));
|
|
5287
5409
|
return 'data-invalid-syntax' in attrs ? invalid('attribute', 'Invalid HTML attribute', as, bs, cs) : (0, dom_1.html)(tag, attrs, (0, dom_1.defrag)(bs));
|
|
5288
5410
|
}
|
|
@@ -5351,20 +5473,21 @@ exports.mark = void 0;
|
|
|
5351
5473
|
const combinator_1 = __webpack_require__(3484);
|
|
5352
5474
|
const inline_1 = __webpack_require__(7973);
|
|
5353
5475
|
const indexee_1 = __webpack_require__(7610);
|
|
5354
|
-
const source_1 = __webpack_require__(8745);
|
|
5355
5476
|
const visibility_1 = __webpack_require__(6364);
|
|
5477
|
+
const util_1 = __webpack_require__(4992);
|
|
5356
5478
|
const array_1 = __webpack_require__(6876);
|
|
5357
5479
|
const dom_1 = __webpack_require__(394);
|
|
5358
|
-
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(2 /* State.mark */, false, (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.
|
|
5480
|
+
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(2 /* State.mark */, false, (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.validate)('==', (0, combinator_1.precedence)(0, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)]))), '==', false, ([, bs], rest) => [bs, rest], ([, bs], rest) => [(0, array_1.push)(bs, ["\u001B" /* Command.Escape */]), rest]), (nodes, {
|
|
5359
5481
|
id
|
|
5360
5482
|
}) => {
|
|
5361
|
-
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(
|
|
5362
|
-
|
|
5483
|
+
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(nodes));
|
|
5484
|
+
(0, dom_1.define)(el, {
|
|
5363
5485
|
id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
|
|
5364
|
-
})
|
|
5486
|
+
});
|
|
5487
|
+
return el.id ? [el, el.id && (0, dom_1.html)('a', {
|
|
5365
5488
|
href: `#${el.id}`
|
|
5366
|
-
})]
|
|
5367
|
-
}
|
|
5489
|
+
})] : [el];
|
|
5490
|
+
}))))));
|
|
5368
5491
|
|
|
5369
5492
|
/***/ },
|
|
5370
5493
|
|
|
@@ -5435,9 +5558,6 @@ exports.text = (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, ({
|
|
|
5435
5558
|
case '\n':
|
|
5436
5559
|
return [[(0, dom_1.html)('br')], source.slice(1)];
|
|
5437
5560
|
case '*':
|
|
5438
|
-
case '+':
|
|
5439
|
-
case '~':
|
|
5440
|
-
case '=':
|
|
5441
5561
|
case '`':
|
|
5442
5562
|
return source[1] === source[0] ? repeat({
|
|
5443
5563
|
source,
|
|
@@ -6029,12 +6149,12 @@ const array_1 = __webpack_require__(6876);
|
|
|
6029
6149
|
const dom_1 = __webpack_require__(394);
|
|
6030
6150
|
// Don't use the symbols already used: !#$%@&*+~=|
|
|
6031
6151
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
6032
|
-
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^|]/), (0, combinator_1.precedence)(1, (0, visibility_1.
|
|
6152
|
+
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^|]/), (0, combinator_1.precedence)(1, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]]))), (0, source_1.str)(']'), false, ([, bs], rest) => [[(0, dom_1.html)('span', {
|
|
6033
6153
|
class: 'invalid',
|
|
6034
6154
|
'data-invalid-syntax': 'extension',
|
|
6035
6155
|
'data-invalid-type': 'syntax',
|
|
6036
6156
|
'data-invalid-message': `Invalid start symbol or linebreak`
|
|
6037
|
-
}, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest], 3 |
|
|
6157
|
+
}, (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 8 /* Backtrack.bracket */)));
|
|
6038
6158
|
|
|
6039
6159
|
/***/ },
|
|
6040
6160
|
|
|
@@ -6152,7 +6272,7 @@ __exportStar(__webpack_require__(1311), exports);
|
|
|
6152
6272
|
Object.defineProperty(exports, "__esModule", ({
|
|
6153
6273
|
value: true
|
|
6154
6274
|
}));
|
|
6155
|
-
exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.
|
|
6275
|
+
exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isTightNodeStart = exports.isLooseNodeStart = exports.tightStart = exports.blankWith = exports.visualize = exports.blank = void 0;
|
|
6156
6276
|
const parser_1 = __webpack_require__(605);
|
|
6157
6277
|
const combinator_1 = __webpack_require__(3484);
|
|
6158
6278
|
const htmlentity_1 = __webpack_require__(470);
|
|
@@ -6182,16 +6302,18 @@ function hasVisible(nodes) {
|
|
|
6182
6302
|
}
|
|
6183
6303
|
return false;
|
|
6184
6304
|
}
|
|
6185
|
-
function blankWith(
|
|
6186
|
-
if (delimiter === undefined) return blankWith('',
|
|
6187
|
-
return new RegExp(String.raw`^(?:(?=${
|
|
6305
|
+
function blankWith(starts, delimiter) {
|
|
6306
|
+
if (delimiter === undefined) return blankWith('', starts);
|
|
6307
|
+
return new RegExp(String.raw`^(?:(?=${starts})(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr[^\S\n]*>)${
|
|
6308
|
+
// 空行除去
|
|
6309
|
+
starts && '+'})?${typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source}`);
|
|
6188
6310
|
}
|
|
6189
6311
|
exports.blankWith = blankWith;
|
|
6190
|
-
function
|
|
6191
|
-
return input =>
|
|
6312
|
+
function tightStart(parser, except) {
|
|
6313
|
+
return input => isTightStart(input, except) ? parser(input) : undefined;
|
|
6192
6314
|
}
|
|
6193
|
-
exports.
|
|
6194
|
-
const
|
|
6315
|
+
exports.tightStart = tightStart;
|
|
6316
|
+
const isTightStart = (0, memoize_1.reduce)((input, except) => {
|
|
6195
6317
|
const {
|
|
6196
6318
|
source
|
|
6197
6319
|
} = input;
|
|
@@ -6223,7 +6345,7 @@ const isStartTight = (0, memoize_1.reduce)((input, except) => {
|
|
|
6223
6345
|
}, ({
|
|
6224
6346
|
source
|
|
6225
6347
|
}, except = '') => `${source}${"\u001F" /* Command.Separator */}${except}`);
|
|
6226
|
-
function
|
|
6348
|
+
function isLooseNodeStart(nodes) {
|
|
6227
6349
|
if (nodes.length === 0) return true;
|
|
6228
6350
|
for (let i = 0; i < nodes.length; ++i) {
|
|
6229
6351
|
const node = nodes[i];
|
|
@@ -6232,13 +6354,13 @@ function isStartLooseNodes(nodes) {
|
|
|
6232
6354
|
}
|
|
6233
6355
|
return false;
|
|
6234
6356
|
}
|
|
6235
|
-
exports.
|
|
6236
|
-
function
|
|
6357
|
+
exports.isLooseNodeStart = isLooseNodeStart;
|
|
6358
|
+
function isTightNodeStart(nodes) {
|
|
6237
6359
|
if (nodes.length === 0) return true;
|
|
6238
6360
|
return isVisible(nodes[0], 0);
|
|
6239
6361
|
}
|
|
6240
|
-
exports.
|
|
6241
|
-
//export function
|
|
6362
|
+
exports.isTightNodeStart = isTightNodeStart;
|
|
6363
|
+
//export function isTightNodeEnd(nodes: readonly (HTMLElement | string)[]): boolean {
|
|
6242
6364
|
// if (nodes.length === 0) return true;
|
|
6243
6365
|
// return isVisible(nodes.at(-1)!, -1);
|
|
6244
6366
|
//}
|
|
@@ -6393,7 +6515,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6393
6515
|
const visibility_1 = __webpack_require__(6364);
|
|
6394
6516
|
const array_1 = __webpack_require__(6876);
|
|
6395
6517
|
const dom_1 = __webpack_require__(394);
|
|
6396
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.surround)((0, source_1.str)('**', '*'), (0, combinator_1.precedence)(0, (0, visibility_1.
|
|
6518
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.surround)((0, source_1.str)('**', '*'), (0, combinator_1.precedence)(0, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('**')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])))), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest])));
|
|
6397
6519
|
|
|
6398
6520
|
/***/ },
|
|
6399
6521
|
|
|
@@ -6771,11 +6893,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6771
6893
|
exports.deletion = void 0;
|
|
6772
6894
|
const combinator_1 = __webpack_require__(3484);
|
|
6773
6895
|
const inline_1 = __webpack_require__(7973);
|
|
6774
|
-
const source_1 = __webpack_require__(8745);
|
|
6775
6896
|
const visibility_1 = __webpack_require__(6364);
|
|
6897
|
+
const util_1 = __webpack_require__(4992);
|
|
6776
6898
|
const array_1 = __webpack_require__(6876);
|
|
6777
6899
|
const dom_1 = __webpack_require__(394);
|
|
6778
|
-
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.
|
|
6900
|
+
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.validate)('~~', (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(exports.deletion, '~'), true)])), '~~', false, ([, bs], rest) => [bs, rest], ([, bs], rest) => [(0, array_1.push)(bs, ["\u001B" /* Command.Escape */]), rest]), nodes => [(0, dom_1.html)('del', (0, dom_1.defrag)(nodes))])))));
|
|
6779
6901
|
|
|
6780
6902
|
/***/ },
|
|
6781
6903
|
|
|
@@ -6969,14 +7091,14 @@ const source_1 = __webpack_require__(8745);
|
|
|
6969
7091
|
const visibility_1 = __webpack_require__(6364);
|
|
6970
7092
|
const array_1 = __webpack_require__(6876);
|
|
6971
7093
|
const dom_1 = __webpack_require__(394);
|
|
6972
|
-
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.fmap)((0, combinator_1.sequence)([(0, combinator_1.bind)((0, combinator_1.surround)('[', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}"\n])+/), ']', false, undefined, undefined, 3 |
|
|
7094
|
+
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.fmap)((0, combinator_1.sequence)([(0, combinator_1.bind)((0, combinator_1.surround)('[', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}"\n])+/), ']', false, undefined, undefined, 3 | 16 /* Backtrack.ruby */), ([source], rest, context) => {
|
|
6973
7095
|
const ns = (0, parser_1.eval)(text({
|
|
6974
7096
|
source,
|
|
6975
7097
|
context
|
|
6976
7098
|
}), [undefined])[0];
|
|
6977
7099
|
ns && ns.at(-1) === '' && ns.pop();
|
|
6978
|
-
return ns && (0, visibility_1.
|
|
6979
|
-
}), (0, combinator_1.bind)((0, combinator_1.surround)('(', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}"\n])+/), ')', false, undefined, undefined, 3 |
|
|
7100
|
+
return ns && (0, visibility_1.isTightNodeStart)(ns) ? [[ns], rest] : undefined;
|
|
7101
|
+
}), (0, combinator_1.bind)((0, combinator_1.surround)('(', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}"\n])+/), ')', false, undefined, undefined, 3 | 16 /* Backtrack.ruby */), ([source], rest, context) => {
|
|
6980
7102
|
const ns = (0, parser_1.eval)(text({
|
|
6981
7103
|
source,
|
|
6982
7104
|
context
|
|
@@ -7130,7 +7252,7 @@ const optspec = {
|
|
|
7130
7252
|
rel: undefined
|
|
7131
7253
|
};
|
|
7132
7254
|
Object.setPrototypeOf(optspec, null);
|
|
7133
|
-
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [['\n', 9]])), ']', true, undefined, undefined, 1 | 12 /* Backtrack.media */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, 3 |
|
|
7255
|
+
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [['\n', 9]])), ']', true, undefined, undefined, 1 | 12 /* Backtrack.media */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, 3 | 20 /* Backtrack.link */))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
|
|
7134
7256
|
const INSECURE_URI = params.shift();
|
|
7135
7257
|
const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
7136
7258
|
let cache;
|
|
@@ -7665,8 +7787,8 @@ const reference_1 = __webpack_require__(9047);
|
|
|
7665
7787
|
const template_1 = __webpack_require__(4510);
|
|
7666
7788
|
const remark_1 = __webpack_require__(8948);
|
|
7667
7789
|
const extension_1 = __webpack_require__(2743);
|
|
7668
|
-
const ruby_1 = __webpack_require__(7304);
|
|
7669
7790
|
const link_1 = __webpack_require__(3628);
|
|
7791
|
+
const ruby_1 = __webpack_require__(7304);
|
|
7670
7792
|
const html_1 = __webpack_require__(5013);
|
|
7671
7793
|
const insertion_1 = __webpack_require__(4515);
|
|
7672
7794
|
const deletion_1 = __webpack_require__(7066);
|
|
@@ -7674,6 +7796,7 @@ const mark_1 = __webpack_require__(5381);
|
|
|
7674
7796
|
const emstrong_1 = __webpack_require__(365);
|
|
7675
7797
|
const strong_1 = __webpack_require__(6591);
|
|
7676
7798
|
const emphasis_1 = __webpack_require__(1354);
|
|
7799
|
+
const italic_1 = __webpack_require__(3744);
|
|
7677
7800
|
const math_1 = __webpack_require__(2962);
|
|
7678
7801
|
const code_1 = __webpack_require__(3481);
|
|
7679
7802
|
const htmlentity_1 = __webpack_require__(470);
|
|
@@ -7708,10 +7831,12 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
7708
7831
|
return (0, deletion_1.deletion)(input);
|
|
7709
7832
|
case '==':
|
|
7710
7833
|
return (0, mark_1.mark)(input);
|
|
7834
|
+
case '//':
|
|
7835
|
+
return (0, italic_1.italic)(input);
|
|
7711
7836
|
}
|
|
7712
7837
|
switch (source[0]) {
|
|
7713
7838
|
case '[':
|
|
7714
|
-
return (0,
|
|
7839
|
+
return (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input);
|
|
7715
7840
|
case '{':
|
|
7716
7841
|
return (0, link_1.textlink)(input);
|
|
7717
7842
|
case '<':
|
|
@@ -8716,7 +8841,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
8716
8841
|
const source_1 = __webpack_require__(8745);
|
|
8717
8842
|
const visibility_1 = __webpack_require__(6364);
|
|
8718
8843
|
const dom_1 = __webpack_require__(394);
|
|
8719
|
-
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, false, (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('[[', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 4 /* State.media */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [['\n', 9], [']', 1]]))]))), ']]', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, 1 |
|
|
8844
|
+
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, false, (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('[[', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 4 /* State.media */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [['\n', 9], [']', 1]]))]))), ']]', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, 1 | 8 /* Backtrack.bracket */))));
|
|
8720
8845
|
// Chicago-Style
|
|
8721
8846
|
const abbr = (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/)]), /^\|?(?=]])|^\|[^\S\n]*/, true, ([, ns], rest) => ns ? [['\n', ns[0].trimEnd()], rest.replace(visibility_1.blank.start, '')] : [[''], `^${rest}`], ([,, rest]) => [[''], `^${rest}`]));
|
|
8722
8847
|
function attributes(ns) {
|