securemark 0.258.9 → 0.259.2
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 +12 -0
- package/design.md +6 -5
- package/dist/index.js +535 -278
- package/markdown.d.ts +4 -3
- package/package.json +1 -1
- package/src/combinator/control/constraint/block.test.ts +5 -5
- package/src/combinator/control/constraint/block.ts +3 -2
- package/src/combinator/control/constraint/contract.ts +7 -5
- package/src/combinator/control/constraint/line.test.ts +6 -6
- package/src/combinator/control/constraint/line.ts +6 -5
- package/src/combinator/control/manipulation/convert.ts +6 -5
- package/src/combinator/control/manipulation/fence.ts +2 -1
- package/src/combinator/control/manipulation/indent.test.ts +14 -14
- package/src/combinator/control/manipulation/indent.ts +5 -5
- package/src/combinator/control/manipulation/lazy.ts +2 -2
- package/src/combinator/control/manipulation/match.ts +3 -2
- package/src/combinator/control/manipulation/recovery.ts +6 -6
- package/src/combinator/control/manipulation/scope.ts +13 -10
- package/src/combinator/control/manipulation/surround.ts +9 -8
- package/src/combinator/control/manipulation/trim.test.ts +9 -9
- package/src/combinator/control/monad/bind.ts +3 -2
- package/src/combinator/data/parser/context/memo.ts +3 -4
- package/src/combinator/data/parser/context.test.ts +9 -9
- package/src/combinator/data/parser/context.ts +38 -34
- package/src/combinator/data/parser/inits.ts +3 -2
- package/src/combinator/data/parser/sequence.test.ts +10 -10
- package/src/combinator/data/parser/sequence.ts +3 -2
- package/src/combinator/data/parser/some.test.ts +13 -13
- package/src/combinator/data/parser/some.ts +3 -2
- package/src/combinator/data/parser/subsequence.test.ts +14 -14
- package/src/combinator/data/parser/union.test.ts +10 -10
- package/src/combinator/data/parser/union.ts +2 -2
- package/src/combinator/data/parser.ts +6 -1
- package/src/parser/api/bind.ts +3 -3
- package/src/parser/api/header.ts +1 -1
- package/src/parser/api/normalize.ts +1 -1
- package/src/parser/api/parse.ts +3 -3
- package/src/parser/autolink.test.ts +1 -1
- package/src/parser/autolink.ts +2 -2
- package/src/parser/block/blockquote.test.ts +1 -1
- package/src/parser/block/blockquote.ts +1 -1
- package/src/parser/block/codeblock.test.ts +1 -1
- package/src/parser/block/codeblock.ts +1 -1
- package/src/parser/block/dlist.test.ts +1 -1
- package/src/parser/block/extension/aside.test.ts +1 -1
- package/src/parser/block/extension/example.test.ts +1 -1
- package/src/parser/block/extension/example.ts +1 -1
- package/src/parser/block/extension/fig.test.ts +1 -1
- package/src/parser/block/extension/figbase.test.ts +1 -1
- package/src/parser/block/extension/figure.test.ts +1 -1
- package/src/parser/block/extension/figure.ts +1 -1
- package/src/parser/block/extension/message.test.ts +1 -1
- package/src/parser/block/extension/message.ts +1 -1
- package/src/parser/block/extension/placeholder.test.ts +1 -1
- package/src/parser/block/extension/table.test.ts +1 -1
- package/src/parser/block/extension/table.ts +1 -1
- package/src/parser/block/extension.test.ts +1 -1
- package/src/parser/block/heading.test.ts +3 -3
- package/src/parser/block/heading.ts +1 -1
- package/src/parser/block/horizontalrule.test.ts +1 -1
- package/src/parser/block/ilist.test.ts +1 -1
- package/src/parser/block/mathblock.test.ts +1 -1
- package/src/parser/block/olist.test.ts +1 -1
- package/src/parser/block/olist.ts +5 -5
- package/src/parser/block/paragraph.test.ts +1 -1
- package/src/parser/block/reply/cite.test.ts +4 -2
- package/src/parser/block/reply/cite.ts +2 -1
- package/src/parser/block/reply/quote.test.ts +1 -1
- package/src/parser/block/reply/quote.ts +2 -2
- package/src/parser/block/reply.test.ts +1 -1
- package/src/parser/block/sidefence.test.ts +1 -1
- package/src/parser/block/table.test.ts +1 -1
- package/src/parser/block/table.ts +1 -1
- package/src/parser/block/ulist.test.ts +1 -1
- package/src/parser/block/ulist.ts +1 -1
- package/src/parser/block.ts +2 -2
- package/src/parser/context.ts +15 -6
- package/src/parser/header.test.ts +1 -1
- package/src/parser/header.ts +3 -3
- package/src/parser/inline/annotation.test.ts +1 -1
- package/src/parser/inline/annotation.ts +3 -4
- package/src/parser/inline/autolink/account.test.ts +1 -1
- package/src/parser/inline/autolink/anchor.test.ts +1 -1
- package/src/parser/inline/autolink/channel.test.ts +1 -1
- package/src/parser/inline/autolink/email.test.ts +1 -1
- package/src/parser/inline/autolink/email.ts +1 -1
- package/src/parser/inline/autolink/hashnum.test.ts +1 -1
- package/src/parser/inline/autolink/hashtag.test.ts +1 -1
- package/src/parser/inline/autolink/url.test.ts +1 -1
- package/src/parser/inline/autolink.ts +1 -1
- package/src/parser/inline/bracket.test.ts +1 -1
- package/src/parser/inline/bracket.ts +8 -8
- package/src/parser/inline/code.test.ts +1 -1
- package/src/parser/inline/code.ts +2 -2
- package/src/parser/inline/comment.test.ts +1 -1
- package/src/parser/inline/comment.ts +2 -2
- package/src/parser/inline/deletion.test.ts +1 -1
- package/src/parser/inline/deletion.ts +2 -2
- package/src/parser/inline/emphasis.test.ts +1 -1
- package/src/parser/inline/emphasis.ts +2 -2
- package/src/parser/inline/emstrong.ts +4 -4
- package/src/parser/inline/escape.ts +3 -3
- package/src/parser/inline/extension/index.test.ts +1 -1
- package/src/parser/inline/extension/index.ts +3 -4
- package/src/parser/inline/extension/indexer.test.ts +1 -1
- package/src/parser/inline/extension/label.test.ts +1 -1
- package/src/parser/inline/extension/placeholder.test.ts +1 -1
- package/src/parser/inline/extension/placeholder.ts +2 -2
- package/src/parser/inline/html.test.ts +1 -1
- package/src/parser/inline/html.ts +2 -2
- package/src/parser/inline/htmlentity.test.ts +1 -1
- package/src/parser/inline/htmlentity.ts +1 -1
- package/src/parser/inline/insertion.test.ts +1 -1
- package/src/parser/inline/insertion.ts +2 -2
- package/src/parser/inline/link.test.ts +1 -1
- package/src/parser/inline/link.ts +14 -22
- package/src/parser/inline/mark.test.ts +1 -1
- package/src/parser/inline/mark.ts +2 -2
- package/src/parser/inline/math.test.ts +1 -1
- package/src/parser/inline/math.ts +1 -1
- package/src/parser/inline/media.test.ts +1 -1
- package/src/parser/inline/media.ts +3 -3
- package/src/parser/inline/reference.test.ts +1 -1
- package/src/parser/inline/reference.ts +3 -4
- package/src/parser/inline/ruby.test.ts +1 -1
- package/src/parser/inline/ruby.ts +5 -5
- package/src/parser/inline/shortmedia.test.ts +1 -1
- package/src/parser/inline/strong.test.ts +1 -1
- package/src/parser/inline/strong.ts +2 -2
- package/src/parser/inline/template.test.ts +1 -1
- package/src/parser/inline/template.ts +2 -2
- package/src/parser/inline.test.ts +1 -1
- package/src/parser/locale.test.ts +1 -1
- package/src/parser/segment.ts +1 -1
- package/src/parser/source/escapable.test.ts +1 -1
- package/src/parser/source/escapable.ts +1 -1
- package/src/parser/source/line.test.ts +1 -1
- package/src/parser/source/line.ts +2 -2
- package/src/parser/source/str.ts +4 -4
- package/src/parser/source/text.test.ts +1 -1
- package/src/parser/source/text.ts +4 -4
- package/src/parser/source/unescapable.test.ts +1 -1
- package/src/parser/source/unescapable.ts +1 -1
- package/src/parser/visibility.ts +13 -13
- package/src/util/quote.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.259.2 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("DOMPurify"), require("Prism"));
|
|
@@ -2129,10 +2129,14 @@ const memo_1 = __webpack_require__(1090);
|
|
|
2129
2129
|
const line_1 = __webpack_require__(9315);
|
|
2130
2130
|
|
|
2131
2131
|
function block(parser, separation = true) {
|
|
2132
|
-
return
|
|
2132
|
+
return input => {
|
|
2133
|
+
const {
|
|
2134
|
+
source,
|
|
2135
|
+
context
|
|
2136
|
+
} = input;
|
|
2133
2137
|
if (source === '') return;
|
|
2134
2138
|
context.memo ??= new memo_1.Memo();
|
|
2135
|
-
const result = parser(
|
|
2139
|
+
const result = parser(input);
|
|
2136
2140
|
if (!result) return;
|
|
2137
2141
|
const rest = (0, parser_1.exec)(result);
|
|
2138
2142
|
if (separation && !(0, line_1.isEmpty)((0, line_1.firstline)(rest))) return;
|
|
@@ -2165,10 +2169,13 @@ function validate(patterns, has, parser) {
|
|
|
2165
2169
|
if (typeof has === 'function') return validate(patterns, '', has);
|
|
2166
2170
|
if (!(0, alias_1.isArray)(patterns)) return validate([patterns], has, parser);
|
|
2167
2171
|
const match = (0, global_1.Function)(['"use strict";', 'return source =>', '0', ...patterns.map(pattern => typeof pattern === 'string' ? `|| source.slice(0, ${pattern.length}) === '${pattern}'` : `|| /${pattern.source}/${pattern.flags}.test(source)`)].join(''))();
|
|
2168
|
-
return
|
|
2172
|
+
return input => {
|
|
2173
|
+
const {
|
|
2174
|
+
source
|
|
2175
|
+
} = input;
|
|
2169
2176
|
if (source === '') return;
|
|
2170
2177
|
if (!match(source)) return;
|
|
2171
|
-
const result = parser(
|
|
2178
|
+
const result = parser(input);
|
|
2172
2179
|
if (!result) return;
|
|
2173
2180
|
return (0, parser_1.exec)(result).length < source.length ? result : global_1.undefined;
|
|
2174
2181
|
};
|
|
@@ -2177,11 +2184,14 @@ function validate(patterns, has, parser) {
|
|
|
2177
2184
|
exports.validate = validate;
|
|
2178
2185
|
|
|
2179
2186
|
function verify(parser, cond) {
|
|
2180
|
-
return
|
|
2187
|
+
return input => {
|
|
2188
|
+
const {
|
|
2189
|
+
source
|
|
2190
|
+
} = input;
|
|
2181
2191
|
if (source === '') return;
|
|
2182
|
-
const result = parser(
|
|
2192
|
+
const result = parser(input);
|
|
2183
2193
|
if (!result) return;
|
|
2184
|
-
if (!cond((0, parser_1.eval)(result), (0, parser_1.exec)(result), context)) return;
|
|
2194
|
+
if (!cond((0, parser_1.eval)(result), (0, parser_1.exec)(result), input.context)) return;
|
|
2185
2195
|
return (0, parser_1.exec)(result).length < source.length ? result : global_1.undefined;
|
|
2186
2196
|
};
|
|
2187
2197
|
}
|
|
@@ -2208,14 +2218,21 @@ const parser_1 = __webpack_require__(6728);
|
|
|
2208
2218
|
const memo_1 = __webpack_require__(1090);
|
|
2209
2219
|
|
|
2210
2220
|
function line(parser) {
|
|
2211
|
-
return
|
|
2221
|
+
return input => {
|
|
2222
|
+
const {
|
|
2223
|
+
source,
|
|
2224
|
+
context
|
|
2225
|
+
} = input;
|
|
2212
2226
|
if (source === '') return;
|
|
2213
2227
|
context.memo ??= new memo_1.Memo();
|
|
2214
2228
|
const line = firstline(source);
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
const result = parser(
|
|
2218
|
-
|
|
2229
|
+
context.offset ??= 0;
|
|
2230
|
+
context.offset += source.length - line.length;
|
|
2231
|
+
const result = parser({
|
|
2232
|
+
source: line,
|
|
2233
|
+
context
|
|
2234
|
+
});
|
|
2235
|
+
context.offset -= source.length - line.length;
|
|
2219
2236
|
if (!result) return;
|
|
2220
2237
|
return isEmpty((0, parser_1.exec)(result)) ? [(0, parser_1.eval)(result), source.slice(line.length)] : global_1.undefined;
|
|
2221
2238
|
};
|
|
@@ -2262,14 +2279,21 @@ exports.convert = void 0;
|
|
|
2262
2279
|
const parser_1 = __webpack_require__(6728);
|
|
2263
2280
|
|
|
2264
2281
|
function convert(conv, parser) {
|
|
2265
|
-
return
|
|
2282
|
+
return input => {
|
|
2283
|
+
const {
|
|
2284
|
+
source,
|
|
2285
|
+
context
|
|
2286
|
+
} = input;
|
|
2266
2287
|
if (source === '') return;
|
|
2267
2288
|
const src = conv(source);
|
|
2268
2289
|
if (src === '') return [[], ''];
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
const result = parser(
|
|
2272
|
-
|
|
2290
|
+
context.offset ??= 0;
|
|
2291
|
+
context.offset += source.length - src.length;
|
|
2292
|
+
const result = parser({
|
|
2293
|
+
source: src,
|
|
2294
|
+
context
|
|
2295
|
+
});
|
|
2296
|
+
context.offset -= source.length - src.length;
|
|
2273
2297
|
return result;
|
|
2274
2298
|
};
|
|
2275
2299
|
}
|
|
@@ -2336,7 +2360,10 @@ const line_1 = __webpack_require__(9315);
|
|
|
2336
2360
|
const array_1 = __webpack_require__(8112);
|
|
2337
2361
|
|
|
2338
2362
|
function fence(opener, limit, separation = true) {
|
|
2339
|
-
return
|
|
2363
|
+
return input => {
|
|
2364
|
+
const {
|
|
2365
|
+
source
|
|
2366
|
+
} = input;
|
|
2340
2367
|
if (source === '') return;
|
|
2341
2368
|
const matches = source.match(opener);
|
|
2342
2369
|
if (!matches) return;
|
|
@@ -2420,11 +2447,16 @@ const memoize_1 = __webpack_require__(1808);
|
|
|
2420
2447
|
|
|
2421
2448
|
function indent(opener, parser, separation = false) {
|
|
2422
2449
|
if (typeof opener === 'function') return indent(/^([ \t])\1*/, opener, parser);
|
|
2423
|
-
return (0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent,
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2450
|
+
return (0, bind_1.bind)((0, block_1.block)((0, match_1.match)(opener, (0, memoize_1.memoize)(([indent]) => (0, some_1.some)((0, line_1.line)((0, surround_1.open)(indent, ({
|
|
2451
|
+
source
|
|
2452
|
+
}) => [[source], '']))), ([indent]) => indent.length * 2 + +(indent[0] === ' '), [])), separation), (lines, rest, context) => {
|
|
2453
|
+
context.offset ??= 0;
|
|
2454
|
+
context.offset += rest.length;
|
|
2455
|
+
const result = parser({
|
|
2456
|
+
source: trimBlockEnd(lines.join('')),
|
|
2457
|
+
context
|
|
2458
|
+
});
|
|
2459
|
+
context.offset -= rest.length;
|
|
2428
2460
|
return result && (0, parser_1.exec)(result) === '' ? [(0, parser_1.eval)(result), rest] : global_1.undefined;
|
|
2429
2461
|
});
|
|
2430
2462
|
}
|
|
@@ -2450,7 +2482,7 @@ exports.lazy = void 0;
|
|
|
2450
2482
|
|
|
2451
2483
|
function lazy(builder) {
|
|
2452
2484
|
let parser;
|
|
2453
|
-
return
|
|
2485
|
+
return input => (parser ??= builder())(input);
|
|
2454
2486
|
}
|
|
2455
2487
|
|
|
2456
2488
|
exports.lazy = lazy;
|
|
@@ -2473,11 +2505,14 @@ const global_1 = __webpack_require__(4128);
|
|
|
2473
2505
|
const parser_1 = __webpack_require__(6728);
|
|
2474
2506
|
|
|
2475
2507
|
function match(pattern, f) {
|
|
2476
|
-
return
|
|
2508
|
+
return input => {
|
|
2509
|
+
const {
|
|
2510
|
+
source
|
|
2511
|
+
} = input;
|
|
2477
2512
|
if (source === '') return;
|
|
2478
2513
|
const param = source.match(pattern);
|
|
2479
2514
|
if (!param) return;
|
|
2480
|
-
const result = f(param)(
|
|
2515
|
+
const result = f(param)(input);
|
|
2481
2516
|
if (!result) return;
|
|
2482
2517
|
return (0, parser_1.exec)(result).length < source.length && (0, parser_1.exec)(result).length <= source.length ? result : global_1.undefined;
|
|
2483
2518
|
};
|
|
@@ -2499,11 +2534,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2499
2534
|
exports.recover = void 0;
|
|
2500
2535
|
|
|
2501
2536
|
function recover(parser, fallback) {
|
|
2502
|
-
return
|
|
2537
|
+
return input => {
|
|
2503
2538
|
try {
|
|
2504
|
-
return parser(
|
|
2539
|
+
return parser(input);
|
|
2505
2540
|
} catch (reason) {
|
|
2506
|
-
return fallback(
|
|
2541
|
+
return fallback(input, reason);
|
|
2507
2542
|
}
|
|
2508
2543
|
};
|
|
2509
2544
|
}
|
|
@@ -2550,14 +2585,21 @@ const parser_1 = __webpack_require__(6728);
|
|
|
2550
2585
|
|
|
2551
2586
|
function focus(scope, parser) {
|
|
2552
2587
|
const match = typeof scope === 'string' ? source => source.slice(0, scope.length) === scope ? scope : '' : source => source.match(scope)?.[0] ?? '';
|
|
2553
|
-
return
|
|
2588
|
+
return input => {
|
|
2589
|
+
const {
|
|
2590
|
+
source,
|
|
2591
|
+
context
|
|
2592
|
+
} = input;
|
|
2554
2593
|
if (source === '') return;
|
|
2555
2594
|
const src = match(source);
|
|
2556
2595
|
if (src === '') return;
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
const result = parser(
|
|
2560
|
-
|
|
2596
|
+
context.offset ??= 0;
|
|
2597
|
+
context.offset += source.length - src.length;
|
|
2598
|
+
const result = parser({
|
|
2599
|
+
source: src,
|
|
2600
|
+
context
|
|
2601
|
+
});
|
|
2602
|
+
context.offset -= source.length - src.length;
|
|
2561
2603
|
if (!result) return;
|
|
2562
2604
|
return (0, parser_1.exec)(result).length < src.length ? [(0, parser_1.eval)(result), (0, parser_1.exec)(result) + source.slice(src.length)] : global_1.undefined;
|
|
2563
2605
|
};
|
|
@@ -2566,17 +2608,25 @@ function focus(scope, parser) {
|
|
|
2566
2608
|
exports.focus = focus;
|
|
2567
2609
|
|
|
2568
2610
|
function rewrite(scope, parser) {
|
|
2569
|
-
return
|
|
2611
|
+
return input => {
|
|
2612
|
+
const {
|
|
2613
|
+
source,
|
|
2614
|
+
context
|
|
2615
|
+
} = input;
|
|
2570
2616
|
if (source === '') return;
|
|
2571
2617
|
const memo = context.memo;
|
|
2572
2618
|
context.memo = global_1.undefined;
|
|
2573
|
-
const res1 = scope(
|
|
2619
|
+
const res1 = scope(input);
|
|
2574
2620
|
context.memo = memo;
|
|
2575
2621
|
if (!res1 || (0, parser_1.exec)(res1).length >= source.length) return;
|
|
2576
2622
|
const src = source.slice(0, source.length - (0, parser_1.exec)(res1).length);
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2623
|
+
context.offset ??= 0;
|
|
2624
|
+
context.offset += source.length - src.length;
|
|
2625
|
+
const res2 = parser({
|
|
2626
|
+
source: src,
|
|
2627
|
+
context
|
|
2628
|
+
});
|
|
2629
|
+
context.offset -= source.length - src.length;
|
|
2580
2630
|
if (!res2) return;
|
|
2581
2631
|
return (0, parser_1.exec)(res2).length < src.length ? [(0, parser_1.eval)(res2), (0, parser_1.exec)(res2) + (0, parser_1.exec)(res1)] : global_1.undefined;
|
|
2582
2632
|
};
|
|
@@ -2618,17 +2668,30 @@ function surround(opener, parser, closer, optional = false, f, g) {
|
|
|
2618
2668
|
return surround(opener, parser, match(closer), optional, f, g);
|
|
2619
2669
|
}
|
|
2620
2670
|
|
|
2621
|
-
return
|
|
2671
|
+
return input => {
|
|
2672
|
+
const {
|
|
2673
|
+
source: lmr_,
|
|
2674
|
+
context
|
|
2675
|
+
} = input;
|
|
2622
2676
|
if (lmr_ === '') return;
|
|
2623
|
-
const res1 = opener(
|
|
2677
|
+
const res1 = opener({
|
|
2678
|
+
source: lmr_,
|
|
2679
|
+
context
|
|
2680
|
+
});
|
|
2624
2681
|
if (!res1) return;
|
|
2625
2682
|
const rl = (0, parser_1.eval)(res1);
|
|
2626
2683
|
const mr_ = (0, parser_1.exec)(res1);
|
|
2627
|
-
const res2 = mr_ !== '' ? parser(
|
|
2684
|
+
const res2 = mr_ !== '' ? parser({
|
|
2685
|
+
source: mr_,
|
|
2686
|
+
context
|
|
2687
|
+
}) : global_1.undefined;
|
|
2628
2688
|
const rm = (0, parser_1.eval)(res2);
|
|
2629
2689
|
const r_ = (0, parser_1.exec)(res2, mr_);
|
|
2630
2690
|
if (!rm && !optional) return;
|
|
2631
|
-
const res3 = closer(
|
|
2691
|
+
const res3 = closer({
|
|
2692
|
+
source: r_,
|
|
2693
|
+
context
|
|
2694
|
+
});
|
|
2632
2695
|
const rr = (0, parser_1.eval)(res3);
|
|
2633
2696
|
const rest = (0, parser_1.exec)(res3, r_);
|
|
2634
2697
|
if (rest.length === lmr_.length) return;
|
|
@@ -2641,10 +2704,14 @@ exports.surround = surround;
|
|
|
2641
2704
|
function match(pattern) {
|
|
2642
2705
|
switch (typeof pattern) {
|
|
2643
2706
|
case 'string':
|
|
2644
|
-
return
|
|
2707
|
+
return ({
|
|
2708
|
+
source
|
|
2709
|
+
}) => source.slice(0, pattern.length) === pattern ? [[], source.slice(pattern.length)] : global_1.undefined;
|
|
2645
2710
|
|
|
2646
2711
|
case 'object':
|
|
2647
|
-
return
|
|
2712
|
+
return ({
|
|
2713
|
+
source
|
|
2714
|
+
}) => {
|
|
2648
2715
|
const m = source.match(pattern);
|
|
2649
2716
|
return m ? [[], source.slice(m[0].length)] : global_1.undefined;
|
|
2650
2717
|
};
|
|
@@ -2720,9 +2787,13 @@ const global_1 = __webpack_require__(4128);
|
|
|
2720
2787
|
const parser_1 = __webpack_require__(6728);
|
|
2721
2788
|
|
|
2722
2789
|
function bind(parser, f) {
|
|
2723
|
-
return
|
|
2790
|
+
return input => {
|
|
2791
|
+
const {
|
|
2792
|
+
source,
|
|
2793
|
+
context
|
|
2794
|
+
} = input;
|
|
2724
2795
|
if (source === '') return;
|
|
2725
|
-
const res1 = parser(
|
|
2796
|
+
const res1 = parser(input);
|
|
2726
2797
|
if (!res1) return;
|
|
2727
2798
|
const res2 = f((0, parser_1.eval)(res1), (0, parser_1.exec)(res1), context);
|
|
2728
2799
|
if (!res2) return;
|
|
@@ -2808,7 +2879,10 @@ const memo_1 = __webpack_require__(1090);
|
|
|
2808
2879
|
function reset(base, parser) {
|
|
2809
2880
|
const changes = global_1.Object.entries(base);
|
|
2810
2881
|
const values = (0, global_1.Array)(changes.length);
|
|
2811
|
-
return (
|
|
2882
|
+
return ({
|
|
2883
|
+
source,
|
|
2884
|
+
context
|
|
2885
|
+
}) => apply(parser, source, (0, alias_1.ObjectCreate)(context), changes, values);
|
|
2812
2886
|
}
|
|
2813
2887
|
|
|
2814
2888
|
exports.reset = reset;
|
|
@@ -2816,7 +2890,10 @@ exports.reset = reset;
|
|
|
2816
2890
|
function context(base, parser) {
|
|
2817
2891
|
const changes = global_1.Object.entries(base);
|
|
2818
2892
|
const values = (0, global_1.Array)(changes.length);
|
|
2819
|
-
return (
|
|
2893
|
+
return ({
|
|
2894
|
+
source,
|
|
2895
|
+
context
|
|
2896
|
+
}) => apply(parser, source, context, changes, values);
|
|
2820
2897
|
}
|
|
2821
2898
|
|
|
2822
2899
|
exports.context = context;
|
|
@@ -2838,7 +2915,10 @@ function apply(parser, source, context, changes, values) {
|
|
|
2838
2915
|
context[prop] = change[1];
|
|
2839
2916
|
}
|
|
2840
2917
|
}
|
|
2841
|
-
const result = parser(
|
|
2918
|
+
const result = parser({
|
|
2919
|
+
source,
|
|
2920
|
+
context
|
|
2921
|
+
});
|
|
2842
2922
|
if (context) for (let i = 0; i < changes.length; ++i) {
|
|
2843
2923
|
const change = changes[i];
|
|
2844
2924
|
const prop = change[0];
|
|
@@ -2855,47 +2935,48 @@ function apply(parser, source, context, changes, values) {
|
|
|
2855
2935
|
return result;
|
|
2856
2936
|
}
|
|
2857
2937
|
|
|
2858
|
-
function syntax(syntax,
|
|
2859
|
-
return creation(cost, (
|
|
2938
|
+
function syntax(syntax, prec, cost, state, parser) {
|
|
2939
|
+
return creation(cost, precedence(prec, input => {
|
|
2940
|
+
const {
|
|
2941
|
+
source,
|
|
2942
|
+
context
|
|
2943
|
+
} = input;
|
|
2860
2944
|
if (source === '') return;
|
|
2861
2945
|
const memo = context.memo ??= new memo_1.Memo();
|
|
2862
2946
|
context.memorable ??= ~0;
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
const
|
|
2866
|
-
const
|
|
2867
|
-
const cache = syntax && memo.get(position, syntax,
|
|
2868
|
-
const result = cache ? cache.length === 0 ? global_1.undefined : [cache[0], source.slice(cache[1])] : parser(
|
|
2869
|
-
|
|
2870
|
-
if (syntax &&
|
|
2871
|
-
cache ?? memo.set(position, syntax,
|
|
2947
|
+
context.offset ??= 0;
|
|
2948
|
+
const position = source.length + context.offset;
|
|
2949
|
+
const st0 = context.state ?? 0;
|
|
2950
|
+
const st1 = context.state = st0 | state;
|
|
2951
|
+
const cache = syntax && memo.get(position, syntax, st1);
|
|
2952
|
+
const result = cache ? cache.length === 0 ? global_1.undefined : [cache[0], source.slice(cache[1])] : parser(input);
|
|
2953
|
+
|
|
2954
|
+
if (syntax && st0 & context.memorable) {
|
|
2955
|
+
cache ?? memo.set(position, syntax, st1, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
|
|
2872
2956
|
}
|
|
2873
2957
|
|
|
2874
|
-
if (result && !
|
|
2875
|
-
memo.clear(position);
|
|
2958
|
+
if (result && !st0 && memo.length >= position + 2) {
|
|
2959
|
+
memo.clear(position + 2);
|
|
2876
2960
|
}
|
|
2877
2961
|
|
|
2878
|
-
context.
|
|
2962
|
+
context.state = st0;
|
|
2879
2963
|
return result;
|
|
2880
|
-
});
|
|
2964
|
+
}));
|
|
2881
2965
|
}
|
|
2882
2966
|
|
|
2883
2967
|
exports.syntax = syntax;
|
|
2884
2968
|
|
|
2885
2969
|
function creation(cost, parser) {
|
|
2886
2970
|
if (typeof cost === 'function') return creation(1, cost);
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
recursion: 1
|
|
2893
|
-
}
|
|
2894
|
-
} = context;
|
|
2971
|
+
return input => {
|
|
2972
|
+
const resources = input.context.resources ?? {
|
|
2973
|
+
clock: 1,
|
|
2974
|
+
recursion: 1
|
|
2975
|
+
};
|
|
2895
2976
|
if (resources.clock <= 0) throw new Error('Too many creations');
|
|
2896
2977
|
if (resources.recursion <= 0) throw new Error('Too much recursion');
|
|
2897
2978
|
--resources.recursion;
|
|
2898
|
-
const result = parser(
|
|
2979
|
+
const result = parser(input);
|
|
2899
2980
|
++resources.recursion;
|
|
2900
2981
|
|
|
2901
2982
|
if (result) {
|
|
@@ -2909,10 +2990,13 @@ function creation(cost, parser) {
|
|
|
2909
2990
|
exports.creation = creation;
|
|
2910
2991
|
|
|
2911
2992
|
function precedence(precedence, parser) {
|
|
2912
|
-
return
|
|
2993
|
+
return input => {
|
|
2994
|
+
const {
|
|
2995
|
+
context
|
|
2996
|
+
} = input;
|
|
2913
2997
|
const p = context.precedence;
|
|
2914
2998
|
context.precedence = precedence;
|
|
2915
|
-
const result = parser(
|
|
2999
|
+
const result = parser(input);
|
|
2916
3000
|
context.precedence = p;
|
|
2917
3001
|
return result;
|
|
2918
3002
|
};
|
|
@@ -2921,7 +3005,7 @@ function precedence(precedence, parser) {
|
|
|
2921
3005
|
exports.precedence = precedence;
|
|
2922
3006
|
|
|
2923
3007
|
function guard(f, parser) {
|
|
2924
|
-
return
|
|
3008
|
+
return input => f(input.context) ? parser(input) : global_1.undefined;
|
|
2925
3009
|
}
|
|
2926
3010
|
|
|
2927
3011
|
exports.guard = guard;
|
|
@@ -2932,9 +3016,12 @@ function constraint(state, positive, parser) {
|
|
|
2932
3016
|
positive = true;
|
|
2933
3017
|
}
|
|
2934
3018
|
|
|
2935
|
-
return
|
|
3019
|
+
return input => {
|
|
3020
|
+
const {
|
|
3021
|
+
context
|
|
3022
|
+
} = input;
|
|
2936
3023
|
const s = positive ? state & context.state : state & ~context.state;
|
|
2937
|
-
return s === state ? parser(
|
|
3024
|
+
return s === state ? parser(input) : global_1.undefined;
|
|
2938
3025
|
};
|
|
2939
3026
|
}
|
|
2940
3027
|
|
|
@@ -2946,10 +3033,13 @@ function state(state, positive, parser) {
|
|
|
2946
3033
|
positive = true;
|
|
2947
3034
|
}
|
|
2948
3035
|
|
|
2949
|
-
return
|
|
3036
|
+
return input => {
|
|
3037
|
+
const {
|
|
3038
|
+
context
|
|
3039
|
+
} = input;
|
|
2950
3040
|
const s = context.state ?? 0;
|
|
2951
3041
|
context.state = positive ? s | state : s & ~state;
|
|
2952
|
-
const result = parser(
|
|
3042
|
+
const result = parser(input);
|
|
2953
3043
|
context.state = s;
|
|
2954
3044
|
return result;
|
|
2955
3045
|
};
|
|
@@ -3077,7 +3167,6 @@ exports.Memo = void 0;
|
|
|
3077
3167
|
class Memo {
|
|
3078
3168
|
constructor() {
|
|
3079
3169
|
this.memory = [];
|
|
3080
|
-
this.offset = 0;
|
|
3081
3170
|
}
|
|
3082
3171
|
|
|
3083
3172
|
get length() {
|
|
@@ -3086,19 +3175,19 @@ class Memo {
|
|
|
3086
3175
|
|
|
3087
3176
|
get(position, syntax, state) {
|
|
3088
3177
|
//console.log('get', position + this.offset, syntax, state, this.memory[position + this.offset - 1]?.[`${syntax}:${state}`]);;
|
|
3089
|
-
const cache = this.memory[position
|
|
3178
|
+
const cache = this.memory[position - 1]?.[`${syntax}:${state}`];
|
|
3090
3179
|
return cache?.length === 2 ? [cache[0].slice(), cache[1]] : cache;
|
|
3091
3180
|
}
|
|
3092
3181
|
|
|
3093
3182
|
set(position, syntax, state, nodes, offset) {
|
|
3094
|
-
const record = this.memory[position
|
|
3183
|
+
const record = this.memory[position - 1] ??= {};
|
|
3095
3184
|
record[`${syntax}:${state}`] = nodes ? [nodes.slice(), offset] : []; //console.log('set', position + this.offset, syntax, state, record[`${syntax}:${state}`]);
|
|
3096
3185
|
}
|
|
3097
3186
|
|
|
3098
3187
|
clear(position) {
|
|
3099
3188
|
const memory = this.memory;
|
|
3100
3189
|
|
|
3101
|
-
for (let i = position
|
|
3190
|
+
for (let i = position, len = memory.length; i < len; ++i) {
|
|
3102
3191
|
memory.pop();
|
|
3103
3192
|
} //console.log('clear', position + this.offset + 1);
|
|
3104
3193
|
|
|
@@ -3129,14 +3218,21 @@ const array_1 = __webpack_require__(8112);
|
|
|
3129
3218
|
|
|
3130
3219
|
function inits(parsers, resume) {
|
|
3131
3220
|
if (parsers.length === 1) return parsers[0];
|
|
3132
|
-
return
|
|
3221
|
+
return input => {
|
|
3222
|
+
const {
|
|
3223
|
+
source,
|
|
3224
|
+
context
|
|
3225
|
+
} = input;
|
|
3133
3226
|
let rest = source;
|
|
3134
3227
|
let nodes;
|
|
3135
3228
|
|
|
3136
3229
|
for (let i = 0, len = parsers.length; i < len; ++i) {
|
|
3137
3230
|
if (rest === '') break;
|
|
3138
3231
|
if (context.delimiters?.match(rest, context.precedence)) break;
|
|
3139
|
-
const result = parsers[i](
|
|
3232
|
+
const result = parsers[i]({
|
|
3233
|
+
source: rest,
|
|
3234
|
+
context
|
|
3235
|
+
});
|
|
3140
3236
|
if (!result) break;
|
|
3141
3237
|
nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
|
|
3142
3238
|
rest = (0, parser_1.exec)(result);
|
|
@@ -3170,14 +3266,21 @@ const array_1 = __webpack_require__(8112);
|
|
|
3170
3266
|
|
|
3171
3267
|
function sequence(parsers, resume) {
|
|
3172
3268
|
if (parsers.length === 1) return parsers[0];
|
|
3173
|
-
return
|
|
3269
|
+
return input => {
|
|
3270
|
+
const {
|
|
3271
|
+
source,
|
|
3272
|
+
context
|
|
3273
|
+
} = input;
|
|
3174
3274
|
let rest = source;
|
|
3175
3275
|
let nodes;
|
|
3176
3276
|
|
|
3177
3277
|
for (let i = 0, len = parsers.length; i < len; ++i) {
|
|
3178
3278
|
if (rest === '') return;
|
|
3179
3279
|
if (context.delimiters?.match(rest, context.precedence)) return;
|
|
3180
|
-
const result = parsers[i](
|
|
3280
|
+
const result = parsers[i]({
|
|
3281
|
+
source: rest,
|
|
3282
|
+
context
|
|
3283
|
+
});
|
|
3181
3284
|
if (!result) return;
|
|
3182
3285
|
nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
|
|
3183
3286
|
rest = (0, parser_1.exec)(result);
|
|
@@ -3219,7 +3322,11 @@ function some(parser, end, delimiters = [], limit = -1) {
|
|
|
3219
3322
|
matcher: delimiter_1.Delimiters.matcher(delimiter),
|
|
3220
3323
|
precedence
|
|
3221
3324
|
}));
|
|
3222
|
-
return
|
|
3325
|
+
return input => {
|
|
3326
|
+
const {
|
|
3327
|
+
source,
|
|
3328
|
+
context
|
|
3329
|
+
} = input;
|
|
3223
3330
|
if (source === '') return;
|
|
3224
3331
|
let rest = source;
|
|
3225
3332
|
let nodes;
|
|
@@ -3233,7 +3340,10 @@ function some(parser, end, delimiters = [], limit = -1) {
|
|
|
3233
3340
|
if (rest === '') break;
|
|
3234
3341
|
if (match(rest)) break;
|
|
3235
3342
|
if (context.delimiters?.match(rest, context.precedence)) break;
|
|
3236
|
-
const result = parser(
|
|
3343
|
+
const result = parser({
|
|
3344
|
+
source: rest,
|
|
3345
|
+
context
|
|
3346
|
+
});
|
|
3237
3347
|
if (!result) break;
|
|
3238
3348
|
nodes = nodes ? nodes.length < (0, parser_1.eval)(result).length ? (0, array_1.unshift)(nodes, (0, parser_1.eval)(result)) : (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
|
|
3239
3349
|
rest = (0, parser_1.exec)(result);
|
|
@@ -3320,7 +3430,7 @@ function union(parsers) {
|
|
|
3320
3430
|
return parsers[0];
|
|
3321
3431
|
|
|
3322
3432
|
default:
|
|
3323
|
-
return (0, global_1.Function)('parsers', ['"use strict";', 'return (
|
|
3433
|
+
return (0, global_1.Function)('parsers', ['"use strict";', 'return (input, context) =>', '0', ...parsers.map((_, i) => `|| parsers[${i}](input, context)`)].join('\n'))(parsers);
|
|
3324
3434
|
}
|
|
3325
3435
|
}
|
|
3326
3436
|
|
|
@@ -3459,8 +3569,6 @@ const header_1 = __webpack_require__(5702);
|
|
|
3459
3569
|
|
|
3460
3570
|
const block_1 = __webpack_require__(4032);
|
|
3461
3571
|
|
|
3462
|
-
const context_1 = __webpack_require__(6484);
|
|
3463
|
-
|
|
3464
3572
|
const normalize_1 = __webpack_require__(185);
|
|
3465
3573
|
|
|
3466
3574
|
const header_2 = __webpack_require__(7790);
|
|
@@ -3476,7 +3584,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
3476
3584
|
function bind(target, settings) {
|
|
3477
3585
|
let context = { ...settings,
|
|
3478
3586
|
host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
|
|
3479
|
-
memorable:
|
|
3587
|
+
memorable: 118
|
|
3588
|
+
/* State.backtrackable */
|
|
3589
|
+
|
|
3480
3590
|
};
|
|
3481
3591
|
if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
|
|
3482
3592
|
const blocks = [];
|
|
@@ -3530,9 +3640,15 @@ function bind(target, settings) {
|
|
|
3530
3640
|
|
|
3531
3641
|
for (; index < sourceSegments.length - last; ++index) {
|
|
3532
3642
|
const seg = sourceSegments[index];
|
|
3533
|
-
const es = (0, parser_1.eval)((0, header_1.header)(
|
|
3534
|
-
|
|
3535
|
-
|
|
3643
|
+
const es = (0, parser_1.eval)((0, header_1.header)({
|
|
3644
|
+
source: seg,
|
|
3645
|
+
context: {
|
|
3646
|
+
header: index === 0
|
|
3647
|
+
}
|
|
3648
|
+
}) || (0, block_1.block)({
|
|
3649
|
+
source: seg,
|
|
3650
|
+
context
|
|
3651
|
+
}), []);
|
|
3536
3652
|
blocks.splice(index, 0, [seg, es, url]);
|
|
3537
3653
|
if (es.length === 0) continue; // All deletion processes always run after all addition processes have done.
|
|
3538
3654
|
// Therefore any `base` node will never be unavailable by deletions until all the dependent `el` nodes are added.
|
|
@@ -3717,7 +3833,10 @@ function headers(source) {
|
|
|
3717
3833
|
exports.headers = headers;
|
|
3718
3834
|
|
|
3719
3835
|
function parse(source) {
|
|
3720
|
-
const result = (0, header_1.header)(
|
|
3836
|
+
const result = (0, header_1.header)({
|
|
3837
|
+
source,
|
|
3838
|
+
context: {}
|
|
3839
|
+
});
|
|
3721
3840
|
const [el] = (0, parser_1.eval)(result, []);
|
|
3722
3841
|
return el?.tagName === 'ASIDE' ? [el, (0, parser_1.exec)(result)] : [];
|
|
3723
3842
|
}
|
|
@@ -3759,7 +3878,10 @@ function sanitize(source) {
|
|
|
3759
3878
|
|
|
3760
3879
|
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'];
|
|
3761
3880
|
const unreadableHTMLEntityNames = exports.invisibleHTMLEntityNames.slice(2);
|
|
3762
|
-
const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(
|
|
3881
|
+
const unreadableEscapableCharacters = unreadableHTMLEntityNames.map(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)({
|
|
3882
|
+
source: `&${name};`,
|
|
3883
|
+
context: {}
|
|
3884
|
+
}))[0]);
|
|
3763
3885
|
const unreadableEscapableCharacter = new RegExp(`[${[...new Set(unreadableEscapableCharacters)].join('')}]`, 'g');
|
|
3764
3886
|
// https://www.pandanoir.info/entry/2018/03/11/193000
|
|
3765
3887
|
// http://anti.rosx.net/etc/memo/002_space.html
|
|
@@ -3810,8 +3932,6 @@ const header_1 = __webpack_require__(5702);
|
|
|
3810
3932
|
|
|
3811
3933
|
const block_1 = __webpack_require__(4032);
|
|
3812
3934
|
|
|
3813
|
-
const context_1 = __webpack_require__(6484);
|
|
3814
|
-
|
|
3815
3935
|
const normalize_1 = __webpack_require__(185);
|
|
3816
3936
|
|
|
3817
3937
|
const header_2 = __webpack_require__(7790);
|
|
@@ -3836,16 +3956,24 @@ function parse(source, opts = {}, context) {
|
|
|
3836
3956
|
...(context?.resources && {
|
|
3837
3957
|
resources: context.resources
|
|
3838
3958
|
}),
|
|
3839
|
-
memorable:
|
|
3959
|
+
memorable: 118
|
|
3960
|
+
/* State.backtrackable */
|
|
3961
|
+
|
|
3840
3962
|
};
|
|
3841
3963
|
if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
|
|
3842
3964
|
const node = (0, dom_1.frag)();
|
|
3843
3965
|
let index = 0;
|
|
3844
3966
|
|
|
3845
3967
|
for (const seg of (0, segment_1.segment)(source)) {
|
|
3846
|
-
node.append(...(0, parser_1.eval)((0, header_1.header)(
|
|
3847
|
-
|
|
3848
|
-
|
|
3968
|
+
node.append(...(0, parser_1.eval)((0, header_1.header)({
|
|
3969
|
+
source: seg,
|
|
3970
|
+
context: {
|
|
3971
|
+
header: index++ === 0
|
|
3972
|
+
}
|
|
3973
|
+
}) || (0, block_1.block)({
|
|
3974
|
+
source: seg,
|
|
3975
|
+
context
|
|
3976
|
+
}), []));
|
|
3849
3977
|
}
|
|
3850
3978
|
|
|
3851
3979
|
if (opts.test) return node;
|
|
@@ -3880,7 +4008,10 @@ const source_1 = __webpack_require__(6743);
|
|
|
3880
4008
|
|
|
3881
4009
|
const delimiter = /[@#>0-9A-Za-z\n]|\S[#>]/;
|
|
3882
4010
|
|
|
3883
|
-
const autolink = (
|
|
4011
|
+
const autolink = ({
|
|
4012
|
+
source,
|
|
4013
|
+
context
|
|
4014
|
+
}) => {
|
|
3884
4015
|
if (source === '') return;
|
|
3885
4016
|
const i = source.search(delimiter);
|
|
3886
4017
|
|
|
@@ -3889,7 +4020,10 @@ const autolink = (source, context) => {
|
|
|
3889
4020
|
return [[source], ''];
|
|
3890
4021
|
|
|
3891
4022
|
case 0:
|
|
3892
|
-
return parser(
|
|
4023
|
+
return parser({
|
|
4024
|
+
source,
|
|
4025
|
+
context
|
|
4026
|
+
});
|
|
3893
4027
|
|
|
3894
4028
|
default:
|
|
3895
4029
|
return [[source.slice(0, i)], source.slice(i)];
|
|
@@ -3958,10 +4092,15 @@ exports.block = (0, combinator_1.creation)(error((0, combinator_1.reset)({
|
|
|
3958
4092
|
}, (0, combinator_1.union)([source_1.emptyline, horizontalrule_1.horizontalrule, heading_1.heading, ulist_1.ulist, olist_1.olist, ilist_1.ilist, dlist_1.dlist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, extension_1.extension, sidefence_1.sidefence, blockquote_1.blockquote, reply_1.reply, paragraph_1.paragraph]))));
|
|
3959
4093
|
|
|
3960
4094
|
function error(parser) {
|
|
3961
|
-
return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)('\x07',
|
|
4095
|
+
return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)('\x07', ({
|
|
4096
|
+
source
|
|
4097
|
+
}) => {
|
|
3962
4098
|
throw new Error(source.split('\n', 1)[0]);
|
|
3963
|
-
}), parser), (
|
|
3964
|
-
|
|
4099
|
+
}), parser), ({
|
|
4100
|
+
source,
|
|
4101
|
+
context: {
|
|
4102
|
+
id
|
|
4103
|
+
}
|
|
3965
4104
|
}, reason) => [[(0, dom_1.html)('h1', {
|
|
3966
4105
|
id: id !== '' ? `error:${(0, random_1.rnd0Z)(8)}` : global_1.undefined,
|
|
3967
4106
|
class: 'error'
|
|
@@ -4002,7 +4141,10 @@ const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combin
|
|
|
4002
4141
|
const unindent = source => source.replace(/(^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$/g, '$1');
|
|
4003
4142
|
|
|
4004
4143
|
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)((0, combinator_1.some)(autolink_1.autolink), ns => [(0, dom_1.html)('pre', (0, dom_1.defrag)(ns))])))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
|
|
4005
|
-
const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown)), (0, combinator_1.creation)(99, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (
|
|
4144
|
+
const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown)), (0, combinator_1.creation)(99, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
|
|
4145
|
+
source,
|
|
4146
|
+
context
|
|
4147
|
+
}) => {
|
|
4006
4148
|
const references = (0, dom_1.html)('ol', {
|
|
4007
4149
|
class: 'references'
|
|
4008
4150
|
});
|
|
@@ -4083,7 +4225,10 @@ exports.codeblock = (0, combinator_1.block)((0, combinator_1.validate)('```', (0
|
|
|
4083
4225
|
'data-lang': params.lang || global_1.undefined,
|
|
4084
4226
|
'data-line': params.line || global_1.undefined,
|
|
4085
4227
|
'data-path': params.path || global_1.undefined
|
|
4086
|
-
}, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || global_1.undefined : (0, dom_1.defrag)((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)(
|
|
4228
|
+
}, params.lang ? context.caches?.code?.get(`${params.lang ?? ''}\n${body.slice(0, -1)}`)?.cloneNode(true).childNodes || body.slice(0, -1) || global_1.undefined : (0, dom_1.defrag)((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)({
|
|
4229
|
+
source: body.slice(0, -1),
|
|
4230
|
+
context
|
|
4231
|
+
}), [])));
|
|
4087
4232
|
return [el];
|
|
4088
4233
|
})));
|
|
4089
4234
|
|
|
@@ -4283,7 +4428,10 @@ exports.example = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
|
|
|
4283
4428
|
'data-type': 'math'
|
|
4284
4429
|
}, [(0, dom_1.html)('pre', {
|
|
4285
4430
|
translate: 'no'
|
|
4286
|
-
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)(
|
|
4431
|
+
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, parser_1.eval)((0, mathblock_1.mathblock)({
|
|
4432
|
+
source: `$$\n${body}$$`,
|
|
4433
|
+
context
|
|
4434
|
+
}), [])[0]])];
|
|
4287
4435
|
|
|
4288
4436
|
default:
|
|
4289
4437
|
return [(0, dom_1.html)('pre', {
|
|
@@ -4429,7 +4577,10 @@ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinat
|
|
|
4429
4577
|
} || overflow && {
|
|
4430
4578
|
'data-invalid-type': 'fence',
|
|
4431
4579
|
'data-invalid-message': `Invalid trailing line after the closing delimiter "${delim}"`
|
|
4432
|
-
} || !(0, label_1.segment)(
|
|
4580
|
+
} || !(0, label_1.segment)({
|
|
4581
|
+
source: opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)?.[1] ?? '',
|
|
4582
|
+
context
|
|
4583
|
+
}) && {
|
|
4433
4584
|
'data-invalid-type': 'label',
|
|
4434
4585
|
'data-invalid-message': 'Invalid label'
|
|
4435
4586
|
} || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && {
|
|
@@ -4589,7 +4740,10 @@ exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
|
|
|
4589
4740
|
return [(0, dom_1.html)('section', {
|
|
4590
4741
|
class: `message`,
|
|
4591
4742
|
'data-type': type
|
|
4592
|
-
}, (0, array_1.unshift)([(0, dom_1.html)('h1', title(type))], [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, parser_1.eval)(content(
|
|
4743
|
+
}, (0, array_1.unshift)([(0, dom_1.html)('h1', title(type))], [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, parser_1.eval)(content({
|
|
4744
|
+
source: seg,
|
|
4745
|
+
context
|
|
4746
|
+
}), [])), [])))];
|
|
4593
4747
|
})));
|
|
4594
4748
|
|
|
4595
4749
|
function title(type) {
|
|
@@ -4683,7 +4837,10 @@ exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
|
|
|
4683
4837
|
switch (type) {
|
|
4684
4838
|
case 'grid':
|
|
4685
4839
|
case global_1.undefined:
|
|
4686
|
-
return ((0, parser_1.eval)(parser(
|
|
4840
|
+
return ((0, parser_1.eval)(parser({
|
|
4841
|
+
source: body,
|
|
4842
|
+
context
|
|
4843
|
+
})) ?? [(0, dom_1.html)('table')]).map(el => (0, dom_1.define)(el, {
|
|
4687
4844
|
'data-type': type
|
|
4688
4845
|
}));
|
|
4689
4846
|
|
|
@@ -4938,7 +5095,9 @@ const visibility_1 = __webpack_require__(7618);
|
|
|
4938
5095
|
|
|
4939
5096
|
const dom_1 = __webpack_require__(3252);
|
|
4940
5097
|
|
|
4941
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/, (0, combinator_1.some)((0, combinator_1.line)(
|
|
5098
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/^#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/, (0, combinator_1.some)((0, combinator_1.line)(({
|
|
5099
|
+
source
|
|
5100
|
+
}) => [[source], ''])))));
|
|
4942
5101
|
exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.state)(64
|
|
4943
5102
|
/* State.annotation */
|
|
4944
5103
|
| 32
|
|
@@ -5085,8 +5244,6 @@ const duff_1 = __webpack_require__(8099);
|
|
|
5085
5244
|
|
|
5086
5245
|
const array_1 = __webpack_require__(8112);
|
|
5087
5246
|
|
|
5088
|
-
const tuple_1 = __webpack_require__(5341);
|
|
5089
|
-
|
|
5090
5247
|
const openers = {
|
|
5091
5248
|
'.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?:$|\s)/,
|
|
5092
5249
|
'(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?:$|\s)/
|
|
@@ -5101,10 +5258,18 @@ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, c
|
|
|
5101
5258
|
}, (0, dom_1.defrag)((0, ulist_1.fillFirstLine)((0, array_1.shift)(ns)[1])))]), true)]))), es => [format((0, dom_1.html)('ol', es), type, form)]);
|
|
5102
5259
|
|
|
5103
5260
|
const heads = {
|
|
5104
|
-
'.': (0, combinator_1.focus)(openers['.'],
|
|
5105
|
-
|
|
5261
|
+
'.': (0, combinator_1.focus)(openers['.'], ({
|
|
5262
|
+
source
|
|
5263
|
+
}) => [[source.trimEnd().split('.', 1)[0] + '.'], '']),
|
|
5264
|
+
'(': (0, combinator_1.focus)(openers['('], ({
|
|
5265
|
+
source
|
|
5266
|
+
}) => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')], ''])
|
|
5106
5267
|
};
|
|
5107
|
-
exports.invalid = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(
|
|
5268
|
+
exports.invalid = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(({
|
|
5269
|
+
source
|
|
5270
|
+
}) => [[source], ''])]), ({
|
|
5271
|
+
source
|
|
5272
|
+
}) => [['', (0, dom_1.html)('span', {
|
|
5108
5273
|
class: 'invalid',
|
|
5109
5274
|
'data-invalid-syntax': 'listitem',
|
|
5110
5275
|
'data-invalid-type': 'syntax',
|
|
@@ -5285,8 +5450,16 @@ exports.cite = (0, combinator_1.creation)((0, combinator_1.line)((0, combinator_
|
|
|
5285
5450
|
// リンクの実装は後で検討
|
|
5286
5451
|
(0, combinator_1.focus)(/^>>\.[^\S\n]*(?:$|\n)/, () => [[(0, dom_1.html)('a', {
|
|
5287
5452
|
class: 'anchor'
|
|
5288
|
-
}, '>>.')], '']), (0, combinator_1.focus)(/^>>#\S*[^\S\n]*(?:$|\n)/,
|
|
5453
|
+
}, '>>.')], '']), (0, combinator_1.focus)(/^>>#\S*[^\S\n]*(?:$|\n)/, ({
|
|
5454
|
+
source
|
|
5455
|
+
}) => [[(0, dom_1.html)('a', {
|
|
5289
5456
|
class: 'anchor'
|
|
5457
|
+
}, source)], '']), (0, combinator_1.focus)(/^>>https?:\/\/\w\S*[^\S\n]*(?:$|\n)/, ({
|
|
5458
|
+
source
|
|
5459
|
+
}) => [[(0, dom_1.html)('a', {
|
|
5460
|
+
class: 'anchor',
|
|
5461
|
+
href: source.slice(2).trimEnd(),
|
|
5462
|
+
target: '_blank'
|
|
5290
5463
|
}, source)], ''])])]))), ([el, quotes = '']) => [(0, dom_1.html)('span', {
|
|
5291
5464
|
class: 'cite'
|
|
5292
5465
|
}, (0, dom_1.defrag)([`${quotes}>`, (0, dom_1.define)(el, {
|
|
@@ -5328,12 +5501,18 @@ exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, comb
|
|
|
5328
5501
|
'data-invalid-message': `Missing the whitespace after "${ns[0].split(/[^>]/, 1)[0]}"`
|
|
5329
5502
|
}, (0, dom_1.defrag)(ns)), (0, dom_1.html)('br')]), false)));
|
|
5330
5503
|
|
|
5331
|
-
const qblock = (
|
|
5504
|
+
const qblock = ({
|
|
5505
|
+
source,
|
|
5506
|
+
context
|
|
5507
|
+
}) => {
|
|
5332
5508
|
source = source.replace(/\n$/, '');
|
|
5333
5509
|
const lines = source.match(/^.*\n?/mg);
|
|
5334
5510
|
const quotes = source.match(/^>+[^\S\n]/mg);
|
|
5335
5511
|
const content = lines.reduce((acc, line, row) => acc + line.slice(quotes[row].length), '');
|
|
5336
|
-
const nodes = (0, parser_1.eval)((0, combinator_1.some)(text)(
|
|
5512
|
+
const nodes = (0, parser_1.eval)((0, combinator_1.some)(text)({
|
|
5513
|
+
source: content,
|
|
5514
|
+
context
|
|
5515
|
+
}), []);
|
|
5337
5516
|
nodes.unshift(quotes.shift());
|
|
5338
5517
|
|
|
5339
5518
|
for (let i = 0; i < nodes.length; ++i) {
|
|
@@ -5427,7 +5606,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
5427
5606
|
|
|
5428
5607
|
exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^\|[^\n]*(?:\n\|[^\n]*){2}/, (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 => [(0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift()]), (0, dom_1.html)('tbody', format(rows))])])));
|
|
5429
5608
|
|
|
5430
|
-
const row = (parser, optional) => (0, combinator_1.creation)((0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^[|\\]?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline,
|
|
5609
|
+
const row = (parser, optional) => (0, combinator_1.creation)((0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^[|\\]?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, ({
|
|
5610
|
+
source
|
|
5611
|
+
}) => [[(0, dom_1.html)('tr', {
|
|
5431
5612
|
class: 'invalid',
|
|
5432
5613
|
'data-invalid-syntax': 'table-row',
|
|
5433
5614
|
'data-invalid-type': 'syntax',
|
|
@@ -5487,7 +5668,9 @@ exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
|
|
|
5487
5668
|
/* State.media */
|
|
5488
5669
|
, exports.ulist_))));
|
|
5489
5670
|
exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creation)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.subsequence)([exports.checkbox, (0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))]), true)), (0, combinator_1.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), olist_1.invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)(fillFirstLine(ns)))]), true)])))), es => [format((0, dom_1.html)('ul', es))])));
|
|
5490
|
-
exports.checkbox = (0, combinator_1.creation)((0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/,
|
|
5671
|
+
exports.checkbox = (0, combinator_1.creation)((0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, ({
|
|
5672
|
+
source
|
|
5673
|
+
}) => [[(0, dom_1.html)('span', {
|
|
5491
5674
|
class: 'checkbox'
|
|
5492
5675
|
}, source[1].trimStart() ? '☑' : '☐')], '']));
|
|
5493
5676
|
|
|
@@ -5507,30 +5690,6 @@ function format(el) {
|
|
|
5507
5690
|
|
|
5508
5691
|
/***/ }),
|
|
5509
5692
|
|
|
5510
|
-
/***/ 6484:
|
|
5511
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
5512
|
-
|
|
5513
|
-
"use strict";
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
5517
|
-
value: true
|
|
5518
|
-
}));
|
|
5519
|
-
exports.backtrackable = void 0;
|
|
5520
|
-
exports.backtrackable = 0 | 64
|
|
5521
|
-
/* State.annotation */
|
|
5522
|
-
| 32
|
|
5523
|
-
/* State.reference */
|
|
5524
|
-
| 16
|
|
5525
|
-
/* State.index */
|
|
5526
|
-
| 4
|
|
5527
|
-
/* State.link */
|
|
5528
|
-
| 2
|
|
5529
|
-
/* State.media */
|
|
5530
|
-
;
|
|
5531
|
-
|
|
5532
|
-
/***/ }),
|
|
5533
|
-
|
|
5534
5693
|
/***/ 5702:
|
|
5535
5694
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
5536
5695
|
|
|
@@ -5552,18 +5711,25 @@ const normalize_1 = __webpack_require__(185);
|
|
|
5552
5711
|
|
|
5553
5712
|
const dom_1 = __webpack_require__(3252);
|
|
5554
5713
|
|
|
5555
|
-
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^---+[^\S\v\f\r\n]*\r?\n[^\S\n]*(?=\S)/, (0, combinator_1.inits)([(0, combinator_1.rewrite)((
|
|
5714
|
+
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^---+[^\S\v\f\r\n]*\r?\n[^\S\n]*(?=\S)/, (0, combinator_1.inits)([(0, combinator_1.rewrite)(({
|
|
5715
|
+
source,
|
|
5716
|
+
context
|
|
5717
|
+
}) => [[], context.header ?? true ? source.slice((0, segment_1.segment)(source).next().value.length) : ''], (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.guard)(context => context.header ?? true, (0, combinator_1.focus)(/^---[^\S\v\f\r\n]*\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[A-Za-z][0-9A-Za-z]*)*:[ \t]+\S[^\v\f\r\n]*\r?\n){1,100}---[^\S\v\f\r\n]*(?:$|\r?\n)/, (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])), es => [(0, dom_1.html)('aside', {
|
|
5556
5718
|
class: 'header'
|
|
5557
5719
|
}, [(0, dom_1.html)('details', {
|
|
5558
5720
|
open: ''
|
|
5559
|
-
}, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])])))),
|
|
5721
|
+
}, (0, dom_1.defrag)([(0, dom_1.html)('summary', 'Header'), ...es]))])])))), ({
|
|
5722
|
+
source
|
|
5723
|
+
}) => [[(0, dom_1.html)('pre', {
|
|
5560
5724
|
class: 'invalid',
|
|
5561
5725
|
translate: 'no',
|
|
5562
5726
|
'data-invalid-syntax': 'header',
|
|
5563
5727
|
'data-invalid-type': 'syntax',
|
|
5564
5728
|
'data-invalid-message': 'Invalid syntax'
|
|
5565
5729
|
}, (0, normalize_1.normalize)(source))], '']]))), (0, combinator_1.clear)((0, source_1.str)(/^[^\S\v\f\r\n]*\r?\n/))])));
|
|
5566
|
-
const field = (0, combinator_1.line)(
|
|
5730
|
+
const field = (0, combinator_1.line)(({
|
|
5731
|
+
source
|
|
5732
|
+
}) => {
|
|
5567
5733
|
const name = source.slice(0, source.indexOf(':'));
|
|
5568
5734
|
const value = source.slice(name.length + 1).trim();
|
|
5569
5735
|
return [[(0, dom_1.html)('span', {
|
|
@@ -5701,15 +5867,15 @@ const dom_1 = __webpack_require__(3252);
|
|
|
5701
5867
|
|
|
5702
5868
|
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((', (0, combinator_1.constraint)(64
|
|
5703
5869
|
/* State.annotation */
|
|
5704
|
-
, false, (0, combinator_1.
|
|
5870
|
+
, false, (0, combinator_1.syntax)(32
|
|
5871
|
+
/* Syntax.annotation */
|
|
5872
|
+
, 6, 1, 64
|
|
5705
5873
|
/* State.annotation */
|
|
5706
5874
|
| 2
|
|
5707
5875
|
/* State.media */
|
|
5708
|
-
, (0, combinator_1.
|
|
5709
|
-
/* Syntax.annotation */
|
|
5710
|
-
, 6, 1, (0, visibility_1.startLoose)((0, combinator_1.context)({
|
|
5876
|
+
, (0, visibility_1.startLoose)((0, combinator_1.context)({
|
|
5711
5877
|
delimiters: global_1.undefined
|
|
5712
|
-
}, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')))
|
|
5878
|
+
}, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')'))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
|
|
5713
5879
|
class: 'annotation'
|
|
5714
5880
|
}, [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
|
|
5715
5881
|
|
|
@@ -5750,7 +5916,9 @@ exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-
|
|
|
5750
5916
|
/* State.autolink */
|
|
5751
5917
|
, false, (0, combinator_1.syntax)(2
|
|
5752
5918
|
/* Syntax.autolink */
|
|
5753
|
-
, 1, 1,
|
|
5919
|
+
, 1, 1, 0
|
|
5920
|
+
/* State.none */
|
|
5921
|
+
, (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
|
|
5754
5922
|
(0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*(?:@(?:[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)*/), channel_1.channel, account_1.account, // Escape unmatched account-like strings.
|
|
5755
5923
|
(0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), // Escape invalid leading characters.
|
|
5756
5924
|
(0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum, // Escape unmatched hashtag-like strings.
|
|
@@ -5866,7 +6034,9 @@ const source_1 = __webpack_require__(6743);
|
|
|
5866
6034
|
const dom_1 = __webpack_require__(3252); // https://html.spec.whatwg.org/multipage/input.html
|
|
5867
6035
|
|
|
5868
6036
|
|
|
5869
|
-
exports.email = (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*@[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*(?![0-9A-Za-z])/), ([source]) => source.indexOf('@') <= 64 && source.length <= 255),
|
|
6037
|
+
exports.email = (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*@[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*(?![0-9A-Za-z])/), ([source]) => source.indexOf('@') <= 64 && source.length <= 255), ({
|
|
6038
|
+
source
|
|
6039
|
+
}) => [[(0, dom_1.html)('a', {
|
|
5870
6040
|
class: 'email',
|
|
5871
6041
|
href: `mailto:${source}`
|
|
5872
6042
|
}, source)], '']));
|
|
@@ -5978,24 +6148,38 @@ const array_1 = __webpack_require__(8112);
|
|
|
5978
6148
|
const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
|
|
5979
6149
|
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(0
|
|
5980
6150
|
/* Syntax.none */
|
|
5981
|
-
, 2, 1,
|
|
6151
|
+
, 2, 1, 0
|
|
6152
|
+
/* State.none */
|
|
6153
|
+
, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
|
|
5982
6154
|
/* Syntax.bracket */
|
|
5983
|
-
, 2, 1,
|
|
6155
|
+
, 2, 1, 0
|
|
6156
|
+
/* State.none */
|
|
6157
|
+
, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
|
|
5984
6158
|
class: 'paren'
|
|
5985
6159
|
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(0
|
|
5986
6160
|
/* Syntax.none */
|
|
5987
|
-
, 2, 1,
|
|
6161
|
+
, 2, 1, 0
|
|
6162
|
+
/* State.none */
|
|
6163
|
+
, (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
|
|
5988
6164
|
/* Syntax.bracket */
|
|
5989
|
-
, 2, 1,
|
|
6165
|
+
, 2, 1, 0
|
|
6166
|
+
/* State.none */
|
|
6167
|
+
, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
|
|
5990
6168
|
class: 'paren'
|
|
5991
6169
|
}, (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.syntax)(128
|
|
5992
6170
|
/* Syntax.bracket */
|
|
5993
|
-
, 2, 1,
|
|
6171
|
+
, 2, 1, 0
|
|
6172
|
+
/* State.none */
|
|
6173
|
+
, (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.syntax)(128
|
|
5994
6174
|
/* Syntax.bracket */
|
|
5995
|
-
, 2, 1,
|
|
6175
|
+
, 2, 1, 0
|
|
6176
|
+
/* State.none */
|
|
6177
|
+
, (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
|
|
5996
6178
|
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.syntax)(1
|
|
5997
6179
|
/* Syntax.quote */
|
|
5998
|
-
, 8, 1,
|
|
6180
|
+
, 8, 1, 0
|
|
6181
|
+
/* State.none */
|
|
6182
|
+
, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
|
|
5999
6183
|
|
|
6000
6184
|
/***/ }),
|
|
6001
6185
|
|
|
@@ -6014,9 +6198,11 @@ const combinator_1 = __webpack_require__(2087);
|
|
|
6014
6198
|
|
|
6015
6199
|
const dom_1 = __webpack_require__(3252);
|
|
6016
6200
|
|
|
6017
|
-
exports.code = (0, combinator_1.creation)((0, combinator_1.validate)('`', (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?[^`\n])\1(?!`)/, ([whole,, body]) =>
|
|
6201
|
+
exports.code = (0, combinator_1.creation)((0, combinator_1.validate)('`', (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?[^`\n])\1(?!`)/, ([whole,, body]) => ({
|
|
6202
|
+
source
|
|
6203
|
+
}) => [[(0, dom_1.html)('code', {
|
|
6018
6204
|
'data-src': whole
|
|
6019
|
-
}, format(body))],
|
|
6205
|
+
}, format(body))], source.slice(whole.length)])));
|
|
6020
6206
|
|
|
6021
6207
|
function format(text) {
|
|
6022
6208
|
return `${text[0]}${text[text.length - 1]}` === ' ' && text.trimStart() ? text.slice(1, -1) : text;
|
|
@@ -6049,7 +6235,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
6049
6235
|
|
|
6050
6236
|
exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.syntax)(0
|
|
6051
6237
|
/* Syntax.none */
|
|
6052
|
-
, 4, 1,
|
|
6238
|
+
, 4, 1, 0
|
|
6239
|
+
/* State.none */
|
|
6240
|
+
, (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
|
|
6053
6241
|
class: 'comment'
|
|
6054
6242
|
}, [(0, dom_1.html)('input', {
|
|
6055
6243
|
type: 'checkbox'
|
|
@@ -6082,7 +6270,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
6082
6270
|
|
|
6083
6271
|
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.syntax)(0
|
|
6084
6272
|
/* Syntax.none */
|
|
6085
|
-
, 1, 1,
|
|
6273
|
+
, 1, 1, 0
|
|
6274
|
+
/* State.none */
|
|
6275
|
+
, (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)]))), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
6086
6276
|
|
|
6087
6277
|
/***/ }),
|
|
6088
6278
|
|
|
@@ -6115,7 +6305,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
6115
6305
|
|
|
6116
6306
|
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*'), (0, combinator_1.syntax)(0
|
|
6117
6307
|
/* Syntax.none */
|
|
6118
|
-
, 1, 1,
|
|
6308
|
+
, 1, 1, 0
|
|
6309
|
+
/* State.none */
|
|
6310
|
+
, (0, visibility_1.startTight)((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]));
|
|
6119
6311
|
|
|
6120
6312
|
/***/ }),
|
|
6121
6313
|
|
|
@@ -6150,16 +6342,24 @@ const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combin
|
|
|
6150
6342
|
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]))])));
|
|
6151
6343
|
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('***'), (0, combinator_1.syntax)(0
|
|
6152
6344
|
/* Syntax.none */
|
|
6153
|
-
, 1, 1,
|
|
6345
|
+
, 1, 1, 0
|
|
6346
|
+
/* State.none */
|
|
6347
|
+
, (0, visibility_1.startTight)((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) => {
|
|
6154
6348
|
switch (cs[0]) {
|
|
6155
6349
|
case '***':
|
|
6156
6350
|
return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
|
|
6157
6351
|
|
|
6158
6352
|
case '**':
|
|
6159
|
-
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])(
|
|
6353
|
+
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])({
|
|
6354
|
+
source: rest,
|
|
6355
|
+
context
|
|
6356
|
+
}) ?? [['*', (0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest];
|
|
6160
6357
|
|
|
6161
6358
|
case '*':
|
|
6162
|
-
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])(
|
|
6359
|
+
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])({
|
|
6360
|
+
source: rest,
|
|
6361
|
+
context
|
|
6362
|
+
}) ?? [['**', (0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest];
|
|
6163
6363
|
}
|
|
6164
6364
|
}, ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
6165
6365
|
|
|
@@ -6183,18 +6383,27 @@ const combinator_1 = __webpack_require__(2087);
|
|
|
6183
6383
|
const source_1 = __webpack_require__(6743);
|
|
6184
6384
|
|
|
6185
6385
|
const repeat = (0, source_1.str)(/^(.)\1*/);
|
|
6186
|
-
exports.escape = (0, combinator_1.union)([(
|
|
6386
|
+
exports.escape = (0, combinator_1.union)([({
|
|
6387
|
+
source,
|
|
6388
|
+
context
|
|
6389
|
+
}) => {
|
|
6187
6390
|
if (source.length < 3) return;
|
|
6188
6391
|
|
|
6189
6392
|
switch (source[0]) {
|
|
6190
6393
|
case '*':
|
|
6191
6394
|
if (source.length < 4) return;
|
|
6192
|
-
return source[3] === source[0] && source[2] === source[0] && source[1] === source[0] ? repeat(
|
|
6395
|
+
return source[3] === source[0] && source[2] === source[0] && source[1] === source[0] ? repeat({
|
|
6396
|
+
source,
|
|
6397
|
+
context
|
|
6398
|
+
}) : global_1.undefined;
|
|
6193
6399
|
|
|
6194
6400
|
case '+':
|
|
6195
6401
|
case '~':
|
|
6196
6402
|
case '=':
|
|
6197
|
-
return source[2] === source[0] && source[1] === source[0] ? repeat(
|
|
6403
|
+
return source[2] === source[0] && source[1] === source[0] ? repeat({
|
|
6404
|
+
source,
|
|
6405
|
+
context
|
|
6406
|
+
}) : global_1.undefined;
|
|
6198
6407
|
|
|
6199
6408
|
default:
|
|
6200
6409
|
return;
|
|
@@ -6253,23 +6462,11 @@ const dom_1 = __webpack_require__(3252);
|
|
|
6253
6462
|
|
|
6254
6463
|
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.constraint)(16
|
|
6255
6464
|
/* State.index */
|
|
6256
|
-
, false, (0, combinator_1.
|
|
6257
|
-
/* State.annotation */
|
|
6258
|
-
| 32
|
|
6259
|
-
/* State.reference */
|
|
6260
|
-
| 16
|
|
6261
|
-
/* State.index */
|
|
6262
|
-
| 8
|
|
6263
|
-
/* State.label */
|
|
6264
|
-
| 4
|
|
6265
|
-
/* State.link */
|
|
6266
|
-
| 2
|
|
6267
|
-
/* State.media */
|
|
6268
|
-
| 1
|
|
6269
|
-
/* State.autolink */
|
|
6270
|
-
, (0, combinator_1.syntax)(1024
|
|
6465
|
+
, false, (0, combinator_1.syntax)(1024
|
|
6271
6466
|
/* Syntax.index */
|
|
6272
|
-
, 2, 1,
|
|
6467
|
+
, 2, 1, 127
|
|
6468
|
+
/* State.linkable */
|
|
6469
|
+
, (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
|
|
6273
6470
|
id: el.id ? null : global_1.undefined,
|
|
6274
6471
|
class: 'index',
|
|
6275
6472
|
href: el.id ? `#${el.id}` : global_1.undefined
|
|
@@ -6472,7 +6669,9 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
|
|
|
6472
6669
|
|
|
6473
6670
|
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, combinator_1.syntax)(0
|
|
6474
6671
|
/* Syntax.none */
|
|
6475
|
-
, 2, 1,
|
|
6672
|
+
, 2, 1, 0
|
|
6673
|
+
/* State.none */
|
|
6674
|
+
, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]))), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
|
|
6476
6675
|
class: 'invalid',
|
|
6477
6676
|
'data-invalid-syntax': 'extension',
|
|
6478
6677
|
'data-invalid-type': 'syntax',
|
|
@@ -6520,7 +6719,9 @@ global_1.Object.setPrototypeOf(attrspecs, null);
|
|
|
6520
6719
|
global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
|
|
6521
6720
|
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.syntax)(0
|
|
6522
6721
|
/* Syntax.none */
|
|
6523
|
-
, 5, 1,
|
|
6722
|
+
, 5, 1, 0
|
|
6723
|
+
/* State.none */
|
|
6724
|
+
, (0, combinator_1.union)([(0, combinator_1.focus)(/^<wbr[^\S\n]*>/i, () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.surround)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6524
6725
|
(0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)(/^[^\S\n]*>/), true, ([as, bs = [], cs], rest) => [[elem(as[0].slice(1), (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest]), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_1.blankWith)('\n', `</${tag}>`), 5]]), true))]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => TAGS.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/i, (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, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 5]])]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
|
|
6525
6726
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/i)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
6526
6727
|
// [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
|
|
@@ -6596,7 +6797,9 @@ const dom_1 = __webpack_require__(3252);
|
|
|
6596
6797
|
|
|
6597
6798
|
const memoize_1 = __webpack_require__(1808);
|
|
6598
6799
|
|
|
6599
|
-
exports.unsafehtmlentity = (0, combinator_1.creation)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]+;/,
|
|
6800
|
+
exports.unsafehtmlentity = (0, combinator_1.creation)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]+;/, ({
|
|
6801
|
+
source
|
|
6802
|
+
}) => [[parse(source) ?? `\x1B${source}`], ''])));
|
|
6600
6803
|
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([test]) => [test[0] === '\x1B' ? (0, dom_1.html)('span', {
|
|
6601
6804
|
class: 'invalid',
|
|
6602
6805
|
'data-invalid-syntax': 'htmlentity',
|
|
@@ -6637,7 +6840,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
6637
6840
|
|
|
6638
6841
|
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.syntax)(0
|
|
6639
6842
|
/* Syntax.none */
|
|
6640
|
-
, 1, 1,
|
|
6843
|
+
, 1, 1, 0
|
|
6844
|
+
/* State.none */
|
|
6845
|
+
, (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)]))), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
6641
6846
|
|
|
6642
6847
|
/***/ }),
|
|
6643
6848
|
|
|
@@ -6681,59 +6886,38 @@ Object.setPrototypeOf(optspec, null);
|
|
|
6681
6886
|
exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.union)([medialink, textlink])));
|
|
6682
6887
|
const textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
|
|
6683
6888
|
/* State.link */
|
|
6684
|
-
, false, (0, combinator_1.
|
|
6685
|
-
/* State.link */
|
|
6686
|
-
| 2
|
|
6687
|
-
/* State.media */
|
|
6688
|
-
| 64
|
|
6689
|
-
/* State.annotation */
|
|
6690
|
-
| 32
|
|
6691
|
-
/* State.reference */
|
|
6692
|
-
| 16
|
|
6693
|
-
/* State.index */
|
|
6694
|
-
| 8
|
|
6695
|
-
/* State.label */
|
|
6696
|
-
| 1
|
|
6697
|
-
/* State.autolink */
|
|
6698
|
-
, (0, combinator_1.syntax)(256
|
|
6889
|
+
, false, (0, combinator_1.syntax)(256
|
|
6699
6890
|
/* Syntax.link */
|
|
6700
|
-
, 2, 10,
|
|
6891
|
+
, 2, 10, 127
|
|
6892
|
+
/* State.linkable */
|
|
6893
|
+
, (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)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => {
|
|
6701
6894
|
if (content.length !== 0 && (0, visibility_1.trimNode)(content).length === 0) return;
|
|
6702
6895
|
|
|
6703
6896
|
for (let source = (0, util_1.stringify)(content); source;) {
|
|
6704
6897
|
const result = (0, combinator_1.state)(1
|
|
6705
6898
|
/* State.autolink */
|
|
6706
|
-
, false, autolink_1.autolink)(
|
|
6899
|
+
, false, autolink_1.autolink)({
|
|
6900
|
+
source,
|
|
6901
|
+
context
|
|
6902
|
+
});
|
|
6707
6903
|
if (typeof (0, parser_1.eval)(result)[0] === 'object') return;
|
|
6708
6904
|
source = (0, parser_1.exec)(result);
|
|
6709
6905
|
}
|
|
6710
6906
|
|
|
6711
6907
|
return parse(content, params, rest, context);
|
|
6712
|
-
}))))
|
|
6908
|
+
}))));
|
|
6713
6909
|
const medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
|
|
6714
6910
|
/* State.link */
|
|
6715
6911
|
| 2
|
|
6716
6912
|
/* State.media */
|
|
6717
|
-
, false, (0, combinator_1.
|
|
6718
|
-
/* State.link */
|
|
6719
|
-
| 64
|
|
6720
|
-
/* State.annotation */
|
|
6721
|
-
| 32
|
|
6722
|
-
/* State.reference */
|
|
6723
|
-
| 16
|
|
6724
|
-
/* State.index */
|
|
6725
|
-
| 8
|
|
6726
|
-
/* State.label */
|
|
6727
|
-
| 1
|
|
6728
|
-
/* State.autolink */
|
|
6729
|
-
, (0, combinator_1.syntax)(256
|
|
6913
|
+
, false, (0, combinator_1.syntax)(256
|
|
6730
6914
|
/* Syntax.link */
|
|
6731
|
-
, 2, 10,
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6735
|
-
|
|
6736
|
-
})));
|
|
6915
|
+
, 2, 10, 127
|
|
6916
|
+
/* State.linkable */
|
|
6917
|
+
^ 2
|
|
6918
|
+
/* State.media */
|
|
6919
|
+
, (0, combinator_1.bind)((0, combinator_1.reverse)((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)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => parse(content, params, rest, context)))));
|
|
6920
|
+
exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.precedence)(2, (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)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => parse(content, params, rest, context)))));
|
|
6737
6921
|
exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
|
|
6738
6922
|
exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\s{}]+/), opt => [` \\${opt.slice(1)}`])]);
|
|
6739
6923
|
|
|
@@ -6845,7 +7029,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
6845
7029
|
|
|
6846
7030
|
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('=='), (0, combinator_1.syntax)(0
|
|
6847
7031
|
/* Syntax.none */
|
|
6848
|
-
, 1, 1,
|
|
7032
|
+
, 1, 1, 0
|
|
7033
|
+
/* State.none */
|
|
7034
|
+
, (0, visibility_1.startTight)((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)])))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
|
|
6849
7035
|
|
|
6850
7036
|
/***/ }),
|
|
6851
7037
|
|
|
@@ -6867,10 +7053,13 @@ const source_1 = __webpack_require__(6743);
|
|
|
6867
7053
|
const dom_1 = __webpack_require__(3252);
|
|
6868
7054
|
|
|
6869
7055
|
const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
|
|
6870
|
-
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', (0, combinator_1.precedence)(6, bracket), '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.precedence)(3, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.focus)(/^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/, (0, combinator_1.some)(source_1.unescsource))]))), /^\$(?![0-9A-Za-z])/)]), (
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
7056
|
+
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creation)((0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', (0, combinator_1.precedence)(6, bracket), '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.precedence)(3, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.focus)(/^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/, (0, combinator_1.some)(source_1.unescsource))]))), /^\$(?![0-9A-Za-z])/)]), ({
|
|
7057
|
+
source,
|
|
7058
|
+
context: {
|
|
7059
|
+
caches: {
|
|
7060
|
+
math: cache
|
|
7061
|
+
} = {}
|
|
7062
|
+
}
|
|
6874
7063
|
}) => [[cache?.get(source)?.cloneNode(true) || (0, dom_1.html)('span', !forbiddenCommand.test(source) ? {
|
|
6875
7064
|
class: 'math',
|
|
6876
7065
|
translate: 'no',
|
|
@@ -6926,7 +7115,9 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
|
|
|
6926
7115
|
/* State.media */
|
|
6927
7116
|
, false, (0, combinator_1.syntax)(64
|
|
6928
7117
|
/* Syntax.media */
|
|
6929
|
-
, 2, 10,
|
|
7118
|
+
, 2, 10, 0
|
|
7119
|
+
/* State.none */
|
|
7120
|
+
, (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.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
|
|
6930
7121
|
const INSECURE_URI = params.shift();
|
|
6931
7122
|
const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href);
|
|
6932
7123
|
let cache;
|
|
@@ -6947,10 +7138,16 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
|
|
|
6947
7138
|
if (context.state & 4
|
|
6948
7139
|
/* State.link */
|
|
6949
7140
|
) return [[el], rest];
|
|
6950
|
-
if (cache && cache.tagName !== 'IMG') return (0, combinator_1.creation)(10, (..._) => [[el], rest])(
|
|
7141
|
+
if (cache && cache.tagName !== 'IMG') return (0, combinator_1.creation)(10, (..._) => [[el], rest])({
|
|
7142
|
+
source: '!',
|
|
7143
|
+
context
|
|
7144
|
+
});
|
|
6951
7145
|
return (0, combinator_1.fmap)(link_1.unsafelink, ([link]) => [(0, dom_1.define)(link, {
|
|
6952
7146
|
target: '_blank'
|
|
6953
|
-
}, [el])])(
|
|
7147
|
+
}, [el])])({
|
|
7148
|
+
source: `{ ${INSECURE_URI}${params.join('')} }${rest}`,
|
|
7149
|
+
context
|
|
7150
|
+
});
|
|
6954
7151
|
}))))));
|
|
6955
7152
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true)])));
|
|
6956
7153
|
const option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]);
|
|
@@ -7024,17 +7221,17 @@ const dom_1 = __webpack_require__(3252);
|
|
|
7024
7221
|
|
|
7025
7222
|
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(32
|
|
7026
7223
|
/* State.reference */
|
|
7027
|
-
, false, (0, combinator_1.
|
|
7224
|
+
, false, (0, combinator_1.syntax)(4096
|
|
7225
|
+
/* Syntax.reference */
|
|
7226
|
+
, 6, 1, 64
|
|
7028
7227
|
/* State.annotation */
|
|
7029
7228
|
| 32
|
|
7030
7229
|
/* State.reference */
|
|
7031
7230
|
| 2
|
|
7032
7231
|
/* State.media */
|
|
7033
|
-
, (0, combinator_1.
|
|
7034
|
-
/* Syntax.reference */
|
|
7035
|
-
, 6, 1, (0, visibility_1.startLoose)((0, combinator_1.context)({
|
|
7232
|
+
, (0, visibility_1.startLoose)((0, combinator_1.context)({
|
|
7036
7233
|
delimiters: global_1.undefined
|
|
7037
|
-
}, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']')))
|
|
7234
|
+
}, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']'))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
|
|
7038
7235
|
const abbr = (0, combinator_1.creation)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(visibility_1.regBlankStart, '')]));
|
|
7039
7236
|
|
|
7040
7237
|
function attributes(ns) {
|
|
@@ -7082,7 +7279,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
7082
7279
|
|
|
7083
7280
|
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.syntax)(0
|
|
7084
7281
|
/* Syntax.none */
|
|
7085
|
-
, 2, 1,
|
|
7282
|
+
, 2, 1, 0
|
|
7283
|
+
/* State.none */
|
|
7284
|
+
, (0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')')]), ([texts]) => (0, visibility_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
|
|
7086
7285
|
texts[texts.length - 1] === '' && texts.pop();
|
|
7087
7286
|
|
|
7088
7287
|
switch (true) {
|
|
@@ -7096,7 +7295,10 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0,
|
|
|
7096
7295
|
return [(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)((0, array_1.unshift)([texts.join(' ')], [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies.join(' ').trim()), (0, dom_1.html)('rp', ')')])))];
|
|
7097
7296
|
}
|
|
7098
7297
|
}))));
|
|
7099
|
-
const text = (0, combinator_1.creation)((
|
|
7298
|
+
const text = (0, combinator_1.creation)(({
|
|
7299
|
+
source,
|
|
7300
|
+
context
|
|
7301
|
+
}) => {
|
|
7100
7302
|
const acc = [''];
|
|
7101
7303
|
|
|
7102
7304
|
while (source !== '') {
|
|
@@ -7104,7 +7306,10 @@ const text = (0, combinator_1.creation)((source, context) => {
|
|
|
7104
7306
|
// @ts-expect-error
|
|
7105
7307
|
case '&':
|
|
7106
7308
|
{
|
|
7107
|
-
const result = (0, htmlentity_1.unsafehtmlentity)(
|
|
7309
|
+
const result = (0, htmlentity_1.unsafehtmlentity)({
|
|
7310
|
+
source,
|
|
7311
|
+
context
|
|
7312
|
+
});
|
|
7108
7313
|
|
|
7109
7314
|
if (result) {
|
|
7110
7315
|
acc[acc.length - 1] += (0, parser_1.eval)(result)[0];
|
|
@@ -7122,7 +7327,10 @@ const text = (0, combinator_1.creation)((source, context) => {
|
|
|
7122
7327
|
continue;
|
|
7123
7328
|
}
|
|
7124
7329
|
|
|
7125
|
-
const result = (0, source_1.text)(
|
|
7330
|
+
const result = (0, source_1.text)({
|
|
7331
|
+
source,
|
|
7332
|
+
context
|
|
7333
|
+
});
|
|
7126
7334
|
acc[acc.length - 1] += (0, parser_1.eval)(result)[0] ?? source.slice(0, source.length - (0, parser_1.exec)(result).length);
|
|
7127
7335
|
source = (0, parser_1.exec)(result);
|
|
7128
7336
|
continue;
|
|
@@ -7204,7 +7412,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
7204
7412
|
|
|
7205
7413
|
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**'), (0, combinator_1.syntax)(0
|
|
7206
7414
|
/* Syntax.none */
|
|
7207
|
-
, 1, 1,
|
|
7415
|
+
, 1, 1, 0
|
|
7416
|
+
/* State.none */
|
|
7417
|
+
, (0, visibility_1.startTight)((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]));
|
|
7208
7418
|
|
|
7209
7419
|
/***/ }),
|
|
7210
7420
|
|
|
@@ -7231,7 +7441,9 @@ const array_1 = __webpack_require__(8112);
|
|
|
7231
7441
|
|
|
7232
7442
|
exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.syntax)(0
|
|
7233
7443
|
/* Syntax.none */
|
|
7234
|
-
, 2, 1,
|
|
7444
|
+
, 2, 1, 0
|
|
7445
|
+
/* State.none */
|
|
7446
|
+
, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
|
|
7235
7447
|
class: 'template'
|
|
7236
7448
|
}, `{{${ns.join('').replace(/\x1B/g, '')}}}`)], rest]));
|
|
7237
7449
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true)])));
|
|
@@ -7764,7 +7976,10 @@ function* segment(source) {
|
|
|
7764
7976
|
if (!validate(source, exports.MAX_INPUT_SIZE)) return yield `\x07Too large input over ${exports.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`;
|
|
7765
7977
|
|
|
7766
7978
|
while (source !== '') {
|
|
7767
|
-
const result = parser(
|
|
7979
|
+
const result = parser({
|
|
7980
|
+
source,
|
|
7981
|
+
context: {}
|
|
7982
|
+
});
|
|
7768
7983
|
const rest = (0, parser_1.exec)(result);
|
|
7769
7984
|
const segs = (0, parser_1.eval)(result).length ? (0, parser_1.eval)(result) : [source.slice(0, source.length - rest.length)];
|
|
7770
7985
|
|
|
@@ -7891,7 +8106,9 @@ const combinator_1 = __webpack_require__(2087);
|
|
|
7891
8106
|
const text_1 = __webpack_require__(7763);
|
|
7892
8107
|
|
|
7893
8108
|
const delimiter = /[\s\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\x7F]/;
|
|
7894
|
-
exports.escsource = (0, combinator_1.creation)(
|
|
8109
|
+
exports.escsource = (0, combinator_1.creation)(({
|
|
8110
|
+
source
|
|
8111
|
+
}) => {
|
|
7895
8112
|
if (source === '') return;
|
|
7896
8113
|
const i = source.search(delimiter);
|
|
7897
8114
|
|
|
@@ -7936,8 +8153,8 @@ const global_1 = __webpack_require__(4128);
|
|
|
7936
8153
|
const combinator_1 = __webpack_require__(2087);
|
|
7937
8154
|
|
|
7938
8155
|
exports.anyline = (0, combinator_1.line)(() => [[], '']);
|
|
7939
|
-
exports.emptyline = (0, combinator_1.line)(
|
|
7940
|
-
exports.contentline = (0, combinator_1.line)(
|
|
8156
|
+
exports.emptyline = (0, combinator_1.line)(i => (0, combinator_1.isEmpty)(i.source) ? [[], ''] : global_1.undefined);
|
|
8157
|
+
exports.contentline = (0, combinator_1.line)(i => !(0, combinator_1.isEmpty)(i.source) ? [[], ''] : global_1.undefined);
|
|
7941
8158
|
|
|
7942
8159
|
/***/ }),
|
|
7943
8160
|
|
|
@@ -7957,10 +8174,14 @@ const global_1 = __webpack_require__(4128);
|
|
|
7957
8174
|
const combinator_1 = __webpack_require__(2087);
|
|
7958
8175
|
|
|
7959
8176
|
function str(pattern) {
|
|
7960
|
-
return typeof pattern === 'string' ? (0, combinator_1.creation)(
|
|
8177
|
+
return typeof pattern === 'string' ? (0, combinator_1.creation)(({
|
|
8178
|
+
source
|
|
8179
|
+
}) => {
|
|
7961
8180
|
if (source === '') return;
|
|
7962
8181
|
return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : global_1.undefined;
|
|
7963
|
-
}) : (0, combinator_1.creation)(
|
|
8182
|
+
}) : (0, combinator_1.creation)(({
|
|
8183
|
+
source
|
|
8184
|
+
}) => {
|
|
7964
8185
|
if (source === '') return;
|
|
7965
8186
|
const m = source.match(pattern);
|
|
7966
8187
|
return m && m[0].length > 0 ? [[m[0]], source.slice(m[0].length)] : global_1.undefined;
|
|
@@ -7970,10 +8191,14 @@ function str(pattern) {
|
|
|
7970
8191
|
exports.str = str;
|
|
7971
8192
|
|
|
7972
8193
|
function stropt(pattern) {
|
|
7973
|
-
return typeof pattern === 'string' ? (0, combinator_1.creation)(
|
|
8194
|
+
return typeof pattern === 'string' ? (0, combinator_1.creation)(({
|
|
8195
|
+
source
|
|
8196
|
+
}) => {
|
|
7974
8197
|
if (source === '') return;
|
|
7975
8198
|
return source.slice(0, pattern.length) === pattern ? [[pattern], source.slice(pattern.length)] : global_1.undefined;
|
|
7976
|
-
}) : (0, combinator_1.creation)(
|
|
8199
|
+
}) : (0, combinator_1.creation)(({
|
|
8200
|
+
source
|
|
8201
|
+
}) => {
|
|
7977
8202
|
if (source === '') return;
|
|
7978
8203
|
const m = source.match(pattern);
|
|
7979
8204
|
return m ? [[m[0]], source.slice(m[0].length)] : global_1.undefined;
|
|
@@ -8009,7 +8234,12 @@ exports.nonAlphanumeric = /[^0-9A-Za-z]|\S[#>]|$/;
|
|
|
8009
8234
|
const repeat = (0, str_1.str)(/^(.)\1*/);
|
|
8010
8235
|
exports.text = (0, combinator_1.syntax)(0
|
|
8011
8236
|
/* Syntax.none */
|
|
8012
|
-
, 1, 1,
|
|
8237
|
+
, 1, 1, 0
|
|
8238
|
+
/* State.none */
|
|
8239
|
+
, ({
|
|
8240
|
+
source,
|
|
8241
|
+
context
|
|
8242
|
+
}) => {
|
|
8013
8243
|
if (source === '') return;
|
|
8014
8244
|
const i = source.search(exports.delimiter);
|
|
8015
8245
|
|
|
@@ -8026,7 +8256,10 @@ exports.text = (0, combinator_1.syntax)(0
|
|
|
8026
8256
|
case '。':
|
|
8027
8257
|
case '!':
|
|
8028
8258
|
case '?':
|
|
8029
|
-
return (0, exports.text)(
|
|
8259
|
+
return (0, exports.text)({
|
|
8260
|
+
source: source.slice(1),
|
|
8261
|
+
context
|
|
8262
|
+
});
|
|
8030
8263
|
}
|
|
8031
8264
|
|
|
8032
8265
|
break;
|
|
@@ -8065,7 +8298,10 @@ exports.text = (0, combinator_1.syntax)(0
|
|
|
8065
8298
|
case '~':
|
|
8066
8299
|
case '=':
|
|
8067
8300
|
case '`':
|
|
8068
|
-
return source[1] === source[0] ? repeat(
|
|
8301
|
+
return source[1] === source[0] ? repeat({
|
|
8302
|
+
source,
|
|
8303
|
+
context
|
|
8304
|
+
}) : [[source[0]], source.slice(1)];
|
|
8069
8305
|
|
|
8070
8306
|
default:
|
|
8071
8307
|
const b = source[0].trimStart() === '';
|
|
@@ -8104,7 +8340,9 @@ const combinator_1 = __webpack_require__(2087);
|
|
|
8104
8340
|
|
|
8105
8341
|
const text_1 = __webpack_require__(7763);
|
|
8106
8342
|
|
|
8107
|
-
exports.unescsource = (0, combinator_1.creation)(
|
|
8343
|
+
exports.unescsource = (0, combinator_1.creation)(({
|
|
8344
|
+
source
|
|
8345
|
+
}) => {
|
|
8108
8346
|
if (source === '') return;
|
|
8109
8347
|
const i = source.search(text_1.delimiter);
|
|
8110
8348
|
|
|
@@ -8223,20 +8461,31 @@ function blankWith(starting, delimiter) {
|
|
|
8223
8461
|
exports.blankWith = blankWith;
|
|
8224
8462
|
|
|
8225
8463
|
function startLoose(parser, except) {
|
|
8226
|
-
return
|
|
8464
|
+
return input => isStartLoose(input, except) ? parser(input) : global_1.undefined;
|
|
8227
8465
|
}
|
|
8228
8466
|
|
|
8229
8467
|
exports.startLoose = startLoose;
|
|
8230
|
-
const isStartLoose = (0, memoize_1.reduce)((
|
|
8231
|
-
|
|
8232
|
-
|
|
8468
|
+
const isStartLoose = (0, memoize_1.reduce)(({
|
|
8469
|
+
source,
|
|
8470
|
+
context
|
|
8471
|
+
}, except) => {
|
|
8472
|
+
return isStartTight({
|
|
8473
|
+
source: source.replace(exports.regBlankStart, ''),
|
|
8474
|
+
context
|
|
8475
|
+
}, except);
|
|
8476
|
+
}, ({
|
|
8477
|
+
source
|
|
8478
|
+
}, except = '') => `${source}\x1E${except}`);
|
|
8233
8479
|
|
|
8234
8480
|
function startTight(parser, except) {
|
|
8235
|
-
return
|
|
8481
|
+
return input => isStartTight(input, except) ? parser(input) : global_1.undefined;
|
|
8236
8482
|
}
|
|
8237
8483
|
|
|
8238
8484
|
exports.startTight = startTight;
|
|
8239
|
-
const isStartTight = (0, memoize_1.reduce)((
|
|
8485
|
+
const isStartTight = (0, memoize_1.reduce)(({
|
|
8486
|
+
source,
|
|
8487
|
+
context
|
|
8488
|
+
}, except) => {
|
|
8240
8489
|
if (source === '') return true;
|
|
8241
8490
|
if (except && source.slice(0, except.length) === except) return false;
|
|
8242
8491
|
|
|
@@ -8252,7 +8501,10 @@ const isStartTight = (0, memoize_1.reduce)((source, context, except) => {
|
|
|
8252
8501
|
|
|
8253
8502
|
case '&':
|
|
8254
8503
|
switch (true) {
|
|
8255
|
-
case source.length > 2 && source[1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(
|
|
8504
|
+
case source.length > 2 && source[1] !== ' ' && (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)({
|
|
8505
|
+
source,
|
|
8506
|
+
context
|
|
8507
|
+
}))?.[0]?.trimStart() === '':
|
|
8256
8508
|
return false;
|
|
8257
8509
|
}
|
|
8258
8510
|
|
|
@@ -8269,7 +8521,9 @@ const isStartTight = (0, memoize_1.reduce)((source, context, except) => {
|
|
|
8269
8521
|
default:
|
|
8270
8522
|
return source[0].trimStart() !== '';
|
|
8271
8523
|
}
|
|
8272
|
-
}, (
|
|
8524
|
+
}, ({
|
|
8525
|
+
source
|
|
8526
|
+
}, except = '') => `${source}\x1E${except}`);
|
|
8273
8527
|
|
|
8274
8528
|
function isStartLooseNodes(nodes) {
|
|
8275
8529
|
if (nodes.length === 0) return true;
|
|
@@ -8953,7 +9207,10 @@ const dom_1 = __webpack_require__(3252);
|
|
|
8953
9207
|
const duff_1 = __webpack_require__(8099);
|
|
8954
9208
|
|
|
8955
9209
|
function quote(anchor, range) {
|
|
8956
|
-
if ((0, parser_1.exec)((0, cite_1.cite)(
|
|
9210
|
+
if ((0, parser_1.exec)((0, cite_1.cite)({
|
|
9211
|
+
source: `>>${anchor}`,
|
|
9212
|
+
context: {}
|
|
9213
|
+
})) !== '') throw new Error(`Invalid anchor: ${anchor}`);
|
|
8957
9214
|
fit(range);
|
|
8958
9215
|
const node = trim(range.cloneContents());
|
|
8959
9216
|
if (!node.firstChild) return '';
|