securemark 0.294.4 → 0.294.6
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/dist/index.js +159 -114
- package/markdown.d.ts +3 -1
- package/package.json +3 -3
- package/src/combinator/control/manipulation/fence.ts +2 -0
- package/src/combinator/control/manipulation/indent.ts +1 -1
- package/src/combinator/control/manipulation/match.ts +11 -8
- package/src/combinator/data/parser.ts +3 -0
- package/src/parser/api/normalize.test.ts +9 -1
- package/src/parser/api/normalize.ts +17 -10
- package/src/parser/api/parse.test.ts +3 -3
- package/src/parser/block/blockquote.test.ts +3 -9
- package/src/parser/block/blockquote.ts +4 -4
- package/src/parser/block/dlist.ts +4 -4
- package/src/parser/block/extension/example.ts +1 -3
- package/src/parser/block/extension/fig.test.ts +0 -1
- package/src/parser/block/extension/fig.ts +6 -6
- package/src/parser/block/extension/figbase.ts +1 -1
- package/src/parser/block/extension/figure.test.ts +1 -1
- package/src/parser/block/extension/figure.ts +6 -6
- package/src/parser/block/extension/message.ts +1 -1
- package/src/parser/block/extension/table.ts +4 -4
- package/src/parser/block/heading.ts +4 -4
- package/src/parser/block/reply/cite.ts +1 -1
- package/src/parser/block/reply/quote.ts +2 -2
- package/src/parser/block/sidefence.test.ts +1 -3
- package/src/parser/block/sidefence.ts +4 -4
- package/src/parser/block/table.ts +2 -2
- package/src/parser/block.ts +1 -1
- package/src/parser/header.ts +3 -3
- package/src/parser/inline/autolink/account.ts +5 -7
- package/src/parser/inline/autolink/channel.ts +15 -15
- package/src/parser/inline/autolink/hashnum.ts +2 -2
- package/src/parser/inline/autolink/hashtag.test.ts +6 -2
- package/src/parser/inline/autolink/hashtag.ts +12 -10
- package/src/parser/inline/autolink.ts +1 -1
- package/src/parser/inline/code.ts +12 -18
- package/src/parser/inline/deletion.ts +3 -3
- package/src/parser/inline/emstrong.ts +3 -3
- package/src/parser/inline/extension/indexer.ts +1 -1
- package/src/parser/inline/html.ts +1 -1
- package/src/parser/inline/htmlentity.ts +13 -16
- package/src/parser/inline/insertion.ts +3 -3
- package/src/parser/inline/italic.ts +3 -3
- package/src/parser/inline/link.ts +3 -3
- package/src/parser/inline/mark.ts +3 -3
- package/src/parser/inline/remark.ts +3 -3
- package/src/parser/inline/ruby.ts +7 -2
- package/src/parser/inline.ts +2 -0
- package/src/parser/source/text.ts +11 -5
- package/src/parser/util.ts +1 -1
- package/src/parser/visibility.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.294.
|
|
1
|
+
/*! securemark v0.294.6 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"));
|
|
@@ -844,7 +844,7 @@ class List {
|
|
|
844
844
|
if (list.length === 0) return this;
|
|
845
845
|
if (this.length === 0) {
|
|
846
846
|
this.head = list.head;
|
|
847
|
-
this.length
|
|
847
|
+
this.length = list.length;
|
|
848
848
|
list.head = undefined;
|
|
849
849
|
list.length = 0;
|
|
850
850
|
return this;
|
|
@@ -993,20 +993,19 @@ class List {
|
|
|
993
993
|
if (list.length === 0) return this;
|
|
994
994
|
if (this.length === 0) {
|
|
995
995
|
this.head = list.head;
|
|
996
|
-
this.
|
|
997
|
-
|
|
998
|
-
list.
|
|
996
|
+
this.last = list.last;
|
|
997
|
+
this.length = list.length;
|
|
998
|
+
list.clear();
|
|
999
999
|
return this;
|
|
1000
1000
|
}
|
|
1001
1001
|
const head = list.head;
|
|
1002
1002
|
const last = list.last;
|
|
1003
|
-
const next = last.next = before
|
|
1004
|
-
const prev = head.prev =
|
|
1005
|
-
next.prev = last;
|
|
1003
|
+
const next = last.next = before;
|
|
1004
|
+
const prev = head.prev = before?.prev ?? this.last;
|
|
1005
|
+
next === undefined ? this.last = last : next.prev = last;
|
|
1006
1006
|
prev.next = head;
|
|
1007
1007
|
this.length += list.length;
|
|
1008
|
-
list.
|
|
1009
|
-
list.head = undefined;
|
|
1008
|
+
list.clear();
|
|
1010
1009
|
return this;
|
|
1011
1010
|
}
|
|
1012
1011
|
clear() {
|
|
@@ -1038,7 +1037,7 @@ class List {
|
|
|
1038
1037
|
return acc;
|
|
1039
1038
|
}
|
|
1040
1039
|
foldr(f, acc) {
|
|
1041
|
-
for (let node = this.
|
|
1040
|
+
for (let node = this.last; node && this.head;) {
|
|
1042
1041
|
const prev = node.prev;
|
|
1043
1042
|
acc = f(node, acc);
|
|
1044
1043
|
node = prev;
|
|
@@ -1078,17 +1077,18 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1078
1077
|
exports.reduce = exports.memoize = void 0;
|
|
1079
1078
|
const alias_1 = __webpack_require__(5413);
|
|
1080
1079
|
const compare_1 = __webpack_require__(1934);
|
|
1081
|
-
function memoize(f, identify, memory) {
|
|
1080
|
+
function memoize(f, identify, memory, mask) {
|
|
1082
1081
|
if (typeof identify === 'object') {
|
|
1082
|
+
mask = memory;
|
|
1083
1083
|
memory = identify;
|
|
1084
1084
|
identify = undefined;
|
|
1085
1085
|
}
|
|
1086
1086
|
identify ??= (...as) => as[0];
|
|
1087
1087
|
switch (true) {
|
|
1088
1088
|
case (0, alias_1.isArray)(memory):
|
|
1089
|
-
return memoizeArray(f, identify, memory);
|
|
1089
|
+
return mask === undefined ? memoizeArray(f, identify, memory) : cacheArray(f, identify, memory, mask);
|
|
1090
1090
|
case memory?.constructor === Object:
|
|
1091
|
-
return memoizeObject(f, identify, memory);
|
|
1091
|
+
return mask === undefined ? memoizeObject(f, identify, memory) : cacheObject(f, identify, memory, mask);
|
|
1092
1092
|
default:
|
|
1093
1093
|
return memoizeDict(f, identify, memory ?? new Map());
|
|
1094
1094
|
}
|
|
@@ -1097,7 +1097,6 @@ exports.memoize = memoize;
|
|
|
1097
1097
|
function memoizeArray(f, identify, memory) {
|
|
1098
1098
|
return (...as) => {
|
|
1099
1099
|
const b = identify(...as);
|
|
1100
|
-
if (!(b >= 0)) return f(...as);
|
|
1101
1100
|
let z = memory[b];
|
|
1102
1101
|
if (z !== undefined) return z;
|
|
1103
1102
|
z = f(...as);
|
|
@@ -1105,11 +1104,33 @@ function memoizeArray(f, identify, memory) {
|
|
|
1105
1104
|
return z;
|
|
1106
1105
|
};
|
|
1107
1106
|
}
|
|
1107
|
+
function cacheArray(f, identify, memory, mask) {
|
|
1108
|
+
const mask1 = mask >>>= 1;
|
|
1109
|
+
const mask2 = mask;
|
|
1110
|
+
const mem1 = memory;
|
|
1111
|
+
const mem2 = [];
|
|
1112
|
+
return (...as) => {
|
|
1113
|
+
const b = identify(...as);
|
|
1114
|
+
if (b <= mask1) {
|
|
1115
|
+
let z = mem1[b];
|
|
1116
|
+
if (z !== undefined) return z;
|
|
1117
|
+
z = f(...as);
|
|
1118
|
+
mem1[b] = z;
|
|
1119
|
+
return z;
|
|
1120
|
+
} else {
|
|
1121
|
+
const i = b & mask2;
|
|
1122
|
+
const t = mem2[i];
|
|
1123
|
+
if (t && t[0] === b) return t[1];
|
|
1124
|
+
const z = f(...as);
|
|
1125
|
+
mem2[i] = [b, z];
|
|
1126
|
+
return z;
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1108
1130
|
function memoizeObject(f, identify, memory) {
|
|
1109
1131
|
let nullable = false;
|
|
1110
1132
|
return (...as) => {
|
|
1111
1133
|
const b = identify(...as);
|
|
1112
|
-
if (!(b >= 0)) return f(...as);
|
|
1113
1134
|
let z = memory[b];
|
|
1114
1135
|
if (z !== undefined || nullable && b in memory) return z;
|
|
1115
1136
|
z = f(...as);
|
|
@@ -1118,6 +1139,31 @@ function memoizeObject(f, identify, memory) {
|
|
|
1118
1139
|
return z;
|
|
1119
1140
|
};
|
|
1120
1141
|
}
|
|
1142
|
+
function cacheObject(f, identify, memory, mask) {
|
|
1143
|
+
const mask1 = mask >>>= 1;
|
|
1144
|
+
const mask2 = mask;
|
|
1145
|
+
const mem1 = memory;
|
|
1146
|
+
const mem2 = {};
|
|
1147
|
+
let nullable = false;
|
|
1148
|
+
return (...as) => {
|
|
1149
|
+
const b = identify(...as);
|
|
1150
|
+
if (b <= mask1) {
|
|
1151
|
+
let z = mem1[b];
|
|
1152
|
+
if (z !== undefined || nullable && b in mem1) return z;
|
|
1153
|
+
z = f(...as);
|
|
1154
|
+
nullable ||= z === undefined;
|
|
1155
|
+
mem1[b] = z;
|
|
1156
|
+
return z;
|
|
1157
|
+
} else {
|
|
1158
|
+
const i = b & mask2;
|
|
1159
|
+
const t = mem2[i];
|
|
1160
|
+
if (t && t[0] === b) return t[1];
|
|
1161
|
+
const z = f(...as);
|
|
1162
|
+
mem2[i] = [b, z];
|
|
1163
|
+
return z;
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1121
1167
|
function memoizeDict(f, identify, memory) {
|
|
1122
1168
|
let nullable = false;
|
|
1123
1169
|
return (...as) => {
|
|
@@ -2758,6 +2804,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2758
2804
|
}));
|
|
2759
2805
|
exports.fence = void 0;
|
|
2760
2806
|
const parser_1 = __webpack_require__(605);
|
|
2807
|
+
const combinator_1 = __webpack_require__(3484);
|
|
2761
2808
|
const line_1 = __webpack_require__(8287);
|
|
2762
2809
|
const array_1 = __webpack_require__(6876);
|
|
2763
2810
|
function fence(opener, limit, separation = true) {
|
|
@@ -2773,6 +2820,7 @@ function fence(opener, limit, separation = true) {
|
|
|
2773
2820
|
opener.lastIndex = position;
|
|
2774
2821
|
const matches = opener.exec(source);
|
|
2775
2822
|
if (!matches) return;
|
|
2823
|
+
(0, combinator_1.consume)(matches[0].length, context);
|
|
2776
2824
|
const delim = matches[1];
|
|
2777
2825
|
if (matches[0].includes(delim, delim.length)) return;
|
|
2778
2826
|
context.position += matches[0].length;
|
|
@@ -2846,7 +2894,7 @@ function indent(opener, parser = false, separation = false) {
|
|
|
2846
2894
|
} = context;
|
|
2847
2895
|
context.position = source.length;
|
|
2848
2896
|
return new parser_1.List([new parser_1.Data(source.slice(position))]);
|
|
2849
|
-
}))), ([indent]) => indent.length
|
|
2897
|
+
}))), ([indent]) => indent.length * 2 + -(indent[0] === ' '), [], 2 ** 4 - 1)), separation), (lines, context) => {
|
|
2850
2898
|
return parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context));
|
|
2851
2899
|
}));
|
|
2852
2900
|
}
|
|
@@ -2887,7 +2935,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2887
2935
|
exports.match = void 0;
|
|
2888
2936
|
const parser_1 = __webpack_require__(605);
|
|
2889
2937
|
const combinator_1 = __webpack_require__(3484);
|
|
2890
|
-
function match(pattern, f
|
|
2938
|
+
function match(pattern, f) {
|
|
2939
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
2891
2940
|
return (0, parser_1.failsafe)(input => {
|
|
2892
2941
|
const {
|
|
2893
2942
|
context
|
|
@@ -2898,11 +2947,11 @@ function match(pattern, f, cost = false) {
|
|
|
2898
2947
|
} = context;
|
|
2899
2948
|
if (position === source.length) return;
|
|
2900
2949
|
pattern.lastIndex = position;
|
|
2901
|
-
const
|
|
2902
|
-
if (!
|
|
2903
|
-
|
|
2904
|
-
const result = f(
|
|
2905
|
-
context.position += result && context.position === position ?
|
|
2950
|
+
const params = pattern.exec(source);
|
|
2951
|
+
if (!params) return;
|
|
2952
|
+
count && (0, combinator_1.consume)(params[0].length, context);
|
|
2953
|
+
const result = f(params)(input);
|
|
2954
|
+
context.position += result && context.position === position ? params[0].length : 0;
|
|
2906
2955
|
return context.position > position ? result : undefined;
|
|
2907
2956
|
});
|
|
2908
2957
|
}
|
|
@@ -4348,14 +4397,14 @@ function format(source) {
|
|
|
4348
4397
|
return source.replace(/\r\n?/g, '\n');
|
|
4349
4398
|
}
|
|
4350
4399
|
function sanitize(source) {
|
|
4351
|
-
return source.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]|[\u2006\u200B-\u200F\u202A-\u202F\u2060\uFEFF]|(?<![\u1820\u1821])\u180E/g, UNICODE_REPLACEMENT_CHARACTER).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g, char => char.length === 1 ? UNICODE_REPLACEMENT_CHARACTER : char);
|
|
4400
|
+
return source.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]|(?!\u200D)[\u2006\u200B-\u200F\u202A-\u202F\u2060\uFEFF]|(?<![\u1820\u1821])\u180E/g, UNICODE_REPLACEMENT_CHARACTER).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[\uDC00-\uDFFF]/g, char => char.length === 1 ? UNICODE_REPLACEMENT_CHARACTER : char);
|
|
4352
4401
|
}
|
|
4353
4402
|
// https://dev.w3.org/html5/html-author/charref
|
|
4354
4403
|
// https://en.wikipedia.org/wiki/Whitespace_character
|
|
4355
4404
|
exports.invisibleHTMLEntityNames = ['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'shy', 'ensp', 'emsp', 'emsp13', 'emsp14', 'numsp', 'puncsp', 'ThinSpace', 'thinsp', 'VeryThinSpace', 'hairsp', 'ZeroWidthSpace', 'NegativeVeryThinSpace', 'NegativeThinSpace', 'NegativeMediumSpace', 'NegativeThickSpace', 'zwj', 'zwnj', 'lrm', 'rlm', 'MediumSpace', 'NoBreak', 'ApplyFunction', 'af', 'InvisibleTimes', 'it', 'InvisibleComma', 'ic'];
|
|
4356
|
-
const
|
|
4357
|
-
const
|
|
4358
|
-
const
|
|
4405
|
+
const unreadableEscapeHTMLEntityNames = exports.invisibleHTMLEntityNames.filter(name => !['Tab', 'NewLine', 'NonBreakingSpace', 'nbsp', 'zwj', 'zwnj'].includes(name));
|
|
4406
|
+
const unreadableEscapeCharacters = unreadableEscapeHTMLEntityNames.map(name => (0, htmlentity_1.unsafehtmlentity)((0, parser_1.input)(`&${name};`, {})).head.value);
|
|
4407
|
+
const unreadableEscapeCharacter = new RegExp(`[${unreadableEscapeCharacters.join('')}]`, 'g');
|
|
4359
4408
|
// https://www.pandanoir.info/entry/2018/03/11/193000
|
|
4360
4409
|
// http://anti.rosx.net/etc/memo/002_space.html
|
|
4361
4410
|
// http://nicowiki.com/%E7%A9%BA%E7%99%BD%E3%83%BB%E7%89%B9%E6%AE%8A%E8%A8%98%E5%8F%B7.html
|
|
@@ -4367,7 +4416,7 @@ const unreadableSpecialCharacters = (/* unused pure expression or super */ null
|
|
|
4367
4416
|
// ZERO WIDTH NON-JOINER
|
|
4368
4417
|
'\u200C',
|
|
4369
4418
|
// ZERO WIDTH JOINER
|
|
4370
|
-
'\u200D',
|
|
4419
|
+
//'\u200D',
|
|
4371
4420
|
// LEFT-TO-RIGHT MARK
|
|
4372
4421
|
'\u200E',
|
|
4373
4422
|
// RIGHT-TO-LEFT MARK
|
|
@@ -4390,7 +4439,7 @@ const unreadableSpecialCharacters = (/* unused pure expression or super */ null
|
|
|
4390
4439
|
'\uFEFF']));
|
|
4391
4440
|
// 特殊不可視文字はエディタおよびソースビューアでは等幅および強調表示により可視化する
|
|
4392
4441
|
function escape(source) {
|
|
4393
|
-
return source.replace(
|
|
4442
|
+
return source.replace(unreadableEscapeCharacter, char => `&${unreadableEscapeHTMLEntityNames[unreadableEscapeCharacters.indexOf(char)]};`);
|
|
4394
4443
|
}
|
|
4395
4444
|
exports.escape = escape;
|
|
4396
4445
|
|
|
@@ -4559,7 +4608,7 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4559
4608
|
}
|
|
4560
4609
|
}, paragraph_1.paragraph])));
|
|
4561
4610
|
function error(parser) {
|
|
4562
|
-
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}
|
|
4611
|
+
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}[^\n]*\n`);
|
|
4563
4612
|
return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)("\u0007" /* Command.Error */, ({
|
|
4564
4613
|
context: {
|
|
4565
4614
|
source,
|
|
@@ -4601,11 +4650,11 @@ const source_1 = __webpack_require__(8745);
|
|
|
4601
4650
|
const util_1 = __webpack_require__(4992);
|
|
4602
4651
|
const parse_1 = __webpack_require__(3662);
|
|
4603
4652
|
const dom_1 = __webpack_require__(394);
|
|
4604
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(/!?>+
|
|
4653
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(/!?>+ /y, (0, combinator_1.some)(source_1.contentline))]));
|
|
4605
4654
|
exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.union)([(0, combinator_1.open)(/(?=>)/y, source), (0, combinator_1.open)(/!(?=>)/y, markdown)]))));
|
|
4606
|
-
const opener = /(?=>>+(
|
|
4607
|
-
const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(
|
|
4608
|
-
const unindent = source => source.replace(/(?<=^|\n)>(?:[
|
|
4655
|
+
const opener = /(?=>>+(?:$|[ \n]))/y;
|
|
4656
|
+
const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y)), false);
|
|
4657
|
+
const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
|
|
4609
4658
|
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
|
|
4610
4659
|
const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown, false, true)), (0, combinator_1.creation)(10, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
|
|
4611
4660
|
context
|
|
@@ -4705,11 +4754,11 @@ const source_1 = __webpack_require__(8745);
|
|
|
4705
4754
|
const visibility_1 = __webpack_require__(6364);
|
|
4706
4755
|
const util_1 = __webpack_require__(4992);
|
|
4707
4756
|
const dom_1 = __webpack_require__(394);
|
|
4708
|
-
exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~
|
|
4709
|
-
const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~
|
|
4757
|
+
exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~ +(?=\S)/y, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dl', (0, util_1.unwrap)(fillTrailingDescription(ns))))]))));
|
|
4758
|
+
const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~ +(?=\S)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dt', {
|
|
4710
4759
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
4711
4760
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))));
|
|
4712
|
-
const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/:
|
|
4761
|
+
const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/: +(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:] +(?=\S)/y), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dd', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
|
|
4713
4762
|
function fillTrailingDescription(nodes) {
|
|
4714
4763
|
return nodes.last?.value.tagName === 'DT' ? nodes.push(new parser_1.Data((0, dom_1.html)('dd'))) && nodes : nodes;
|
|
4715
4764
|
}
|
|
@@ -4804,8 +4853,7 @@ const mathblock_1 = __webpack_require__(4903);
|
|
|
4804
4853
|
const util_1 = __webpack_require__(4992);
|
|
4805
4854
|
const parse_1 = __webpack_require__(3662);
|
|
4806
4855
|
const dom_1 = __webpack_require__(394);
|
|
4807
|
-
|
|
4808
|
-
exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
|
|
4856
|
+
exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y, 300),
|
|
4809
4857
|
// Bug: Type mismatch between outer and inner.
|
|
4810
4858
|
(nodes, context) => {
|
|
4811
4859
|
const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
|
|
@@ -4871,17 +4919,17 @@ const table_1 = __webpack_require__(3646);
|
|
|
4871
4919
|
const blockquote_1 = __webpack_require__(5885);
|
|
4872
4920
|
const placeholder_1 = __webpack_require__(4091);
|
|
4873
4921
|
const inline_1 = __webpack_require__(7973);
|
|
4874
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.
|
|
4922
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]));
|
|
4875
4923
|
exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
|
|
4876
4924
|
// Bug: TypeScript
|
|
4877
|
-
const fence = (/^[^\n]*\n
|
|
4925
|
+
const fence = (/^[^\n]*\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
|
|
4878
4926
|
return parser({
|
|
4879
4927
|
context
|
|
4880
4928
|
}) ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
|
|
4881
4929
|
}, (0, combinator_1.union)([figure_1.figure]), false), ([{
|
|
4882
4930
|
value: el
|
|
4883
4931
|
}]) => el.tagName === 'FIGURE')));
|
|
4884
|
-
const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(
|
|
4932
|
+
const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\n/y)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)(source_1.contentline)]);
|
|
4885
4933
|
|
|
4886
4934
|
/***/ },
|
|
4887
4935
|
|
|
@@ -4899,7 +4947,7 @@ const parser_1 = __webpack_require__(605);
|
|
|
4899
4947
|
const combinator_1 = __webpack_require__(3484);
|
|
4900
4948
|
const label_1 = __webpack_require__(2178);
|
|
4901
4949
|
const dom_1 = __webpack_require__(394);
|
|
4902
|
-
exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?
|
|
4950
|
+
exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?(?:$|[ \n])/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([{
|
|
4903
4951
|
value: el
|
|
4904
4952
|
}]) => {
|
|
4905
4953
|
const label = el.getAttribute('data-label');
|
|
@@ -4941,19 +4989,19 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
4941
4989
|
const util_1 = __webpack_require__(4992);
|
|
4942
4990
|
const memoize_1 = __webpack_require__(6925);
|
|
4943
4991
|
const dom_1 = __webpack_require__(394);
|
|
4944
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure
|
|
4992
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure )?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\n]*(?:$|\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
|
|
4945
4993
|
// All parsers which can include closing terms.
|
|
4946
|
-
(0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length
|
|
4947
|
-
exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(
|
|
4994
|
+
(0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length - 1, [], 2 ** 4 - 1)));
|
|
4995
|
+
exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?!\S).*\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])]), false), nodes => {
|
|
4948
4996
|
const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
|
|
4949
4997
|
return new parser_1.List([new parser_1.Data((0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
|
|
4950
4998
|
class: 'figindex'
|
|
4951
4999
|
}), (0, dom_1.html)('span', {
|
|
4952
5000
|
class: 'figtext'
|
|
4953
5001
|
}, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])]))]);
|
|
4954
|
-
})), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure|\[
|
|
5002
|
+
})), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure(?=$|[ \n])|\[?\$)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
|
|
4955
5003
|
const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
|
|
4956
|
-
const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure
|
|
5004
|
+
const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure )?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure )?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
|
|
4957
5005
|
return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
|
|
4958
5006
|
class: 'invalid',
|
|
4959
5007
|
translate: 'no',
|
|
@@ -5027,7 +5075,7 @@ const paragraph_1 = __webpack_require__(4330);
|
|
|
5027
5075
|
const util_1 = __webpack_require__(4992);
|
|
5028
5076
|
const array_1 = __webpack_require__(6876);
|
|
5029
5077
|
const dom_1 = __webpack_require__(394);
|
|
5030
|
-
exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/y, 300),
|
|
5078
|
+
exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)(?!\S)([^\n]*)(?:$|\n)/y, 300),
|
|
5031
5079
|
// Bug: Type mismatch between outer and inner.
|
|
5032
5080
|
(nodes, context) => {
|
|
5033
5081
|
const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
|
|
@@ -5149,10 +5197,10 @@ const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
|
|
|
5149
5197
|
const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
|
|
5150
5198
|
value
|
|
5151
5199
|
}]) => new parser_1.List([new parser_1.Data(value.split('/').map(s => s.split('')))])));
|
|
5152
|
-
const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(
|
|
5153
|
-
const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(
|
|
5154
|
-
const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(
|
|
5155
|
-
const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(
|
|
5200
|
+
const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y;
|
|
5201
|
+
const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
|
|
5202
|
+
const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
|
|
5203
|
+
const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/!+ /y, (0, combinator_1.convert)(source => `:${source}`, data, false)), (0, combinator_1.convert)(source => `: ${source}`, data, false)])));
|
|
5156
5204
|
function attributes(source) {
|
|
5157
5205
|
let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
|
|
5158
5206
|
rowspan === '1' ? rowspan = undefined : undefined;
|
|
@@ -5372,11 +5420,11 @@ const source_1 = __webpack_require__(8745);
|
|
|
5372
5420
|
const visibility_1 = __webpack_require__(6364);
|
|
5373
5421
|
const util_1 = __webpack_require__(4992);
|
|
5374
5422
|
const dom_1 = __webpack_require__(394);
|
|
5375
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.
|
|
5423
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(?:\n#+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, (0, combinator_1.some)((0, combinator_1.line)(({
|
|
5376
5424
|
context: {
|
|
5377
5425
|
source
|
|
5378
5426
|
}
|
|
5379
|
-
}) => new parser_1.List([new parser_1.Data(source)])))))
|
|
5427
|
+
}) => new parser_1.List([new parser_1.Data(source)])))));
|
|
5380
5428
|
exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
|
|
5381
5429
|
// その他の表示制御は各所のCSSで行う。
|
|
5382
5430
|
(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/##+/y), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), (nodes, context) => {
|
|
@@ -5722,7 +5770,7 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
|
|
|
5722
5770
|
class: 'anchor',
|
|
5723
5771
|
href: source.slice(2).trimEnd(),
|
|
5724
5772
|
target: '_blank'
|
|
5725
|
-
}, source))])), (0, combinator_1.focus)(
|
|
5773
|
+
}, source))])), (0, combinator_1.focus)(/>>\S+(?=\s*$)/y, ({
|
|
5726
5774
|
context: {
|
|
5727
5775
|
source
|
|
5728
5776
|
}
|
|
@@ -5758,10 +5806,10 @@ const autolink_1 = __webpack_require__(8072);
|
|
|
5758
5806
|
const source_1 = __webpack_require__(8745);
|
|
5759
5807
|
const util_1 = __webpack_require__(4992);
|
|
5760
5808
|
const dom_1 = __webpack_require__(394);
|
|
5761
|
-
exports.syntax = />+
|
|
5809
|
+
exports.syntax = />+ /y;
|
|
5762
5810
|
exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)((0, combinator_1.validate)(exports.syntax, source_1.anyline)), (0, combinator_1.convert)(
|
|
5763
5811
|
// TODO: インデント数を渡してインデント数前の行頭確認を行う実装に置き換える
|
|
5764
|
-
source => source.replace(/(?<=^>+
|
|
5812
|
+
source => source.replace(/(?<=^>+ )/mg, '\r'), (0, combinator_1.some)((0, combinator_1.union)([
|
|
5765
5813
|
// quote補助関数が残した数式をパースする。
|
|
5766
5814
|
math_1.math, autolink_1.autolink, source_1.linebreak, source_1.unescsource])), false)), (ns, {
|
|
5767
5815
|
source,
|
|
@@ -5788,15 +5836,15 @@ const autolink_1 = __webpack_require__(1671);
|
|
|
5788
5836
|
const source_1 = __webpack_require__(8745);
|
|
5789
5837
|
const util_1 = __webpack_require__(4992);
|
|
5790
5838
|
const dom_1 = __webpack_require__(394);
|
|
5791
|
-
exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(
|
|
5839
|
+
exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/\|+ [^\n]*(?:\n\|+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, (0, combinator_1.union)([source])), ([{
|
|
5792
5840
|
value
|
|
5793
5841
|
}]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
|
|
5794
5842
|
class: 'invalid',
|
|
5795
5843
|
...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
|
|
5796
5844
|
}))]))));
|
|
5797
|
-
const opener = /(?=\|\|+(
|
|
5798
|
-
const unindent = source => source.replace(/(?<=^|\n)\|(?:[
|
|
5799
|
-
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(
|
|
5845
|
+
const opener = /(?=\|\|+(?:$|[ \n]))/y;
|
|
5846
|
+
const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \n])))|\n$/g, '');
|
|
5847
|
+
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?=$|[ \n])[^\n]*(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
|
|
5800
5848
|
|
|
5801
5849
|
/***/ },
|
|
5802
5850
|
|
|
@@ -5820,7 +5868,7 @@ const duff_1 = __webpack_require__(9202);
|
|
|
5820
5868
|
const array_1 = __webpack_require__(6876);
|
|
5821
5869
|
const dom_1 = __webpack_require__(394);
|
|
5822
5870
|
exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*(?:\n\|[^\n]*){2}/y, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => new parser_1.List([new parser_1.Data((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
|
|
5823
|
-
const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])),
|
|
5871
|
+
const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /\|?\s*$/y, optional)), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('tr', (0, util_1.unwrap)(ns)))])), (0, combinator_1.rewrite)(source_1.contentline, ({
|
|
5824
5872
|
context: {
|
|
5825
5873
|
source
|
|
5826
5874
|
}
|
|
@@ -5837,7 +5885,7 @@ const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_
|
|
|
5837
5885
|
source
|
|
5838
5886
|
}
|
|
5839
5887
|
}) => new parser_1.List([new parser_1.Data(source.at(-1) === ':' ? 'end' : '')]))])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
|
|
5840
|
-
const cell = (0, combinator_1.surround)(/\|\s*(?=\S)/y, (0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.media, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.shortmedia, /\s*(?=\||$)/y), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /\|/y, [[
|
|
5888
|
+
const cell = (0, combinator_1.surround)(/\|\s*(?=\S)/y, (0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.media, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.shortmedia, /\s*(?=\||$)/y), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /\|/y, [[/\|?\s*$/y, 9]]))]), /[^|]*/y, true);
|
|
5841
5889
|
const head = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('th', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
|
|
5842
5890
|
const data = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
|
|
5843
5891
|
function format(rows) {
|
|
@@ -5924,7 +5972,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
5924
5972
|
const util_1 = __webpack_require__(4992);
|
|
5925
5973
|
const normalize_1 = __webpack_require__(4490);
|
|
5926
5974
|
const dom_1 = __webpack_require__(394);
|
|
5927
|
-
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+
|
|
5975
|
+
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.rewrite)(({
|
|
5928
5976
|
context
|
|
5929
5977
|
}) => {
|
|
5930
5978
|
const {
|
|
@@ -5938,7 +5986,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
|
|
|
5938
5986
|
return new parser_1.List();
|
|
5939
5987
|
}, (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
|
|
5940
5988
|
context
|
|
5941
|
-
}) => context.header ?? true, (0, combinator_1.focus)(/(---+)
|
|
5989
|
+
}) => context.header ?? true, (0, combinator_1.focus)(/(---+) *\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1 *(?:$|\r?\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
|
|
5942
5990
|
class: 'header'
|
|
5943
5991
|
}, [(0, dom_1.html)('details', {
|
|
5944
5992
|
open: ''
|
|
@@ -5955,7 +6003,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
|
|
|
5955
6003
|
translate: 'no',
|
|
5956
6004
|
...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
|
|
5957
6005
|
}, (0, normalize_1.normalize)(source.slice(position))))]);
|
|
5958
|
-
}]))), (0, combinator_1.clear)((0, source_1.str)(/
|
|
6006
|
+
}]))), (0, combinator_1.clear)((0, source_1.str)(/ *\r?\n/y))])));
|
|
5959
6007
|
const field = (0, combinator_1.line)(({
|
|
5960
6008
|
context: {
|
|
5961
6009
|
source,
|
|
@@ -6027,13 +6075,13 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
6027
6075
|
case '[':
|
|
6028
6076
|
return (0, reference_1.reference)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
6029
6077
|
case '%':
|
|
6030
|
-
return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
6078
|
+
return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input) || (0, bracket_1.bracket)(input);
|
|
6031
6079
|
case '#':
|
|
6032
6080
|
case '$':
|
|
6033
6081
|
case ':':
|
|
6034
6082
|
case '^':
|
|
6035
6083
|
case '|':
|
|
6036
|
-
return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
|
|
6084
|
+
return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input) || (0, bracket_1.bracket)(input);
|
|
6037
6085
|
}
|
|
6038
6086
|
return (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input) || (0, bracket_1.bracket)(input);
|
|
6039
6087
|
case '{':
|
|
@@ -6160,7 +6208,7 @@ const account_1 = __webpack_require__(4107);
|
|
|
6160
6208
|
const hashtag_1 = __webpack_require__(5764);
|
|
6161
6209
|
const hashnum_1 = __webpack_require__(8684);
|
|
6162
6210
|
const anchor_1 = __webpack_require__(8535);
|
|
6163
|
-
exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(new RegExp([/(?<![0-9a-z])@/yi.source, /(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source, /(?<![0-9a-z])>>/yi.source, /(?<![0-9a-z][.+-]?|[@#])!?[0-9a-z]/yi.source].join('|').replace(/emoji/g, hashtag_1.emoji), 'yiu'), (0, combinator_1.state)(~1 /* State.autolink */, (0, combinator_1.union)([url_1.lineurl, url_1.url, email_1.email,
|
|
6211
|
+
exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(new RegExp([/(?<![0-9a-z])@/yi.source, /(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source, /(?<![0-9a-z])>>/yi.source, /(?<![0-9a-z][.+-]?|[@#])!?[0-9a-z]/yi.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yiu'), (0, combinator_1.state)(~1 /* State.autolink */, (0, combinator_1.union)([url_1.lineurl, url_1.url, email_1.email,
|
|
6164
6212
|
// Escape unmatched email-like strings.
|
|
6165
6213
|
//str(/[0-9a-z]+(?:[_.+-][0-9a-z]+[:@]?|:|@(?=@))*/yi),
|
|
6166
6214
|
channel_1.channel, account_1.account,
|
|
@@ -6189,7 +6237,7 @@ const link_1 = __webpack_require__(3628);
|
|
|
6189
6237
|
const source_1 = __webpack_require__(8745);
|
|
6190
6238
|
const dom_1 = __webpack_require__(394);
|
|
6191
6239
|
// https://example/@user must be a user page or a redirect page going there.
|
|
6192
|
-
exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.
|
|
6240
|
+
exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@#]|>>|:\S)/yi), true, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
|
|
6193
6241
|
value
|
|
6194
6242
|
}]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
|
|
6195
6243
|
class: 'account'
|
|
@@ -6244,9 +6292,9 @@ const hashtag_1 = __webpack_require__(5764);
|
|
|
6244
6292
|
const source_1 = __webpack_require__(8745);
|
|
6245
6293
|
const dom_1 = __webpack_require__(394);
|
|
6246
6294
|
// https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
|
|
6247
|
-
exports.channel = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.sequence)([(0, combinator_1.
|
|
6295
|
+
exports.channel = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.sequence)([(0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), true, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.verify)((0, combinator_1.surround)('#', (0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), (0, source_1.str)(new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), false, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), ([{
|
|
6248
6296
|
value
|
|
6249
|
-
}]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value))
|
|
6297
|
+
}]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)))]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1, source.indexOf('#')).replace('/', '/@')}` : `/${source.slice(0, source.indexOf('#'))}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
|
|
6250
6298
|
value: el
|
|
6251
6299
|
}], {
|
|
6252
6300
|
source,
|
|
@@ -6307,7 +6355,7 @@ const link_1 = __webpack_require__(3628);
|
|
|
6307
6355
|
const hashtag_1 = __webpack_require__(5764);
|
|
6308
6356
|
const source_1 = __webpack_require__(8745);
|
|
6309
6357
|
const dom_1 = __webpack_require__(394);
|
|
6310
|
-
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), false, [1 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
|
|
6358
|
+
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), false, [1 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
|
|
6311
6359
|
value
|
|
6312
6360
|
}]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
|
|
6313
6361
|
class: 'hashnum',
|
|
@@ -6333,10 +6381,10 @@ const source_1 = __webpack_require__(8745);
|
|
|
6333
6381
|
const dom_1 = __webpack_require__(394);
|
|
6334
6382
|
// https://example/hashtags/a must be a hashtag page or a redirect page going there.
|
|
6335
6383
|
// https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
|
|
6336
|
-
exports.emoji =
|
|
6337
|
-
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.
|
|
6384
|
+
exports.emoji = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\u200D/u;
|
|
6385
|
+
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.verify)((0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, exports.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('').replace(/emoji/g, exports.emoji.source), 'yu')), (0, source_1.str)(new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, exports.emoji.source), 'yu')), false, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), ([{
|
|
6338
6386
|
value
|
|
6339
|
-
}]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)),
|
|
6387
|
+
}]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
|
|
6340
6388
|
value
|
|
6341
6389
|
}]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
|
|
6342
6390
|
class: 'hashtag'
|
|
@@ -6476,12 +6524,12 @@ const parser_1 = __webpack_require__(605);
|
|
|
6476
6524
|
const combinator_1 = __webpack_require__(3484);
|
|
6477
6525
|
const util_1 = __webpack_require__(4992);
|
|
6478
6526
|
const dom_1 = __webpack_require__(394);
|
|
6479
|
-
exports.code = (0, combinator_1.
|
|
6527
|
+
exports.code = (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
|
|
6480
6528
|
'data-src': whole
|
|
6481
6529
|
}, format(body)))]) : body ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
|
|
6482
6530
|
class: 'invalid',
|
|
6483
6531
|
...(0, util_1.invalid)('code', 'syntax', `Missing the closing symbol "${opener}"`)
|
|
6484
|
-
}, whole))]) : new parser_1.List([new parser_1.Data(opener)])
|
|
6532
|
+
}, whole))]) : new parser_1.List([new parser_1.Data(opener)]));
|
|
6485
6533
|
function format(text) {
|
|
6486
6534
|
return text.length > 2 && text[0] === ' ' && text[1] === '`' && text.at(-1) === ' ' ? text.slice(1, -1) : text;
|
|
6487
6535
|
}
|
|
@@ -6504,11 +6552,11 @@ const inline_1 = __webpack_require__(7973);
|
|
|
6504
6552
|
const visibility_1 = __webpack_require__(6364);
|
|
6505
6553
|
const util_1 = __webpack_require__(4992);
|
|
6506
6554
|
const dom_1 = __webpack_require__(394);
|
|
6507
|
-
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
6555
|
+
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), '~~', false, ([, bs], {
|
|
6508
6556
|
buffer
|
|
6509
6557
|
}) => buffer.import(bs), ([, bs], {
|
|
6510
6558
|
buffer
|
|
6511
|
-
}) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))))
|
|
6559
|
+
}) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
|
|
6512
6560
|
|
|
6513
6561
|
/***/ },
|
|
6514
6562
|
|
|
@@ -6558,7 +6606,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
|
|
|
6558
6606
|
// 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
|
|
6559
6607
|
// 可能な限り早く閉じるよう解析しなければならない。
|
|
6560
6608
|
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
6561
|
-
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
6609
|
+
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (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}/y), false, ([, bs, cs], context) => {
|
|
6562
6610
|
const {
|
|
6563
6611
|
buffer = new parser_1.List()
|
|
6564
6612
|
} = context;
|
|
@@ -6665,7 +6713,7 @@ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.h
|
|
|
6665
6713
|
nodes = prepend('*'.repeat(prefix - postfix), nodes);
|
|
6666
6714
|
}
|
|
6667
6715
|
return nodes;
|
|
6668
|
-
})))
|
|
6716
|
+
})));
|
|
6669
6717
|
function prepend(prefix, nodes) {
|
|
6670
6718
|
if (typeof nodes.head?.value === 'string') {
|
|
6671
6719
|
nodes.head.value = prefix + nodes.head.value;
|
|
@@ -6911,7 +6959,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
6911
6959
|
// 複合生成インデクスを手動で同期させるより最初から重複のない
|
|
6912
6960
|
// テキストまたはインデクスを付けて同期が必要な機会を減らすのが
|
|
6913
6961
|
// 継続的編集において最も簡便となる。
|
|
6914
|
-
exports.indexer = (0, combinator_1.surround)(
|
|
6962
|
+
exports.indexer = (0, combinator_1.surround)(/ \[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
|
|
6915
6963
|
class: 'indexer',
|
|
6916
6964
|
'data-index': ''
|
|
6917
6965
|
}))]))]), /\]\s*$/y);
|
|
@@ -7017,7 +7065,7 @@ Object.setPrototypeOf(attrspecs, null);
|
|
|
7017
7065
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
7018
7066
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
7019
7067
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7020
|
-
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[
|
|
7068
|
+
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[ >])`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
|
|
7021
7069
|
// 不可視のHTML構造が可視構造を変化させるべきでない。
|
|
7022
7070
|
// 可視のHTMLは優先度変更を検討する。
|
|
7023
7071
|
// このため<>は将来的に共通構造を変化させる可能性があり
|
|
@@ -7092,19 +7140,10 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7092
7140
|
exports.htmlentity = exports.unsafehtmlentity = void 0;
|
|
7093
7141
|
const parser_1 = __webpack_require__(605);
|
|
7094
7142
|
const combinator_1 = __webpack_require__(3484);
|
|
7143
|
+
const source_1 = __webpack_require__(8745);
|
|
7095
7144
|
const util_1 = __webpack_require__(4992);
|
|
7096
7145
|
const dom_1 = __webpack_require__(394);
|
|
7097
|
-
exports.unsafehtmlentity = (0, combinator_1.
|
|
7098
|
-
//({ source }) => [[parser(source) ?? `${Command.Error}${source}`], '']));
|
|
7099
|
-
({
|
|
7100
|
-
context
|
|
7101
|
-
}) => {
|
|
7102
|
-
const {
|
|
7103
|
-
source
|
|
7104
|
-
} = context;
|
|
7105
|
-
context.position += source.length;
|
|
7106
|
-
return source.length > 1 && source.at(-1) === ';' ? new parser_1.List([new parser_1.Data(parser(source) ?? source)]) : new parser_1.List([new parser_1.Data(source)]);
|
|
7107
|
-
});
|
|
7146
|
+
exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]), [3 | 64 /* Backtrack.bracket */]);
|
|
7108
7147
|
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
|
|
7109
7148
|
value
|
|
7110
7149
|
}]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Data(value) : new parser_1.Data((0, dom_1.html)('span', {
|
|
@@ -7114,8 +7153,7 @@ exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.uns
|
|
|
7114
7153
|
const parser = (el => entity => {
|
|
7115
7154
|
if (entity === '
') return ' ';
|
|
7116
7155
|
el.innerHTML = entity;
|
|
7117
|
-
|
|
7118
|
-
return entity === text ? undefined : text;
|
|
7156
|
+
return el.textContent;
|
|
7119
7157
|
})((0, dom_1.html)('span'));
|
|
7120
7158
|
|
|
7121
7159
|
/***/ },
|
|
@@ -7136,11 +7174,11 @@ const inline_1 = __webpack_require__(7973);
|
|
|
7136
7174
|
const visibility_1 = __webpack_require__(6364);
|
|
7137
7175
|
const util_1 = __webpack_require__(4992);
|
|
7138
7176
|
const dom_1 = __webpack_require__(394);
|
|
7139
|
-
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
7177
|
+
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), '++', false, ([, bs], {
|
|
7140
7178
|
buffer
|
|
7141
7179
|
}) => buffer.import(bs), ([, bs], {
|
|
7142
7180
|
buffer
|
|
7143
|
-
}) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))))
|
|
7181
|
+
}) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
|
|
7144
7182
|
|
|
7145
7183
|
/***/ },
|
|
7146
7184
|
|
|
@@ -7163,11 +7201,11 @@ const dom_1 = __webpack_require__(394);
|
|
|
7163
7201
|
// 可読性のため実際にはオブリーク体を指定する。
|
|
7164
7202
|
// 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
|
|
7165
7203
|
// ある程度の長さのある文に使うのが望ましい。
|
|
7166
|
-
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
7204
|
+
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (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)])))), '///', false, ([, bs], {
|
|
7167
7205
|
buffer
|
|
7168
7206
|
}) => buffer.import(bs), ([, bs], {
|
|
7169
7207
|
buffer
|
|
7170
|
-
}) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))))
|
|
7208
|
+
}) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
|
|
7171
7209
|
|
|
7172
7210
|
/***/ },
|
|
7173
7211
|
|
|
@@ -7227,11 +7265,11 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
|
|
|
7227
7265
|
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
7228
7266
|
return new parser_1.List([new parser_1.Data(parse(content, params, context))]);
|
|
7229
7267
|
}))))));
|
|
7230
|
-
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.
|
|
7268
|
+
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))]), ([{
|
|
7231
7269
|
value: content
|
|
7232
7270
|
}, {
|
|
7233
7271
|
value: params
|
|
7234
|
-
}], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))]))))))
|
|
7272
|
+
}], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))]))))));
|
|
7235
7273
|
exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([{
|
|
7236
7274
|
value: params
|
|
7237
7275
|
}, {
|
|
@@ -7345,7 +7383,7 @@ const indexee_1 = __webpack_require__(7610);
|
|
|
7345
7383
|
const visibility_1 = __webpack_require__(6364);
|
|
7346
7384
|
const util_1 = __webpack_require__(4992);
|
|
7347
7385
|
const dom_1 = __webpack_require__(394);
|
|
7348
|
-
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.
|
|
7386
|
+
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (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)])))), '==', false, ([, bs], {
|
|
7349
7387
|
buffer
|
|
7350
7388
|
}) => buffer.import(bs), ([, bs], {
|
|
7351
7389
|
buffer
|
|
@@ -7359,7 +7397,7 @@ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /*
|
|
|
7359
7397
|
return el.id ? new parser_1.List([new parser_1.Data(el), new parser_1.Data((0, dom_1.html)('a', {
|
|
7360
7398
|
href: `#${el.id}`
|
|
7361
7399
|
}))]) : new parser_1.List([new parser_1.Data(el)]);
|
|
7362
|
-
})))))
|
|
7400
|
+
})))));
|
|
7363
7401
|
|
|
7364
7402
|
/***/ },
|
|
7365
7403
|
|
|
@@ -7659,11 +7697,11 @@ const inline_1 = __webpack_require__(7973);
|
|
|
7659
7697
|
const source_1 = __webpack_require__(8745);
|
|
7660
7698
|
const util_1 = __webpack_require__(4992);
|
|
7661
7699
|
const dom_1 = __webpack_require__(394);
|
|
7662
|
-
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(
|
|
7700
|
+
exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
|
|
7663
7701
|
class: 'remark'
|
|
7664
7702
|
}, [(0, dom_1.html)('input', {
|
|
7665
7703
|
type: 'checkbox'
|
|
7666
|
-
}), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(
|
|
7704
|
+
}), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(?=[ \n])/y, ({
|
|
7667
7705
|
context: {
|
|
7668
7706
|
source
|
|
7669
7707
|
}
|
|
@@ -7724,6 +7762,7 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
|
|
|
7724
7762
|
}, acc) => value + ' ' + acc, '').trim())), new parser_1.Data((0, dom_1.html)('rp', ')'))])))))]);
|
|
7725
7763
|
}
|
|
7726
7764
|
}));
|
|
7765
|
+
const delimiter = /[$"`\[\](){}<>()[]{}]|\\?\n/y;
|
|
7727
7766
|
const text = input => {
|
|
7728
7767
|
const {
|
|
7729
7768
|
context
|
|
@@ -7737,11 +7776,12 @@ const text = input => {
|
|
|
7737
7776
|
for (let {
|
|
7738
7777
|
position
|
|
7739
7778
|
} = context; position < source.length; position = context.position) {
|
|
7740
|
-
|
|
7779
|
+
delimiter.lastIndex = position;
|
|
7780
|
+
if (delimiter.test(source)) break;
|
|
7741
7781
|
switch (source[position]) {
|
|
7742
7782
|
case '&':
|
|
7743
7783
|
{
|
|
7744
|
-
const result = (0, htmlentity_1.unsafehtmlentity)(input) ?? (0, source_1.txt)(input);
|
|
7784
|
+
const result = source[position + 1] !== ' ' ? (0, htmlentity_1.unsafehtmlentity)(input) ?? (0, source_1.txt)(input) : (0, source_1.txt)(input);
|
|
7745
7785
|
acc.last.value += result.head.value;
|
|
7746
7786
|
continue;
|
|
7747
7787
|
}
|
|
@@ -8555,7 +8595,6 @@ function next(source, position, delimiter) {
|
|
|
8555
8595
|
const char = source[index];
|
|
8556
8596
|
switch (char) {
|
|
8557
8597
|
case '$':
|
|
8558
|
-
case '%':
|
|
8559
8598
|
case '*':
|
|
8560
8599
|
case '+':
|
|
8561
8600
|
case '~':
|
|
@@ -8563,8 +8602,11 @@ function next(source, position, delimiter) {
|
|
|
8563
8602
|
case '/':
|
|
8564
8603
|
index = backToWhitespace(source, position, index);
|
|
8565
8604
|
break;
|
|
8605
|
+
case '%':
|
|
8606
|
+
index += index - 1 > position && source.startsWith(' %]', index - 1) ? -1 : 0;
|
|
8607
|
+
break;
|
|
8566
8608
|
case '[':
|
|
8567
|
-
index
|
|
8609
|
+
index += index - 1 > position && source.startsWith(' [|', index - 1) ? -1 : 0;
|
|
8568
8610
|
break;
|
|
8569
8611
|
case ':':
|
|
8570
8612
|
index = source.startsWith('//', index + 1) ? backToUrlHead(source, position, index) : index;
|
|
@@ -8674,7 +8716,6 @@ function seek(source, position) {
|
|
|
8674
8716
|
case '@':
|
|
8675
8717
|
case '#':
|
|
8676
8718
|
case '$':
|
|
8677
|
-
case '&':
|
|
8678
8719
|
case '"':
|
|
8679
8720
|
case '`':
|
|
8680
8721
|
case '[':
|
|
@@ -8710,6 +8751,9 @@ function seek(source, position) {
|
|
|
8710
8751
|
case ':':
|
|
8711
8752
|
if (source[i + 1] === '/' && source[i + 2] === '/') return i;
|
|
8712
8753
|
continue;
|
|
8754
|
+
case '&':
|
|
8755
|
+
if (source[i + 1] !== ' ') return i;
|
|
8756
|
+
continue;
|
|
8713
8757
|
case ' ':
|
|
8714
8758
|
case '\t':
|
|
8715
8759
|
case ' ':
|
|
@@ -8837,6 +8881,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
|
|
|
8837
8881
|
source,
|
|
8838
8882
|
position
|
|
8839
8883
|
} = context;
|
|
8884
|
+
if (!source.startsWith(symbol, context.position)) return;
|
|
8840
8885
|
let nodes = new parser_1.List();
|
|
8841
8886
|
let i = symbol.length;
|
|
8842
8887
|
for (; source[context.position + i] === source[context.position];) ++i;
|
|
@@ -8942,7 +8987,7 @@ var blank;
|
|
|
8942
8987
|
(function (blank) {
|
|
8943
8988
|
blank.line = new RegExp(
|
|
8944
8989
|
// TODO: 行全体をエスケープ
|
|
8945
|
-
/^(
|
|
8990
|
+
/^(\\?[^\S\r\n]|&IHN;|<wbr ?>|\\$)+$/mg.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'gm');
|
|
8946
8991
|
blank.start = new RegExp(/(?:\\?[^\S\r\n]|&IHN;|<wbr ?>)+/y.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'y');
|
|
8947
8992
|
})(blank || (exports.blank = blank = {}));
|
|
8948
8993
|
function visualize(parser) {
|