securemark 0.284.0 → 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 +4 -0
- package/dist/index.js +157 -58
- package/markdown.d.ts +17 -17
- package/package.json +1 -1
- package/src/parser/context.ts +4 -4
- 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 +23 -4
- package/src/parser/inline/italic.ts +16 -15
- package/src/parser/inline/link.ts +1 -1
- package/src/parser/inline/mark.ts +22 -21
- package/src/parser/inline/ruby.ts +6 -4
- package/src/parser/inline/strong.ts +2 -2
- package/src/parser/inline.test.ts +15 -42
- package/src/parser/inline.ts +4 -4
- package/src/parser/source/text.ts +0 -4
- package/src/parser/util.ts +66 -1
- package/src/parser/visibility.ts +22 -19
package/CHANGELOG.md
CHANGED
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
|
+
}
|
|
544
|
+
}
|
|
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]);
|
|
521
550
|
}
|
|
522
|
-
|
|
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
|
|
|
@@ -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
|
}))))));
|
|
@@ -3929,13 +3962,13 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3929
3962
|
exports.italic = void 0;
|
|
3930
3963
|
const combinator_1 = __webpack_require__(3484);
|
|
3931
3964
|
const inline_1 = __webpack_require__(7973);
|
|
3932
|
-
const source_1 = __webpack_require__(8745);
|
|
3933
3965
|
const visibility_1 = __webpack_require__(6364);
|
|
3966
|
+
const util_1 = __webpack_require__(4992);
|
|
3934
3967
|
const array_1 = __webpack_require__(6876);
|
|
3935
3968
|
const dom_1 = __webpack_require__(394);
|
|
3936
3969
|
// 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
|
|
3937
3970
|
// ある程度の長さのある文に使うのが望ましい。
|
|
3938
|
-
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 4 /* Recursion.inline */, (0, combinator_1.
|
|
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))])))));
|
|
3939
3972
|
|
|
3940
3973
|
/***/ },
|
|
3941
3974
|
|
|
@@ -4310,7 +4343,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
4310
4343
|
const dom_1 = __webpack_require__(394);
|
|
4311
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', {
|
|
4312
4345
|
class: 'annotation'
|
|
4313
|
-
}, [(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 */))));
|
|
4314
4347
|
|
|
4315
4348
|
/***/ },
|
|
4316
4349
|
|
|
@@ -4997,11 +5030,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
4997
5030
|
exports.insertion = void 0;
|
|
4998
5031
|
const combinator_1 = __webpack_require__(3484);
|
|
4999
5032
|
const inline_1 = __webpack_require__(7973);
|
|
5000
|
-
const source_1 = __webpack_require__(8745);
|
|
5001
5033
|
const visibility_1 = __webpack_require__(6364);
|
|
5034
|
+
const util_1 = __webpack_require__(4992);
|
|
5002
5035
|
const array_1 = __webpack_require__(6876);
|
|
5003
5036
|
const dom_1 = __webpack_require__(394);
|
|
5004
|
-
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))])))));
|
|
5005
5038
|
|
|
5006
5039
|
/***/ },
|
|
5007
5040
|
|
|
@@ -5024,9 +5057,9 @@ const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
|
|
|
5024
5057
|
const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
|
|
5025
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', {
|
|
5026
5059
|
class: 'paren'
|
|
5027
|
-
}, (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', {
|
|
5028
5061
|
class: 'paren'
|
|
5029
|
-
}, (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]),
|
|
5030
5063
|
// 改行禁止はバックトラックなしでは内側の構文を破壊するため安易に行えない。
|
|
5031
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])]));
|
|
5032
5065
|
|
|
@@ -5108,9 +5141,9 @@ const indexee_1 = __webpack_require__(7610);
|
|
|
5108
5141
|
const source_1 = __webpack_require__(8745);
|
|
5109
5142
|
const visibility_1 = __webpack_require__(6364);
|
|
5110
5143
|
const dom_1 = __webpack_require__(394);
|
|
5111
|
-
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', {
|
|
5112
5145
|
'data-index': dataindex(ns)
|
|
5113
|
-
}, (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, {
|
|
5114
5147
|
id: el.id ? null : undefined,
|
|
5115
5148
|
class: 'index',
|
|
5116
5149
|
href: el.id ? `#${el.id}` : undefined
|
|
@@ -5225,13 +5258,80 @@ exports.mathblock = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0,
|
|
|
5225
5258
|
Object.defineProperty(exports, "__esModule", ({
|
|
5226
5259
|
value: true
|
|
5227
5260
|
}));
|
|
5228
|
-
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);
|
|
5229
5264
|
const combinator_1 = __webpack_require__(3484);
|
|
5230
5265
|
const dom_1 = __webpack_require__(394);
|
|
5231
5266
|
function lineable(parser) {
|
|
5232
5267
|
return (0, combinator_1.convert)(source => `\r${source}`, parser);
|
|
5233
5268
|
}
|
|
5234
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;
|
|
5235
5335
|
function markInvalid(el, syntax, type, message) {
|
|
5236
5336
|
return (0, dom_1.define)(el, {
|
|
5237
5337
|
class: void el.classList.add('invalid'),
|
|
@@ -5304,7 +5404,7 @@ function elem(tag, as, bs, cs) {
|
|
|
5304
5404
|
if (!tags.includes(tag)) return invalid('tag', `Invalid HTML tag name "${tag}"`, as, bs, cs);
|
|
5305
5405
|
if (cs.length === 0) return invalid('tag', `Missing the closing HTML tag "</${tag}>"`, as, bs, cs);
|
|
5306
5406
|
if (bs.length === 0) return invalid('content', `Missing the content`, as, bs, cs);
|
|
5307
|
-
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);
|
|
5308
5408
|
const attrs = attributes('html', [], attrspecs[tag], as.slice(1, -1));
|
|
5309
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));
|
|
5310
5410
|
}
|
|
@@ -5373,20 +5473,21 @@ exports.mark = void 0;
|
|
|
5373
5473
|
const combinator_1 = __webpack_require__(3484);
|
|
5374
5474
|
const inline_1 = __webpack_require__(7973);
|
|
5375
5475
|
const indexee_1 = __webpack_require__(7610);
|
|
5376
|
-
const source_1 = __webpack_require__(8745);
|
|
5377
5476
|
const visibility_1 = __webpack_require__(6364);
|
|
5477
|
+
const util_1 = __webpack_require__(4992);
|
|
5378
5478
|
const array_1 = __webpack_require__(6876);
|
|
5379
5479
|
const dom_1 = __webpack_require__(394);
|
|
5380
|
-
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, {
|
|
5381
5481
|
id
|
|
5382
5482
|
}) => {
|
|
5383
|
-
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(
|
|
5384
|
-
|
|
5483
|
+
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)(nodes));
|
|
5484
|
+
(0, dom_1.define)(el, {
|
|
5385
5485
|
id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
|
|
5386
|
-
})
|
|
5486
|
+
});
|
|
5487
|
+
return el.id ? [el, el.id && (0, dom_1.html)('a', {
|
|
5387
5488
|
href: `#${el.id}`
|
|
5388
|
-
})]
|
|
5389
|
-
}
|
|
5489
|
+
})] : [el];
|
|
5490
|
+
}))))));
|
|
5390
5491
|
|
|
5391
5492
|
/***/ },
|
|
5392
5493
|
|
|
@@ -5457,10 +5558,6 @@ exports.text = (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, ({
|
|
|
5457
5558
|
case '\n':
|
|
5458
5559
|
return [[(0, dom_1.html)('br')], source.slice(1)];
|
|
5459
5560
|
case '*':
|
|
5460
|
-
case '/':
|
|
5461
|
-
case '+':
|
|
5462
|
-
case '~':
|
|
5463
|
-
case '=':
|
|
5464
5561
|
case '`':
|
|
5465
5562
|
return source[1] === source[0] ? repeat({
|
|
5466
5563
|
source,
|
|
@@ -6052,12 +6149,12 @@ const array_1 = __webpack_require__(6876);
|
|
|
6052
6149
|
const dom_1 = __webpack_require__(394);
|
|
6053
6150
|
// Don't use the symbols already used: !#$%@&*+~=|
|
|
6054
6151
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
6055
|
-
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', {
|
|
6056
6153
|
class: 'invalid',
|
|
6057
6154
|
'data-invalid-syntax': 'extension',
|
|
6058
6155
|
'data-invalid-type': 'syntax',
|
|
6059
6156
|
'data-invalid-message': `Invalid start symbol or linebreak`
|
|
6060
|
-
}, (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 */)));
|
|
6061
6158
|
|
|
6062
6159
|
/***/ },
|
|
6063
6160
|
|
|
@@ -6175,7 +6272,7 @@ __exportStar(__webpack_require__(1311), exports);
|
|
|
6175
6272
|
Object.defineProperty(exports, "__esModule", ({
|
|
6176
6273
|
value: true
|
|
6177
6274
|
}));
|
|
6178
|
-
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;
|
|
6179
6276
|
const parser_1 = __webpack_require__(605);
|
|
6180
6277
|
const combinator_1 = __webpack_require__(3484);
|
|
6181
6278
|
const htmlentity_1 = __webpack_require__(470);
|
|
@@ -6205,16 +6302,18 @@ function hasVisible(nodes) {
|
|
|
6205
6302
|
}
|
|
6206
6303
|
return false;
|
|
6207
6304
|
}
|
|
6208
|
-
function blankWith(
|
|
6209
|
-
if (delimiter === undefined) return blankWith('',
|
|
6210
|
-
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}`);
|
|
6211
6310
|
}
|
|
6212
6311
|
exports.blankWith = blankWith;
|
|
6213
|
-
function
|
|
6214
|
-
return input =>
|
|
6312
|
+
function tightStart(parser, except) {
|
|
6313
|
+
return input => isTightStart(input, except) ? parser(input) : undefined;
|
|
6215
6314
|
}
|
|
6216
|
-
exports.
|
|
6217
|
-
const
|
|
6315
|
+
exports.tightStart = tightStart;
|
|
6316
|
+
const isTightStart = (0, memoize_1.reduce)((input, except) => {
|
|
6218
6317
|
const {
|
|
6219
6318
|
source
|
|
6220
6319
|
} = input;
|
|
@@ -6246,7 +6345,7 @@ const isStartTight = (0, memoize_1.reduce)((input, except) => {
|
|
|
6246
6345
|
}, ({
|
|
6247
6346
|
source
|
|
6248
6347
|
}, except = '') => `${source}${"\u001F" /* Command.Separator */}${except}`);
|
|
6249
|
-
function
|
|
6348
|
+
function isLooseNodeStart(nodes) {
|
|
6250
6349
|
if (nodes.length === 0) return true;
|
|
6251
6350
|
for (let i = 0; i < nodes.length; ++i) {
|
|
6252
6351
|
const node = nodes[i];
|
|
@@ -6255,13 +6354,13 @@ function isStartLooseNodes(nodes) {
|
|
|
6255
6354
|
}
|
|
6256
6355
|
return false;
|
|
6257
6356
|
}
|
|
6258
|
-
exports.
|
|
6259
|
-
function
|
|
6357
|
+
exports.isLooseNodeStart = isLooseNodeStart;
|
|
6358
|
+
function isTightNodeStart(nodes) {
|
|
6260
6359
|
if (nodes.length === 0) return true;
|
|
6261
6360
|
return isVisible(nodes[0], 0);
|
|
6262
6361
|
}
|
|
6263
|
-
exports.
|
|
6264
|
-
//export function
|
|
6362
|
+
exports.isTightNodeStart = isTightNodeStart;
|
|
6363
|
+
//export function isTightNodeEnd(nodes: readonly (HTMLElement | string)[]): boolean {
|
|
6265
6364
|
// if (nodes.length === 0) return true;
|
|
6266
6365
|
// return isVisible(nodes.at(-1)!, -1);
|
|
6267
6366
|
//}
|
|
@@ -6416,7 +6515,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6416
6515
|
const visibility_1 = __webpack_require__(6364);
|
|
6417
6516
|
const array_1 = __webpack_require__(6876);
|
|
6418
6517
|
const dom_1 = __webpack_require__(394);
|
|
6419
|
-
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])));
|
|
6420
6519
|
|
|
6421
6520
|
/***/ },
|
|
6422
6521
|
|
|
@@ -6794,11 +6893,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6794
6893
|
exports.deletion = void 0;
|
|
6795
6894
|
const combinator_1 = __webpack_require__(3484);
|
|
6796
6895
|
const inline_1 = __webpack_require__(7973);
|
|
6797
|
-
const source_1 = __webpack_require__(8745);
|
|
6798
6896
|
const visibility_1 = __webpack_require__(6364);
|
|
6897
|
+
const util_1 = __webpack_require__(4992);
|
|
6799
6898
|
const array_1 = __webpack_require__(6876);
|
|
6800
6899
|
const dom_1 = __webpack_require__(394);
|
|
6801
|
-
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))])))));
|
|
6802
6901
|
|
|
6803
6902
|
/***/ },
|
|
6804
6903
|
|
|
@@ -6992,14 +7091,14 @@ const source_1 = __webpack_require__(8745);
|
|
|
6992
7091
|
const visibility_1 = __webpack_require__(6364);
|
|
6993
7092
|
const array_1 = __webpack_require__(6876);
|
|
6994
7093
|
const dom_1 = __webpack_require__(394);
|
|
6995
|
-
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) => {
|
|
6996
7095
|
const ns = (0, parser_1.eval)(text({
|
|
6997
7096
|
source,
|
|
6998
7097
|
context
|
|
6999
7098
|
}), [undefined])[0];
|
|
7000
7099
|
ns && ns.at(-1) === '' && ns.pop();
|
|
7001
|
-
return ns && (0, visibility_1.
|
|
7002
|
-
}), (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) => {
|
|
7003
7102
|
const ns = (0, parser_1.eval)(text({
|
|
7004
7103
|
source,
|
|
7005
7104
|
context
|
|
@@ -7153,7 +7252,7 @@ const optspec = {
|
|
|
7153
7252
|
rel: undefined
|
|
7154
7253
|
};
|
|
7155
7254
|
Object.setPrototypeOf(optspec, null);
|
|
7156
|
-
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) => {
|
|
7157
7256
|
const INSECURE_URI = params.shift();
|
|
7158
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);
|
|
7159
7258
|
let cache;
|
|
@@ -7688,8 +7787,8 @@ const reference_1 = __webpack_require__(9047);
|
|
|
7688
7787
|
const template_1 = __webpack_require__(4510);
|
|
7689
7788
|
const remark_1 = __webpack_require__(8948);
|
|
7690
7789
|
const extension_1 = __webpack_require__(2743);
|
|
7691
|
-
const ruby_1 = __webpack_require__(7304);
|
|
7692
7790
|
const link_1 = __webpack_require__(3628);
|
|
7791
|
+
const ruby_1 = __webpack_require__(7304);
|
|
7693
7792
|
const html_1 = __webpack_require__(5013);
|
|
7694
7793
|
const insertion_1 = __webpack_require__(4515);
|
|
7695
7794
|
const deletion_1 = __webpack_require__(7066);
|
|
@@ -7737,7 +7836,7 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
7737
7836
|
}
|
|
7738
7837
|
switch (source[0]) {
|
|
7739
7838
|
case '[':
|
|
7740
|
-
return (0,
|
|
7839
|
+
return (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input);
|
|
7741
7840
|
case '{':
|
|
7742
7841
|
return (0, link_1.textlink)(input);
|
|
7743
7842
|
case '<':
|
|
@@ -8742,7 +8841,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
8742
8841
|
const source_1 = __webpack_require__(8745);
|
|
8743
8842
|
const visibility_1 = __webpack_require__(6364);
|
|
8744
8843
|
const dom_1 = __webpack_require__(394);
|
|
8745
|
-
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 */))));
|
|
8746
8845
|
// Chicago-Style
|
|
8747
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}`]));
|
|
8748
8847
|
function attributes(ns) {
|
package/markdown.d.ts
CHANGED
|
@@ -652,8 +652,8 @@ export namespace MarkdownParser {
|
|
|
652
652
|
InlineParser.TemplateParser,
|
|
653
653
|
InlineParser.RemarkParser,
|
|
654
654
|
InlineParser.ExtensionParser,
|
|
655
|
-
InlineParser.RubyParser,
|
|
656
655
|
InlineParser.LinkParser.TextLinkParser,
|
|
656
|
+
InlineParser.RubyParser,
|
|
657
657
|
InlineParser.HTMLParser,
|
|
658
658
|
InlineParser.InsertionParser,
|
|
659
659
|
InlineParser.DeletionParser,
|
|
@@ -816,20 +816,6 @@ export namespace MarkdownParser {
|
|
|
816
816
|
]> {
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
|
-
export interface RubyParser extends
|
|
820
|
-
// [AB](a b)
|
|
821
|
-
Inline<'ruby'>,
|
|
822
|
-
Parser<HTMLElement, Context, [
|
|
823
|
-
Parser<string[], Context, []>,
|
|
824
|
-
Parser<string[], Context, []>,
|
|
825
|
-
]> {
|
|
826
|
-
}
|
|
827
|
-
export namespace RubyParser {
|
|
828
|
-
export interface TextParser extends
|
|
829
|
-
Inline<'ruby/text'>,
|
|
830
|
-
Parser<string[], Context, []> {
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
819
|
export interface LinkParser extends
|
|
834
820
|
// { uri }
|
|
835
821
|
// [abc]{uri nofollow}
|
|
@@ -979,6 +965,20 @@ export namespace MarkdownParser {
|
|
|
979
965
|
}
|
|
980
966
|
}
|
|
981
967
|
}
|
|
968
|
+
export interface RubyParser extends
|
|
969
|
+
// [AB](a b)
|
|
970
|
+
Inline<'ruby'>,
|
|
971
|
+
Parser<HTMLElement, Context, [
|
|
972
|
+
Parser<string[], Context, []>,
|
|
973
|
+
Parser<string[], Context, []>,
|
|
974
|
+
]> {
|
|
975
|
+
}
|
|
976
|
+
export namespace RubyParser {
|
|
977
|
+
export interface TextParser extends
|
|
978
|
+
Inline<'ruby/text'>,
|
|
979
|
+
Parser<string[], Context, []> {
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
982
|
export interface HTMLParser extends
|
|
983
983
|
// Allow: wbr, bdo, bdi
|
|
984
984
|
// <bdi>abc</bdi>
|
|
@@ -1016,7 +1016,7 @@ export namespace MarkdownParser {
|
|
|
1016
1016
|
Inline<'insertion'>,
|
|
1017
1017
|
Parser<HTMLElement | string, Context, [
|
|
1018
1018
|
InlineParser,
|
|
1019
|
-
|
|
1019
|
+
InsertionParser,
|
|
1020
1020
|
]> {
|
|
1021
1021
|
}
|
|
1022
1022
|
export interface DeletionParser extends
|
|
@@ -1024,7 +1024,7 @@ export namespace MarkdownParser {
|
|
|
1024
1024
|
Inline<'deletion'>,
|
|
1025
1025
|
Parser<HTMLElement | string, Context, [
|
|
1026
1026
|
InlineParser,
|
|
1027
|
-
|
|
1027
|
+
DeletionParser,
|
|
1028
1028
|
]> {
|
|
1029
1029
|
}
|
|
1030
1030
|
export interface MarkParser extends
|
package/package.json
CHANGED
package/src/parser/context.ts
CHANGED
|
@@ -31,11 +31,11 @@ export const enum Recursion {
|
|
|
31
31
|
export const enum Backtrack {
|
|
32
32
|
template = 7 << 2,
|
|
33
33
|
index = 6 << 2,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
link = 5 << 2,
|
|
35
|
+
ruby = 4 << 2,
|
|
36
36
|
media = 3 << 2,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
bracket = 2 << 2,
|
|
38
|
+
url = 1 << 2,
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export const enum Command {
|
|
@@ -58,7 +58,7 @@ describe('Unit: parser/inline/bracket', () => {
|
|
|
58
58
|
assert.deepStrictEqual(inspect(parser('[]')), [['[', ']'], '']);
|
|
59
59
|
assert.deepStrictEqual(inspect(parser('[a')), [['[', 'a'], '']);
|
|
60
60
|
assert.deepStrictEqual(inspect(parser('[a]')), [['[', 'a', ']'], '']);
|
|
61
|
-
assert.deepStrictEqual(inspect(parser('[==]')), [['[', '
|
|
61
|
+
assert.deepStrictEqual(inspect(parser('[==]')), [['[', '=', '=', ']'], '']);
|
|
62
62
|
assert.deepStrictEqual(inspect(parser('[$]$')), [['[', '<span class="math" translate="no" data-src="$]$">$]$</span>'], '']);
|
|
63
63
|
assert.deepStrictEqual(inspect(parser(']')), undefined);
|
|
64
64
|
});
|
|
@@ -68,7 +68,7 @@ describe('Unit: parser/inline/bracket', () => {
|
|
|
68
68
|
assert.deepStrictEqual(inspect(parser('{}')), [['{', '}'], '']);
|
|
69
69
|
assert.deepStrictEqual(inspect(parser('{a')), [['{', 'a'], '']);
|
|
70
70
|
assert.deepStrictEqual(inspect(parser('{a}')), [['{', 'a', '}'], '']);
|
|
71
|
-
assert.deepStrictEqual(inspect(parser('{==}')), [['{', '
|
|
71
|
+
assert.deepStrictEqual(inspect(parser('{==}')), [['{', '=', '=', '}'], '']);
|
|
72
72
|
assert.deepStrictEqual(inspect(parser('}')), undefined);
|
|
73
73
|
});
|
|
74
74
|
|