securemark 0.258.3 → 0.258.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.js +130 -78
- package/markdown.d.ts +11 -13
- package/package.json +1 -1
- package/src/combinator/control/constraint/block.ts +3 -1
- package/src/combinator/control/constraint/line.ts +6 -1
- package/src/combinator/control/manipulation/indent.ts +3 -0
- package/src/combinator/data/parser/context/delimiter.ts +6 -3
- package/src/combinator/data/parser/context/memo.ts +1 -1
- package/src/combinator/data/parser/context.test.ts +13 -13
- package/src/combinator/data/parser/context.ts +32 -23
- package/src/combinator/data/parser.ts +1 -1
- package/src/parser/autolink.test.ts +3 -2
- package/src/parser/autolink.ts +17 -1
- package/src/parser/block/extension/table.ts +1 -1
- package/src/parser/block/olist.ts +1 -1
- package/src/parser/block/paragraph.test.ts +3 -1
- package/src/parser/block/reply/quote.ts +2 -2
- package/src/parser/block/table.ts +1 -1
- package/src/parser/block/ulist.ts +3 -3
- package/src/parser/block.ts +1 -1
- package/src/parser/inline/annotation.ts +3 -3
- package/src/parser/inline/autolink/email.test.ts +3 -3
- package/src/parser/inline/autolink/url.test.ts +6 -6
- package/src/parser/inline/autolink.ts +4 -4
- package/src/parser/inline/extension/index.ts +2 -2
- package/src/parser/inline/extension/label.ts +2 -2
- package/src/parser/inline/html.test.ts +16 -16
- package/src/parser/inline/html.ts +9 -8
- package/src/parser/inline/link.ts +20 -7
- package/src/parser/inline/media.ts +2 -2
- package/src/parser/inline/reference.ts +3 -3
- package/src/parser/inline/shortmedia.ts +2 -2
- package/src/parser/inline/template.ts +1 -1
- package/src/parser/inline.test.ts +3 -3
- package/src/parser/source/text.test.ts +16 -1
- package/src/parser/source/text.ts +5 -4
- package/src/parser/visibility.ts +5 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.258.
|
|
1
|
+
/*! securemark v0.258.6 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("DOMPurify"), require("Prism"));
|
|
@@ -2124,11 +2124,14 @@ const global_1 = __webpack_require__(4128);
|
|
|
2124
2124
|
|
|
2125
2125
|
const parser_1 = __webpack_require__(6728);
|
|
2126
2126
|
|
|
2127
|
+
const memo_1 = __webpack_require__(1090);
|
|
2128
|
+
|
|
2127
2129
|
const line_1 = __webpack_require__(9315);
|
|
2128
2130
|
|
|
2129
2131
|
function block(parser, separation = true) {
|
|
2130
|
-
return (source, context) => {
|
|
2132
|
+
return (source, context = {}) => {
|
|
2131
2133
|
if (source === '') return;
|
|
2134
|
+
context.memo ??= new memo_1.Memo();
|
|
2132
2135
|
const result = parser(source, context);
|
|
2133
2136
|
if (!result) return;
|
|
2134
2137
|
const rest = (0, parser_1.exec)(result);
|
|
@@ -2202,11 +2205,17 @@ const global_1 = __webpack_require__(4128);
|
|
|
2202
2205
|
|
|
2203
2206
|
const parser_1 = __webpack_require__(6728);
|
|
2204
2207
|
|
|
2208
|
+
const memo_1 = __webpack_require__(1090);
|
|
2209
|
+
|
|
2205
2210
|
function line(parser) {
|
|
2206
|
-
return (source, context) => {
|
|
2211
|
+
return (source, context = {}) => {
|
|
2207
2212
|
if (source === '') return;
|
|
2213
|
+
context.memo ??= new memo_1.Memo();
|
|
2208
2214
|
const line = firstline(source);
|
|
2215
|
+
const memo = context.memo;
|
|
2216
|
+
memo.offset += source.length - line.length;
|
|
2209
2217
|
const result = parser(line, context);
|
|
2218
|
+
memo.offset -= source.length - line.length;
|
|
2210
2219
|
if (!result) return;
|
|
2211
2220
|
return isEmpty((0, parser_1.exec)(result)) ? [(0, parser_1.eval)(result), source.slice(line.length)] : global_1.undefined;
|
|
2212
2221
|
};
|
|
@@ -2412,7 +2421,10 @@ const memoize_1 = __webpack_require__(1808);
|
|
|
2412
2421
|
function indent(opener, parser, separation = false) {
|
|
2413
2422
|
if (typeof opener === 'function') return indent(/^([ \t])\1*/, opener, parser);
|
|
2414
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, source => [[source], '']))), ([indent]) => indent.length * 2 + +(indent[0] === ' '), [])), separation), (lines, rest, context) => {
|
|
2424
|
+
const memo = context.memo;
|
|
2425
|
+
memo && (memo.offset += rest.length);
|
|
2415
2426
|
const result = parser(trimBlockEnd(lines.join('')), context);
|
|
2427
|
+
memo && (memo.offset -= rest.length);
|
|
2416
2428
|
return result && (0, parser_1.exec)(result) === '' ? [(0, parser_1.eval)(result), rest] : global_1.undefined;
|
|
2417
2429
|
});
|
|
2418
2430
|
}
|
|
@@ -2783,7 +2795,7 @@ exports.check = check;
|
|
|
2783
2795
|
Object.defineProperty(exports, "__esModule", ({
|
|
2784
2796
|
value: true
|
|
2785
2797
|
}));
|
|
2786
|
-
exports.state = exports.guard = exports.precedence = exports.creation = exports.syntax = exports.context = exports.reset = void 0;
|
|
2798
|
+
exports.state = exports.constraint = exports.guard = exports.precedence = exports.creation = exports.syntax = exports.context = exports.reset = void 0;
|
|
2787
2799
|
|
|
2788
2800
|
const global_1 = __webpack_require__(4128);
|
|
2789
2801
|
|
|
@@ -2844,42 +2856,28 @@ function apply(parser, source, context, changes, values) {
|
|
|
2844
2856
|
}
|
|
2845
2857
|
|
|
2846
2858
|
function syntax(syntax, precedence, cost, parser) {
|
|
2847
|
-
return (source, context) => {
|
|
2859
|
+
return creation(cost, (source, context) => {
|
|
2848
2860
|
if (source === '') return;
|
|
2849
2861
|
const memo = context.memo ??= new memo_1.Memo();
|
|
2850
2862
|
context.memorable ??= ~0;
|
|
2851
2863
|
const p = context.precedence;
|
|
2852
2864
|
context.precedence = precedence;
|
|
2853
|
-
const
|
|
2854
|
-
resources = {
|
|
2855
|
-
budget: 1,
|
|
2856
|
-
recursion: 1
|
|
2857
|
-
}
|
|
2858
|
-
} = context;
|
|
2859
|
-
if (resources.budget <= 0) throw new Error('Too many creations');
|
|
2860
|
-
if (resources.recursion <= 0) throw new Error('Too much recursion');
|
|
2861
|
-
--resources.recursion;
|
|
2862
|
-
const pos = source.length;
|
|
2865
|
+
const position = source.length;
|
|
2863
2866
|
const state = context.state ?? 0;
|
|
2864
|
-
const cache = syntax && memo.get(
|
|
2867
|
+
const cache = syntax && memo.get(position, syntax, state);
|
|
2865
2868
|
const result = cache ? cache.length === 0 ? global_1.undefined : [cache[0], source.slice(cache[1])] : parser(source, context);
|
|
2866
|
-
++resources.recursion;
|
|
2867
2869
|
|
|
2868
|
-
if (
|
|
2869
|
-
|
|
2870
|
+
if (syntax && state & context.memorable) {
|
|
2871
|
+
cache ?? memo.set(position, syntax, state, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
|
|
2870
2872
|
}
|
|
2871
2873
|
|
|
2872
|
-
if (
|
|
2873
|
-
|
|
2874
|
-
cache ?? memo.set(pos, syntax, state, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
|
|
2875
|
-
} else if (result && memo.length >= pos) {
|
|
2876
|
-
memo.clear(pos);
|
|
2877
|
-
}
|
|
2874
|
+
if (result && !state && memo.length >= position) {
|
|
2875
|
+
memo.clear(position);
|
|
2878
2876
|
}
|
|
2879
2877
|
|
|
2880
2878
|
context.precedence = p;
|
|
2881
2879
|
return result;
|
|
2882
|
-
};
|
|
2880
|
+
});
|
|
2883
2881
|
}
|
|
2884
2882
|
|
|
2885
2883
|
exports.syntax = syntax;
|
|
@@ -2889,18 +2887,18 @@ function creation(cost, parser) {
|
|
|
2889
2887
|
return (source, context) => {
|
|
2890
2888
|
const {
|
|
2891
2889
|
resources = {
|
|
2892
|
-
|
|
2890
|
+
clock: 1,
|
|
2893
2891
|
recursion: 1
|
|
2894
2892
|
}
|
|
2895
2893
|
} = context;
|
|
2896
|
-
if (resources.
|
|
2894
|
+
if (resources.clock <= 0) throw new Error('Too many creations');
|
|
2897
2895
|
if (resources.recursion <= 0) throw new Error('Too much recursion');
|
|
2898
2896
|
--resources.recursion;
|
|
2899
2897
|
const result = parser(source, context);
|
|
2900
2898
|
++resources.recursion;
|
|
2901
2899
|
|
|
2902
2900
|
if (result) {
|
|
2903
|
-
resources.
|
|
2901
|
+
resources.clock -= cost;
|
|
2904
2902
|
}
|
|
2905
2903
|
|
|
2906
2904
|
return result;
|
|
@@ -2927,6 +2925,20 @@ function guard(f, parser) {
|
|
|
2927
2925
|
|
|
2928
2926
|
exports.guard = guard;
|
|
2929
2927
|
|
|
2928
|
+
function constraint(state, positive, parser) {
|
|
2929
|
+
if (typeof positive === 'function') {
|
|
2930
|
+
parser = positive;
|
|
2931
|
+
positive = true;
|
|
2932
|
+
}
|
|
2933
|
+
|
|
2934
|
+
return (source, context) => {
|
|
2935
|
+
const s = positive ? state & context.state : state & ~context.state;
|
|
2936
|
+
return s === state ? parser(source, context) : global_1.undefined;
|
|
2937
|
+
};
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
exports.constraint = constraint;
|
|
2941
|
+
|
|
2930
2942
|
function state(state, positive, parser) {
|
|
2931
2943
|
if (typeof positive === 'function') {
|
|
2932
2944
|
parser = positive;
|
|
@@ -3013,13 +3025,18 @@ class Delimiters {
|
|
|
3013
3025
|
} = this;
|
|
3014
3026
|
|
|
3015
3027
|
for (let i = 0; i < matchers.length; ++i) {
|
|
3016
|
-
|
|
3028
|
+
const matcher = matchers[i];
|
|
3029
|
+
if (precedence >= matcher[2]) continue;
|
|
3030
|
+
|
|
3031
|
+
switch (matcher[3](source)) {
|
|
3017
3032
|
case true:
|
|
3018
|
-
|
|
3019
|
-
continue;
|
|
3033
|
+
return true;
|
|
3020
3034
|
|
|
3021
3035
|
case false:
|
|
3022
3036
|
return false;
|
|
3037
|
+
|
|
3038
|
+
default:
|
|
3039
|
+
continue;
|
|
3023
3040
|
}
|
|
3024
3041
|
}
|
|
3025
3042
|
|
|
@@ -3082,7 +3099,7 @@ class Memo {
|
|
|
3082
3099
|
|
|
3083
3100
|
for (let i = position + this.offset, len = memory.length; i < len; ++i) {
|
|
3084
3101
|
memory.pop();
|
|
3085
|
-
} //console.log('clear', position);
|
|
3102
|
+
} //console.log('clear', position + 1);
|
|
3086
3103
|
|
|
3087
3104
|
}
|
|
3088
3105
|
|
|
@@ -3860,7 +3877,26 @@ const autolink_1 = __webpack_require__(6051);
|
|
|
3860
3877
|
|
|
3861
3878
|
const source_1 = __webpack_require__(6743);
|
|
3862
3879
|
|
|
3863
|
-
|
|
3880
|
+
const delimiter = /[@#>0-9A-Za-z\n]|\S[#>]/;
|
|
3881
|
+
|
|
3882
|
+
const autolink = (source, context) => {
|
|
3883
|
+
if (source === '') return;
|
|
3884
|
+
const i = source.search(delimiter);
|
|
3885
|
+
|
|
3886
|
+
switch (i) {
|
|
3887
|
+
case -1:
|
|
3888
|
+
return [[source], ''];
|
|
3889
|
+
|
|
3890
|
+
case 0:
|
|
3891
|
+
return parser(source, context);
|
|
3892
|
+
|
|
3893
|
+
default:
|
|
3894
|
+
return [[source.slice(0, i)], source.slice(i)];
|
|
3895
|
+
}
|
|
3896
|
+
};
|
|
3897
|
+
|
|
3898
|
+
exports.autolink = autolink;
|
|
3899
|
+
const parser = (0, combinator_1.lazy)(() => (0, combinator_1.union)([autolink_1.autolink, source_1.linebreak, source_1.unescsource]));
|
|
3864
3900
|
|
|
3865
3901
|
/***/ }),
|
|
3866
3902
|
|
|
@@ -3915,7 +3951,7 @@ const random_1 = __webpack_require__(7325);
|
|
|
3915
3951
|
|
|
3916
3952
|
exports.block = (0, combinator_1.creation)(error((0, combinator_1.reset)({
|
|
3917
3953
|
resources: {
|
|
3918
|
-
|
|
3954
|
+
clock: 50 * 1000,
|
|
3919
3955
|
recursion: 20
|
|
3920
3956
|
}
|
|
3921
3957
|
}, (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]))));
|
|
@@ -4780,7 +4816,7 @@ function format(rows) {
|
|
|
4780
4816
|
const cell = isVirtual ? (0, array_1.splice)(cells, j, 0, global_1.undefined) && ranges[i][j] : cells[j];
|
|
4781
4817
|
const isHeadCell = cell.tagName === 'TH';
|
|
4782
4818
|
heads |= (0, global_1.BigInt)(isHeadCell) << jn;
|
|
4783
|
-
highlights |= (0, global_1.BigInt)(cell.
|
|
4819
|
+
highlights |= (0, global_1.BigInt)(cell.className === 'highlight') << jn;
|
|
4784
4820
|
hasDataCell ||= !isHeadCell;
|
|
4785
4821
|
|
|
4786
4822
|
if (isHeadCell && !hasDataCell) {
|
|
@@ -5132,7 +5168,7 @@ function initial(type) {
|
|
|
5132
5168
|
}
|
|
5133
5169
|
|
|
5134
5170
|
function format(el, type, form) {
|
|
5135
|
-
if (el.firstElementChild?.firstElementChild?.
|
|
5171
|
+
if (el.firstElementChild?.firstElementChild?.className === 'checkbox') {
|
|
5136
5172
|
el.setAttribute('class', 'checklist');
|
|
5137
5173
|
}
|
|
5138
5174
|
|
|
@@ -5314,8 +5350,8 @@ const qblock = (source, context) => {
|
|
|
5314
5350
|
continue;
|
|
5315
5351
|
}
|
|
5316
5352
|
|
|
5317
|
-
if (child.
|
|
5318
|
-
context.resources && (context.resources.
|
|
5353
|
+
if (child.className === 'cite' || child.classList.contains('quote')) {
|
|
5354
|
+
context.resources && (context.resources.clock -= child.childNodes.length);
|
|
5319
5355
|
nodes.splice(i, 1, ...child.childNodes);
|
|
5320
5356
|
--i;
|
|
5321
5357
|
continue;
|
|
@@ -5403,7 +5439,7 @@ const head = (0, combinator_1.creation)((0, combinator_1.fmap)(cell, ns => [(0,
|
|
|
5403
5439
|
const data = (0, combinator_1.creation)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))]));
|
|
5404
5440
|
|
|
5405
5441
|
function format(rows) {
|
|
5406
|
-
const aligns = rows[0].
|
|
5442
|
+
const aligns = rows[0].className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
|
|
5407
5443
|
|
|
5408
5444
|
for (let i = 0; i < rows.length; ++i) {
|
|
5409
5445
|
(0, duff_1.duffEach)(rows[i].children, (col, i) => {
|
|
@@ -5450,9 +5486,9 @@ exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
|
|
|
5450
5486
|
/* State.media */
|
|
5451
5487
|
, exports.ulist_))));
|
|
5452
5488
|
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))])));
|
|
5453
|
-
exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [[(0, dom_1.html)('span', {
|
|
5489
|
+
exports.checkbox = (0, combinator_1.creation)((0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [[(0, dom_1.html)('span', {
|
|
5454
5490
|
class: 'checkbox'
|
|
5455
|
-
}, source[1].trimStart() ? '☑' : '☐')], '']);
|
|
5491
|
+
}, source[1].trimStart() ? '☑' : '☐')], '']));
|
|
5456
5492
|
|
|
5457
5493
|
function fillFirstLine(ns) {
|
|
5458
5494
|
return ns.length === 1 && typeof ns[0] === 'object' && ['UL', 'OL'].includes(ns[0].tagName) ? (0, array_1.unshift)([(0, dom_1.html)('br')], ns) : ns;
|
|
@@ -5461,7 +5497,7 @@ function fillFirstLine(ns) {
|
|
|
5461
5497
|
exports.fillFirstLine = fillFirstLine;
|
|
5462
5498
|
|
|
5463
5499
|
function format(el) {
|
|
5464
|
-
if (el.firstElementChild?.firstElementChild?.
|
|
5500
|
+
if (el.firstElementChild?.firstElementChild?.className === 'checkbox') {
|
|
5465
5501
|
el.setAttribute('class', 'checklist');
|
|
5466
5502
|
}
|
|
5467
5503
|
|
|
@@ -5664,9 +5700,9 @@ const visibility_1 = __webpack_require__(7618);
|
|
|
5664
5700
|
|
|
5665
5701
|
const dom_1 = __webpack_require__(3252);
|
|
5666
5702
|
|
|
5667
|
-
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((', (0, combinator_1.
|
|
5703
|
+
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((', (0, combinator_1.constraint)(64
|
|
5668
5704
|
/* State.annotation */
|
|
5669
|
-
, (0, combinator_1.syntax)(32
|
|
5705
|
+
, false, (0, combinator_1.syntax)(32
|
|
5670
5706
|
/* Syntax.annotation */
|
|
5671
5707
|
, 6, 1, (0, combinator_1.state)(64
|
|
5672
5708
|
/* State.annotation */
|
|
@@ -5676,7 +5712,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((
|
|
|
5676
5712
|
delimiters: global_1.undefined
|
|
5677
5713
|
}, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
|
|
5678
5714
|
class: 'annotation'
|
|
5679
|
-
}, [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ')' ? global_1.undefined : (0, link_1.optimize)('((', ns, rest, next)));
|
|
5715
|
+
}, [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next, context) => next[0] === ')' ? global_1.undefined : (0, link_1.optimize)('((', ns, rest, next, context)));
|
|
5680
5716
|
|
|
5681
5717
|
/***/ }),
|
|
5682
5718
|
|
|
@@ -5711,12 +5747,12 @@ const source_1 = __webpack_require__(6743);
|
|
|
5711
5747
|
|
|
5712
5748
|
const util_1 = __webpack_require__(9437);
|
|
5713
5749
|
|
|
5714
|
-
exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S
|
|
5750
|
+
exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S[#>])/, (0, combinator_1.constraint)(1
|
|
5715
5751
|
/* State.autolink */
|
|
5716
|
-
, (0, combinator_1.syntax)(2
|
|
5752
|
+
, false, (0, combinator_1.syntax)(2
|
|
5717
5753
|
/* Syntax.autolink */
|
|
5718
5754
|
, 1, 1, (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
|
|
5719
|
-
(0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*(?:@(?:[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)
|
|
5755
|
+
(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.
|
|
5720
5756
|
(0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), // Escape invalid leading characters.
|
|
5721
5757
|
(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.
|
|
5722
5758
|
(0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])*/u.source.replace('emoji', hashtag_1.emoji), 'u')), anchor_1.anchor]))))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
|
|
@@ -6216,9 +6252,9 @@ const visibility_1 = __webpack_require__(7618);
|
|
|
6216
6252
|
|
|
6217
6253
|
const dom_1 = __webpack_require__(3252);
|
|
6218
6254
|
|
|
6219
|
-
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.
|
|
6255
|
+
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
|
|
6220
6256
|
/* State.index */
|
|
6221
|
-
, (0, combinator_1.syntax)(1024
|
|
6257
|
+
, false, (0, combinator_1.syntax)(1024
|
|
6222
6258
|
/* Syntax.index */
|
|
6223
6259
|
, 2, 1, (0, combinator_1.state)(64
|
|
6224
6260
|
/* State.annotation */
|
|
@@ -6377,9 +6413,9 @@ const dom_1 = __webpack_require__(3252);
|
|
|
6377
6413
|
|
|
6378
6414
|
const body = (0, source_1.str)(/^\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/);
|
|
6379
6415
|
exports.segment = (0, combinator_1.clear)((0, combinator_1.validate)(['[$', '$'], (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])));
|
|
6380
|
-
exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinator_1.
|
|
6416
|
+
exports.label = (0, combinator_1.validate)(['[$', '$'], (0, combinator_1.creation)((0, combinator_1.fmap)((0, combinator_1.constraint)(8
|
|
6381
6417
|
/* State.label */
|
|
6382
|
-
, (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
|
|
6418
|
+
, false, (0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body])), ([text]) => [(0, dom_1.html)('a', {
|
|
6383
6419
|
class: 'label',
|
|
6384
6420
|
'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
|
|
6385
6421
|
}, text)])));
|
|
@@ -6483,11 +6519,11 @@ const attrspecs = {
|
|
|
6483
6519
|
};
|
|
6484
6520
|
global_1.Object.setPrototypeOf(attrspecs, null);
|
|
6485
6521
|
global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
|
|
6486
|
-
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)
|
|
6522
|
+
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.syntax)(0
|
|
6487
6523
|
/* Syntax.none */
|
|
6488
|
-
, 5, 1, (0, combinator_1.union)([(0, combinator_1.focus)(
|
|
6489
|
-
/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)
|
|
6490
|
-
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
6524
|
+
, 5, 1, (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
|
|
6525
|
+
(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)))])))));
|
|
6526
|
+
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
|
|
6491
6527
|
// [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
|
|
6492
6528
|
|
|
6493
6529
|
const TAGS = global_1.Object.freeze(["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4", "h5", "h6", "main", "nav", "section", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "menu", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "summary", "slot", "template", "acronym", "applet", "basefont", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "hgroup", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "param", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp"]);
|
|
@@ -6629,6 +6665,8 @@ const html_1 = __webpack_require__(5994);
|
|
|
6629
6665
|
|
|
6630
6666
|
const autolink_1 = __webpack_require__(6578);
|
|
6631
6667
|
|
|
6668
|
+
const bracket_1 = __webpack_require__(5196);
|
|
6669
|
+
|
|
6632
6670
|
const source_1 = __webpack_require__(6743);
|
|
6633
6671
|
|
|
6634
6672
|
const visibility_1 = __webpack_require__(7618);
|
|
@@ -6643,9 +6681,9 @@ const optspec = {
|
|
|
6643
6681
|
rel: ['nofollow']
|
|
6644
6682
|
};
|
|
6645
6683
|
Object.setPrototypeOf(optspec, null);
|
|
6646
|
-
exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.bind)((0, combinator_1.
|
|
6684
|
+
exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.bind)((0, combinator_1.constraint)(4
|
|
6647
6685
|
/* State.link */
|
|
6648
|
-
, (0, combinator_1.syntax)(256
|
|
6686
|
+
, false, (0, combinator_1.syntax)(256
|
|
6649
6687
|
/* Syntax.link */
|
|
6650
6688
|
, 2, 10, (0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.state)(4
|
|
6651
6689
|
/* State.link */
|
|
@@ -6661,7 +6699,7 @@ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'
|
|
|
6661
6699
|
/* State.media */
|
|
6662
6700
|
| 1
|
|
6663
6701
|
/* State.autolink */
|
|
6664
|
-
, (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2]])), ']', true, global_1.undefined, ([, ns = [], rest], next) => next[0] === ']' ? global_1.undefined : optimize('[', ns, rest, next))]))), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))], nodes => nodes[0][0] !== ''), ([as, bs = []]) => bs[0] === '\r' && bs.shift() ? [as, bs] : as[0] === '\r' && as.shift() ? [[], as] : [as, []]))), ([content, params], rest, context) => {
|
|
6702
|
+
, (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2]])), ']', true, global_1.undefined, ([, ns = [], rest], next, context) => next[0] === ']' ? global_1.undefined : optimize('[', ns, rest, next, context))]))), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))], nodes => nodes[0][0] !== ''), ([as, bs = []]) => bs[0] === '\r' && bs.shift() ? [as, bs] : as[0] === '\r' && as.shift() ? [[], as] : [as, []]))), ([content, params], rest, context) => {
|
|
6665
6703
|
if (content[0] === '') return [content, rest];
|
|
6666
6704
|
if (params.length === 0) return;
|
|
6667
6705
|
if (content.length !== 0 && (0, visibility_1.trimNode)(content).length === 0) return;
|
|
@@ -6674,7 +6712,7 @@ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'
|
|
|
6674
6712
|
|
|
6675
6713
|
const INSECURE_URI = params.shift();
|
|
6676
6714
|
const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
|
|
6677
|
-
if (el.
|
|
6715
|
+
if (el.className === 'invalid') return [[el], rest];
|
|
6678
6716
|
return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
|
|
6679
6717
|
})));
|
|
6680
6718
|
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.bind)((0, combinator_1.creation)(10, (0, combinator_1.precedence)(2, (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) => {
|
|
@@ -6761,8 +6799,20 @@ function decode(uri) {
|
|
|
6761
6799
|
}
|
|
6762
6800
|
}
|
|
6763
6801
|
|
|
6764
|
-
function optimize(opener, ns, rest, next) {
|
|
6765
|
-
if (next[+(next[0] === '\\')] === '\n')
|
|
6802
|
+
function optimize(opener, ns, rest, next, context) {
|
|
6803
|
+
if (next[+(next[0] === '\\')] === '\n') {
|
|
6804
|
+
if (rest[0] !== opener[0]) return;
|
|
6805
|
+
const delimiters = context.delimiters;
|
|
6806
|
+
delimiters?.push({
|
|
6807
|
+
signature: '!\n',
|
|
6808
|
+
matcher: source => !/^\\?\n/.test(source) && global_1.undefined,
|
|
6809
|
+
precedence: 9
|
|
6810
|
+
});
|
|
6811
|
+
const paired = (0, parser_1.eval)((0, combinator_1.state)(~0, bracket_1.bracket)(rest[0] + rest.slice(rest.search(`[^${rest[0]}]|$`)), context), [])[0] !== '';
|
|
6812
|
+
delimiters?.pop();
|
|
6813
|
+
if (paired) return;
|
|
6814
|
+
}
|
|
6815
|
+
|
|
6766
6816
|
let count = 0;
|
|
6767
6817
|
|
|
6768
6818
|
for (let i = 0; i < ns.length - 1; i += 2) {
|
|
@@ -6881,9 +6931,9 @@ const optspec = {
|
|
|
6881
6931
|
rel: global_1.undefined
|
|
6882
6932
|
};
|
|
6883
6933
|
Object.setPrototypeOf(optspec, null);
|
|
6884
|
-
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.
|
|
6934
|
+
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.constraint)(2
|
|
6885
6935
|
/* State.media */
|
|
6886
|
-
, (0, combinator_1.syntax)(64
|
|
6936
|
+
, false, (0, combinator_1.syntax)(64
|
|
6887
6937
|
/* Syntax.media */
|
|
6888
6938
|
, 2, 10, (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('')], (0, array_1.shift)(bs)[1]] : [[''], (0, array_1.shift)(as)[1]]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
|
|
6889
6939
|
const INSECURE_URI = params.shift();
|
|
@@ -6982,9 +7032,9 @@ const util_1 = __webpack_require__(9437);
|
|
|
6982
7032
|
|
|
6983
7033
|
const dom_1 = __webpack_require__(3252);
|
|
6984
7034
|
|
|
6985
|
-
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.
|
|
7035
|
+
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(32
|
|
6986
7036
|
/* State.reference */
|
|
6987
|
-
, (0, combinator_1.syntax)(4096
|
|
7037
|
+
, false, (0, combinator_1.syntax)(4096
|
|
6988
7038
|
/* Syntax.reference */
|
|
6989
7039
|
, 6, 1, (0, combinator_1.state)(64
|
|
6990
7040
|
/* State.annotation */
|
|
@@ -6994,7 +7044,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[['
|
|
|
6994
7044
|
/* State.media */
|
|
6995
7045
|
, (0, visibility_1.startLoose)((0, combinator_1.context)({
|
|
6996
7046
|
delimiters: global_1.undefined
|
|
6997
|
-
}, (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], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest, next)));
|
|
7047
|
+
}, (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], ([, ns, rest], next, context) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest, next, context)));
|
|
6998
7048
|
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, '')]));
|
|
6999
7049
|
|
|
7000
7050
|
function attributes(ns) {
|
|
@@ -7131,9 +7181,9 @@ const url_1 = __webpack_require__(4318);
|
|
|
7131
7181
|
|
|
7132
7182
|
const media_1 = __webpack_require__(1303);
|
|
7133
7183
|
|
|
7134
|
-
exports.shortmedia = (0, combinator_1.rewrite)((0, combinator_1.
|
|
7184
|
+
exports.shortmedia = (0, combinator_1.rewrite)((0, combinator_1.constraint)(2
|
|
7135
7185
|
/* State.media */
|
|
7136
|
-
, (0, combinator_1.open)('!', url_1.url)), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media])));
|
|
7186
|
+
, false, (0, combinator_1.open)('!', url_1.url)), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media])));
|
|
7137
7187
|
|
|
7138
7188
|
/***/ }),
|
|
7139
7189
|
|
|
@@ -7195,7 +7245,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{',
|
|
|
7195
7245
|
/* Syntax.none */
|
|
7196
7246
|
, 2, 1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
|
|
7197
7247
|
class: 'template'
|
|
7198
|
-
}, `{{${ns.join('').replace(/\x1B/g, '')}}}`)], rest], ([, ns = [], rest], next) => next[0] === '}' ? global_1.undefined : (0, link_1.optimize)('{{', ns, rest, next)));
|
|
7248
|
+
}, `{{${ns.join('').replace(/\x1B/g, '')}}}`)], rest], ([, ns = [], rest], next, context) => next[0] === '}' ? global_1.undefined : (0, link_1.optimize)('{{', ns, rest, next, context)));
|
|
7199
7249
|
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)])));
|
|
7200
7250
|
|
|
7201
7251
|
/***/ }),
|
|
@@ -7965,11 +8015,13 @@ const str_1 = __webpack_require__(2790);
|
|
|
7965
8015
|
|
|
7966
8016
|
const dom_1 = __webpack_require__(3252);
|
|
7967
8017
|
|
|
7968
|
-
exports.delimiter = /[\s\x00-\x7F]|\S
|
|
8018
|
+
exports.delimiter = /[\s\x00-\x7F]|\S[#>]|[()、。!?][^\S\n]*(?=\\\n)/;
|
|
7969
8019
|
exports.nonWhitespace = /[\S\n]|$/;
|
|
7970
|
-
exports.nonAlphanumeric = /[^0-9A-Za-z]|\S
|
|
8020
|
+
exports.nonAlphanumeric = /[^0-9A-Za-z]|\S[#>]|$/;
|
|
7971
8021
|
const repeat = (0, str_1.str)(/^(.)\1*/);
|
|
7972
|
-
exports.text = (0, combinator_1.
|
|
8022
|
+
exports.text = (0, combinator_1.syntax)(0
|
|
8023
|
+
/* Syntax.none */
|
|
8024
|
+
, 1, 1, (source, context) => {
|
|
7973
8025
|
if (source === '') return;
|
|
7974
8026
|
const i = source.search(exports.delimiter);
|
|
7975
8027
|
|
|
@@ -8146,7 +8198,7 @@ const memoize_1 = __webpack_require__(1808);
|
|
|
8146
8198
|
const array_1 = __webpack_require__(8112);
|
|
8147
8199
|
|
|
8148
8200
|
function visualize(parser) {
|
|
8149
|
-
const blankline = new RegExp(/^(?:\\$|\\?[^\S\n]|&IHN;|<wbr
|
|
8201
|
+
const blankline = new RegExp(/^(?:\\$|\\?[^\S\n]|&IHN;|<wbr[^\S\n]*>)+$/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'gm');
|
|
8150
8202
|
return (0, combinator_1.union)([(0, combinator_1.convert)(source => source.replace(blankline, line => line.replace(/[\\&<]/g, '\x1B$&')), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))), (0, combinator_1.some)((0, combinator_1.union)([source_1.linebreak, source_1.unescsource]))]);
|
|
8151
8203
|
}
|
|
8152
8204
|
|
|
@@ -8173,11 +8225,11 @@ function hasVisible(nodes, {
|
|
|
8173
8225
|
return false;
|
|
8174
8226
|
}
|
|
8175
8227
|
|
|
8176
|
-
exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr
|
|
8228
|
+
exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr[^\S\n]*>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
|
|
8177
8229
|
|
|
8178
8230
|
function blankWith(starting, delimiter) {
|
|
8179
8231
|
if (delimiter === global_1.undefined) return blankWith('', starting);
|
|
8180
|
-
return new RegExp(String.raw`^(?:(?=${starting})(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr
|
|
8232
|
+
return new RegExp(String.raw`^(?:(?=${starting})(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr[^\S\n]*>)${starting && '+'})?${typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source}`);
|
|
8181
8233
|
}
|
|
8182
8234
|
|
|
8183
8235
|
exports.blankWith = blankWith;
|
|
@@ -8220,7 +8272,7 @@ const isStartTight = (0, memoize_1.reduce)((source, context, except) => {
|
|
|
8220
8272
|
|
|
8221
8273
|
case '<':
|
|
8222
8274
|
switch (true) {
|
|
8223
|
-
case source.length >= 5 && source
|
|
8275
|
+
case source.length >= 5 && source.slice(0, 4) === '<wbr' && (source[5] === '>' || /^<wbr[^\S\n]*>/.test(source)):
|
|
8224
8276
|
return false;
|
|
8225
8277
|
}
|
|
8226
8278
|
|
package/markdown.d.ts
CHANGED
|
@@ -963,17 +963,17 @@ export namespace MarkdownParser {
|
|
|
963
963
|
// <bdi>abc</bdi>
|
|
964
964
|
Inline<'html'>,
|
|
965
965
|
Parser<HTMLElement | string, Context, [
|
|
966
|
-
HTMLParser.
|
|
967
|
-
|
|
966
|
+
HTMLParser.VoidTagParser,
|
|
967
|
+
HTMLParser.VoidTagParser,
|
|
968
968
|
HTMLParser.TagParser,
|
|
969
969
|
HTMLParser.TagParser,
|
|
970
970
|
]> {
|
|
971
971
|
}
|
|
972
972
|
export namespace HTMLParser {
|
|
973
|
-
export interface
|
|
974
|
-
Inline<'html/
|
|
975
|
-
Parser<HTMLElement, Context, [
|
|
976
|
-
|
|
973
|
+
export interface VoidTagParser extends
|
|
974
|
+
Inline<'html/voidtag'>,
|
|
975
|
+
Parser<HTMLElement | string, Context, [
|
|
976
|
+
AttributeParser,
|
|
977
977
|
]> {
|
|
978
978
|
}
|
|
979
979
|
export interface TagParser extends
|
|
@@ -983,13 +983,11 @@ export namespace MarkdownParser {
|
|
|
983
983
|
InlineParser,
|
|
984
984
|
]> {
|
|
985
985
|
}
|
|
986
|
-
export
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
]> {
|
|
992
|
-
}
|
|
986
|
+
export interface AttributeParser extends
|
|
987
|
+
Inline<'html/attribute'>,
|
|
988
|
+
Parser<string, Context, [
|
|
989
|
+
SourceParser.StrParser,
|
|
990
|
+
]> {
|
|
993
991
|
}
|
|
994
992
|
}
|
|
995
993
|
export interface InsertionParser extends
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { undefined } from 'spica/global';
|
|
2
2
|
import { Parser, exec } from '../../data/parser';
|
|
3
|
+
import { Memo } from '../../data/parser/context/memo';
|
|
3
4
|
import { firstline, isEmpty } from './line';
|
|
4
5
|
|
|
5
6
|
export function block<P extends Parser<unknown>>(parser: P, separation?: boolean): P;
|
|
6
7
|
export function block<T>(parser: Parser<T>, separation = true): Parser<T> {
|
|
7
8
|
assert(parser);
|
|
8
|
-
return (source, context) => {
|
|
9
|
+
return (source, context = {}) => {
|
|
9
10
|
if (source === '') return;
|
|
11
|
+
context.memo ??= new Memo();
|
|
10
12
|
const result = parser(source, context);
|
|
11
13
|
if (!result) return;
|
|
12
14
|
const rest = exec(result);
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { undefined } from 'spica/global';
|
|
2
2
|
import { Parser, eval, exec, check } from '../../data/parser';
|
|
3
|
+
import { Memo } from '../../data/parser/context/memo';
|
|
3
4
|
|
|
4
5
|
export function line<P extends Parser<unknown>>(parser: P): P;
|
|
5
6
|
export function line<T>(parser: Parser<T>): Parser<T> {
|
|
6
7
|
assert(parser);
|
|
7
|
-
return (source, context) => {
|
|
8
|
+
return (source, context = {}) => {
|
|
8
9
|
if (source === '') return;
|
|
10
|
+
context.memo ??= new Memo();
|
|
9
11
|
const line = firstline(source);
|
|
12
|
+
const memo = context.memo!;
|
|
13
|
+
memo.offset += source.length - line.length;
|
|
10
14
|
const result = parser(line, context);
|
|
11
15
|
assert(check(line, result));
|
|
16
|
+
memo.offset -= source.length - line.length;
|
|
12
17
|
if (!result) return;
|
|
13
18
|
return isEmpty(exec(result))
|
|
14
19
|
? [eval(result), source.slice(line.length)]
|