securemark 0.252.0 → 0.253.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/.eslintrc.json +7 -1
- package/CHANGELOG.md +12 -0
- package/design.md +17 -11
- package/dist/index.js +121 -116
- package/index.d.ts +7 -8
- package/markdown.d.ts +6 -5
- package/package.json +9 -9
- package/src/combinator/data/parser.ts +1 -1
- package/src/parser/api/bind.test.ts +8 -8
- package/src/parser/api/bind.ts +1 -1
- package/src/parser/api/parse.test.ts +2 -1
- package/src/parser/api/parse.ts +0 -1
- package/src/parser/block/blockquote.test.ts +31 -31
- package/src/parser/block/blockquote.ts +1 -3
- package/src/parser/block/extension/aside.test.ts +3 -3
- package/src/parser/block/extension/aside.ts +0 -3
- package/src/parser/block/extension/example.test.ts +11 -11
- package/src/parser/block/extension/example.ts +1 -3
- package/src/parser/block/extension/fig.test.ts +5 -5
- package/src/parser/block/extension/figure.test.ts +2 -2
- package/src/parser/block/extension/message.test.ts +7 -7
- package/src/parser/block/extension/message.ts +2 -2
- package/src/parser/block/extension/table.ts +6 -2
- package/src/parser/block/ilist.ts +4 -5
- package/src/parser/block/olist.ts +24 -20
- package/src/parser/block/ulist.ts +3 -13
- package/src/parser/inline/annotation.test.ts +18 -18
- package/src/parser/inline/annotation.ts +1 -1
- package/src/parser/inline/autolink/hashnum.ts +1 -1
- package/src/parser/inline/autolink/hashtag.ts +5 -5
- package/src/parser/inline/autolink.ts +2 -2
- package/src/parser/inline/html.test.ts +9 -6
- package/src/parser/inline/html.ts +11 -13
- package/src/parser/inline/reference.test.ts +58 -58
- package/src/parser/inline/reference.ts +1 -1
- package/src/parser/inline.test.ts +20 -20
- package/src/parser/locale.test.ts +1 -1
- package/src/parser/processor/figure.test.ts +3 -3
- package/src/parser/processor/figure.ts +3 -6
- package/src/parser/processor/footnote.test.ts +60 -2
- package/src/parser/processor/footnote.ts +56 -26
- package/src/parser/util.ts +4 -4
- package/src/renderer/render/code.ts +2 -2
- package/src/renderer/render/math.ts +2 -2
- package/src/renderer/render/media/image.ts +2 -2
- package/src/renderer/render/media.ts +2 -2
- package/src/util/info.ts +4 -4
- package/src/util/toc.ts +12 -16
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.253.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"));
|
|
@@ -758,7 +758,26 @@ function run() {
|
|
|
758
758
|
|
|
759
759
|
/***/ }),
|
|
760
760
|
|
|
761
|
-
/***/
|
|
761
|
+
/***/ 5529:
|
|
762
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
763
|
+
|
|
764
|
+
"use strict";
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
768
|
+
value: true
|
|
769
|
+
}));
|
|
770
|
+
exports.equal = void 0;
|
|
771
|
+
|
|
772
|
+
function equal(a, b) {
|
|
773
|
+
return a === a ? a === b : b !== b;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
exports.equal = equal;
|
|
777
|
+
|
|
778
|
+
/***/ }),
|
|
779
|
+
|
|
780
|
+
/***/ 5084:
|
|
762
781
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
763
782
|
|
|
764
783
|
"use strict";
|
|
@@ -863,25 +882,6 @@ exports.MultiMap = MultiMap;
|
|
|
863
882
|
|
|
864
883
|
/***/ }),
|
|
865
884
|
|
|
866
|
-
/***/ 5529:
|
|
867
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
868
|
-
|
|
869
|
-
"use strict";
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
873
|
-
value: true
|
|
874
|
-
}));
|
|
875
|
-
exports.equal = void 0;
|
|
876
|
-
|
|
877
|
-
function equal(a, b) {
|
|
878
|
-
return a === a ? a === b : b !== b;
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
exports.equal = equal;
|
|
882
|
-
|
|
883
|
-
/***/ }),
|
|
884
|
-
|
|
885
885
|
/***/ 7822:
|
|
886
886
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
887
887
|
|
|
@@ -1417,7 +1417,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
1417
1417
|
value: true
|
|
1418
1418
|
}));
|
|
1419
1419
|
|
|
1420
|
-
__exportStar(__webpack_require__(
|
|
1420
|
+
__exportStar(__webpack_require__(5084), exports);
|
|
1421
1421
|
|
|
1422
1422
|
/***/ }),
|
|
1423
1423
|
|
|
@@ -3314,7 +3314,7 @@ function bind(target, settings) {
|
|
|
3314
3314
|
};
|
|
3315
3315
|
}
|
|
3316
3316
|
|
|
3317
|
-
for (const el of (0, footnote_1.footnote)(next(0)?.parentNode ?? target, settings.footnotes, context)) {
|
|
3317
|
+
for (const el of (0, footnote_1.footnote)(next(0)?.parentNode ?? target, settings.footnotes, context, bottom)) {
|
|
3318
3318
|
el ? yield {
|
|
3319
3319
|
type: 'footnote',
|
|
3320
3320
|
value: el
|
|
@@ -3703,20 +3703,16 @@ const unindent = source => source.replace(/(^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$
|
|
|
3703
3703
|
|
|
3704
3704
|
const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((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)]));
|
|
3705
3705
|
const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown)), (0, combinator_1.creator)(99, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (source, context) => {
|
|
3706
|
-
const annotations = (0, dom_1.html)('ol', {
|
|
3707
|
-
class: 'annotations'
|
|
3708
|
-
});
|
|
3709
3706
|
const references = (0, dom_1.html)('ol', {
|
|
3710
3707
|
class: 'references'
|
|
3711
3708
|
});
|
|
3712
3709
|
const document = (0, parse_1.parse)(source, {
|
|
3713
3710
|
id: '',
|
|
3714
3711
|
footnotes: {
|
|
3715
|
-
annotations,
|
|
3716
3712
|
references
|
|
3717
3713
|
}
|
|
3718
3714
|
}, context);
|
|
3719
|
-
return [[(0, dom_1.html)('section', [document,
|
|
3715
|
+
return [[(0, dom_1.html)('section', [document, references])], ''];
|
|
3720
3716
|
})))]))), ns => [(0, dom_1.html)('blockquote', ns)]));
|
|
3721
3717
|
|
|
3722
3718
|
/***/ }),
|
|
@@ -3901,16 +3897,12 @@ exports.aside = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combi
|
|
|
3901
3897
|
'data-invalid-type': !closer || overflow ? 'fence' : 'argument',
|
|
3902
3898
|
'data-invalid-message': !closer ? `Missing the closing delimiter "${delim}"` : overflow ? `Invalid trailing line after the closing delimiter "${delim}"` : 'Invalid argument'
|
|
3903
3899
|
}, `${opener}${body}${overflow || closer}`)];
|
|
3904
|
-
const annotations = (0, dom_1.html)('ol', {
|
|
3905
|
-
class: 'annotations'
|
|
3906
|
-
});
|
|
3907
3900
|
const references = (0, dom_1.html)('ol', {
|
|
3908
3901
|
class: 'references'
|
|
3909
3902
|
});
|
|
3910
3903
|
const document = (0, parse_1.parse)(body.slice(0, -1), {
|
|
3911
3904
|
id: '',
|
|
3912
3905
|
footnotes: {
|
|
3913
|
-
annotations,
|
|
3914
3906
|
references
|
|
3915
3907
|
}
|
|
3916
3908
|
}, context);
|
|
@@ -3927,7 +3919,7 @@ exports.aside = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combi
|
|
|
3927
3919
|
return [(0, dom_1.html)('aside', {
|
|
3928
3920
|
id: (0, indexee_1.identity)((0, indexee_1.text)(heading)),
|
|
3929
3921
|
class: 'aside'
|
|
3930
|
-
}, [document,
|
|
3922
|
+
}, [document, references])];
|
|
3931
3923
|
}))));
|
|
3932
3924
|
|
|
3933
3925
|
/***/ }),
|
|
@@ -3967,16 +3959,12 @@ exports.example = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, com
|
|
|
3967
3959
|
switch (type) {
|
|
3968
3960
|
case 'markdown':
|
|
3969
3961
|
{
|
|
3970
|
-
const annotations = (0, dom_1.html)('ol', {
|
|
3971
|
-
class: 'annotations'
|
|
3972
|
-
});
|
|
3973
3962
|
const references = (0, dom_1.html)('ol', {
|
|
3974
3963
|
class: 'references'
|
|
3975
3964
|
});
|
|
3976
3965
|
const document = (0, parse_1.parse)(body.slice(0, -1), {
|
|
3977
3966
|
id: '',
|
|
3978
3967
|
footnotes: {
|
|
3979
|
-
annotations,
|
|
3980
3968
|
references
|
|
3981
3969
|
}
|
|
3982
3970
|
}, context);
|
|
@@ -3985,7 +3973,7 @@ exports.example = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, com
|
|
|
3985
3973
|
'data-type': 'markdown'
|
|
3986
3974
|
}, [(0, dom_1.html)('pre', {
|
|
3987
3975
|
translate: 'no'
|
|
3988
|
-
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document,
|
|
3976
|
+
}, body.slice(0, -1)), (0, dom_1.html)('hr'), (0, dom_1.html)('section', [document, references])])];
|
|
3989
3977
|
}
|
|
3990
3978
|
|
|
3991
3979
|
case 'math':
|
|
@@ -4301,10 +4289,10 @@ exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
|
|
|
4301
4289
|
}, `${opener}${body}${closer}`)];
|
|
4302
4290
|
}
|
|
4303
4291
|
|
|
4304
|
-
return [(0, dom_1.html)('
|
|
4292
|
+
return [(0, dom_1.html)('section', {
|
|
4305
4293
|
class: `message`,
|
|
4306
4294
|
'data-type': type
|
|
4307
|
-
}, (0, array_1.unshift)([(0, dom_1.html)('
|
|
4295
|
+
}, (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(seg, context), [])), [])))];
|
|
4308
4296
|
})));
|
|
4309
4297
|
|
|
4310
4298
|
function title(type) {
|
|
@@ -4557,8 +4545,8 @@ function format(rows) {
|
|
|
4557
4545
|
|
|
4558
4546
|
if (colSpan > 1) {
|
|
4559
4547
|
(0, array_1.splice)(cells, j + 1, 0, ...(0, global_1.Array)(colSpan - 1));
|
|
4560
|
-
heads |=
|
|
4561
|
-
highlights |=
|
|
4548
|
+
heads |= heads & 1n << jn ? ~(~0n << (0, global_1.BigInt)(colSpan)) << jn : 0n;
|
|
4549
|
+
highlights |= highlights & 1n << jn ? ~(~0n << (0, global_1.BigInt)(colSpan)) << jn : 0n;
|
|
4562
4550
|
j += colSpan - 1;
|
|
4563
4551
|
}
|
|
4564
4552
|
|
|
@@ -4717,8 +4705,6 @@ const olist_1 = __webpack_require__(7471);
|
|
|
4717
4705
|
|
|
4718
4706
|
const inline_1 = __webpack_require__(1160);
|
|
4719
4707
|
|
|
4720
|
-
const source_1 = __webpack_require__(6743);
|
|
4721
|
-
|
|
4722
4708
|
const dom_1 = __webpack_require__(3252);
|
|
4723
4709
|
|
|
4724
4710
|
exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^[-+*](?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.context)({
|
|
@@ -4728,7 +4714,7 @@ exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
|
|
|
4728
4714
|
}
|
|
4729
4715
|
}
|
|
4730
4716
|
}, exports.ilist_))));
|
|
4731
|
-
exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^[-+*](?:$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^[-+*](?:$|\s)/, (0, combinator_1.
|
|
4717
|
+
exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^[-+*](?:$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/^[-+*](?:$|\s)/, (0, combinator_1.some)(inline_1.inline), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), olist_1.invalid), ns => [(0, dom_1.html)('li', (0, dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))])])))), es => [(0, dom_1.html)('ul', {
|
|
4732
4718
|
class: 'invalid',
|
|
4733
4719
|
'data-invalid-syntax': 'list',
|
|
4734
4720
|
'data-invalid-type': 'syntax',
|
|
@@ -4784,7 +4770,7 @@ exports.mathblock = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0,
|
|
|
4784
4770
|
Object.defineProperty(exports, "__esModule", ({
|
|
4785
4771
|
value: true
|
|
4786
4772
|
}));
|
|
4787
|
-
exports.olist_ = exports.olist = void 0;
|
|
4773
|
+
exports.invalid = exports.olist_ = exports.olist = void 0;
|
|
4788
4774
|
|
|
4789
4775
|
const global_1 = __webpack_require__(4128);
|
|
4790
4776
|
|
|
@@ -4806,11 +4792,13 @@ const memoize_1 = __webpack_require__(1808);
|
|
|
4806
4792
|
|
|
4807
4793
|
const array_1 = __webpack_require__(8112);
|
|
4808
4794
|
|
|
4795
|
+
const tuple_1 = __webpack_require__(5341);
|
|
4796
|
+
|
|
4809
4797
|
const openers = {
|
|
4810
|
-
'.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(
|
|
4811
|
-
'(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(
|
|
4798
|
+
'.': /^([0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?:$|\s)/,
|
|
4799
|
+
'(': /^\(([0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?:$|\s)/
|
|
4812
4800
|
};
|
|
4813
|
-
exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)([/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)
|
|
4801
|
+
exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/.source, /^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/.source].join('|')), (0, combinator_1.context)({
|
|
4814
4802
|
syntax: {
|
|
4815
4803
|
inline: {
|
|
4816
4804
|
media: false
|
|
@@ -4819,15 +4807,15 @@ exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
|
|
|
4819
4807
|
}, exports.olist_))));
|
|
4820
4808
|
exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]).charCodeAt(0) || 0, [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1]).charCodeAt(0) || 0, []))])));
|
|
4821
4809
|
|
|
4822
|
-
const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((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)(heads[form], (0, combinator_1.
|
|
4823
|
-
'data-marker': ns[0]
|
|
4810
|
+
const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((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)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (0, util_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)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), exports.invalid), ns => [(0, dom_1.html)('li', {
|
|
4811
|
+
'data-marker': ns[0] || global_1.undefined
|
|
4824
4812
|
}, (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)]);
|
|
4825
4813
|
|
|
4826
4814
|
const heads = {
|
|
4827
|
-
'.': (0, combinator_1.focus)(openers['.'], source => [[
|
|
4828
|
-
'(': (0, combinator_1.focus)(openers['('], source => [[source.replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')], ''])
|
|
4815
|
+
'.': (0, combinator_1.focus)(openers['.'], source => [[source.trimEnd().split('.', 1)[0] + '.'], '']),
|
|
4816
|
+
'(': (0, combinator_1.focus)(openers['('], source => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')], ''])
|
|
4829
4817
|
};
|
|
4830
|
-
|
|
4818
|
+
exports.invalid = (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.contentline, (0, combinator_1.indent)(s => [(0, tuple_1.tuple)(s), ''])]), source => [['', (0, dom_1.html)('span', {
|
|
4831
4819
|
class: 'invalid',
|
|
4832
4820
|
'data-invalid-syntax': 'listitem',
|
|
4833
4821
|
'data-invalid-type': 'syntax',
|
|
@@ -5199,8 +5187,6 @@ const ilist_1 = __webpack_require__(238);
|
|
|
5199
5187
|
|
|
5200
5188
|
const inline_1 = __webpack_require__(1160);
|
|
5201
5189
|
|
|
5202
|
-
const source_1 = __webpack_require__(6743);
|
|
5203
|
-
|
|
5204
5190
|
const util_1 = __webpack_require__(9437);
|
|
5205
5191
|
|
|
5206
5192
|
const dom_1 = __webpack_require__(3252);
|
|
@@ -5214,16 +5200,10 @@ exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combina
|
|
|
5214
5200
|
}
|
|
5215
5201
|
}
|
|
5216
5202
|
}, exports.ulist_))));
|
|
5217
|
-
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.creator)((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.
|
|
5203
|
+
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.creator)((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, util_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))])));
|
|
5218
5204
|
exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [[(0, dom_1.html)('span', {
|
|
5219
5205
|
class: 'checkbox'
|
|
5220
5206
|
}, source[1].trimStart() ? '☑' : '☐')], '']);
|
|
5221
|
-
const invalid = (0, combinator_1.rewrite)(source_1.contentline, source => [[(0, dom_1.html)('span', {
|
|
5222
|
-
class: 'invalid',
|
|
5223
|
-
'data-invalid-syntax': 'listitem',
|
|
5224
|
-
'data-invalid-type': 'syntax',
|
|
5225
|
-
'data-invalid-message': 'Fix the indent or the head of the list item'
|
|
5226
|
-
}, source.replace('\n', ''))], '']);
|
|
5227
5207
|
|
|
5228
5208
|
function fillFirstLine(ns) {
|
|
5229
5209
|
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;
|
|
@@ -5426,7 +5406,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0,
|
|
|
5426
5406
|
delimiters: global_1.undefined
|
|
5427
5407
|
}, (0, util_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', /^\\?\n/)))), '))'), ns => [(0, dom_1.html)('sup', {
|
|
5428
5408
|
class: 'annotation'
|
|
5429
|
-
}, (0, dom_1.defrag)(ns))]))));
|
|
5409
|
+
}, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])]))));
|
|
5430
5410
|
|
|
5431
5411
|
/***/ }),
|
|
5432
5412
|
|
|
@@ -5464,8 +5444,8 @@ const util_1 = __webpack_require__(9437);
|
|
|
5464
5444
|
exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S#)/, (0, combinator_1.guard)(context => context.syntax?.inline?.autolink ?? true, (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
|
|
5465
5445
|
(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.
|
|
5466
5446
|
(0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), // Escape invalid leading characters.
|
|
5467
|
-
(0, source_1.str)(new RegExp(
|
|
5468
|
-
(0, source_1.str)(new RegExp(
|
|
5447
|
+
(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.
|
|
5448
|
+
(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)]);
|
|
5469
5449
|
|
|
5470
5450
|
/***/ }),
|
|
5471
5451
|
|
|
@@ -5619,7 +5599,7 @@ const source_1 = __webpack_require__(6743);
|
|
|
5619
5599
|
|
|
5620
5600
|
const dom_1 = __webpack_require__(3252);
|
|
5621
5601
|
|
|
5622
|
-
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(
|
|
5602
|
+
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.context)({
|
|
5623
5603
|
syntax: {
|
|
5624
5604
|
inline: {
|
|
5625
5605
|
link: true,
|
|
@@ -5655,7 +5635,7 @@ const dom_1 = __webpack_require__(3252); // https://example/hashtags/a must be a
|
|
|
5655
5635
|
|
|
5656
5636
|
|
|
5657
5637
|
exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
|
|
5658
|
-
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[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])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([
|
|
5638
|
+
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[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])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.context)({
|
|
5659
5639
|
syntax: {
|
|
5660
5640
|
inline: {
|
|
5661
5641
|
link: true,
|
|
@@ -6229,7 +6209,7 @@ const cache_1 = __webpack_require__(9210);
|
|
|
6229
6209
|
|
|
6230
6210
|
const array_1 = __webpack_require__(8112);
|
|
6231
6211
|
|
|
6232
|
-
const tags = global_1.Object.freeze(['
|
|
6212
|
+
const tags = global_1.Object.freeze(['sup', 'sub', 'small', 'bdo', 'bdi']);
|
|
6233
6213
|
const attrspec = {
|
|
6234
6214
|
bdo: {
|
|
6235
6215
|
dir: global_1.Object.freeze(['ltr', 'rtl'])
|
|
@@ -6237,7 +6217,8 @@ const attrspec = {
|
|
|
6237
6217
|
};
|
|
6238
6218
|
global_1.Object.setPrototypeOf(attrspec, null);
|
|
6239
6219
|
global_1.Object.values(attrspec).forEach(o => global_1.Object.setPrototypeOf(o, null));
|
|
6240
|
-
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([(0, combinator_1.
|
|
6220
|
+
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([(0, combinator_1.focus)('<wbr>', () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.focus)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
6221
|
+
/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/, source => [[source], '']), (0, combinator_1.match)(/^<(sup|sub|small|bdo|bdi)(?=[^\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, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)])), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, bs, cs)], rest]), ([, tag]) => tags.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\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, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', `</${tag}>`)), true)])), `</${tag}>`), (0, source_1.str)(`</${tag}>`), false, ([as, bs, cs], rest) => [[elem(tag, as, bs, cs)], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
|
|
6241
6222
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]);
|
|
6242
6223
|
|
|
6243
6224
|
function elem(tag, as, bs, cs) {
|
|
@@ -6690,7 +6671,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, c
|
|
|
6690
6671
|
}
|
|
6691
6672
|
},
|
|
6692
6673
|
delimiters: global_1.undefined
|
|
6693
|
-
}, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)), (0, util_1.trimBlank)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))]))), ']]'), ns => [(0, dom_1.html)('sup', attributes(ns), (0, dom_1.defrag)(ns))]))));
|
|
6674
|
+
}, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/)), (0, util_1.trimBlank)((0, combinator_1.some)(inline_1.inline, ']', /^\\?\n/))]))), ']]'), ns => [(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])]))));
|
|
6694
6675
|
const abbr = (0, combinator_1.creator)((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(util_1.regBlankStart, '')]));
|
|
6695
6676
|
|
|
6696
6677
|
function attributes(ns) {
|
|
@@ -7017,7 +6998,7 @@ const multimap_1 = __webpack_require__(940);
|
|
|
7017
6998
|
const array_1 = __webpack_require__(8112);
|
|
7018
6999
|
|
|
7019
7000
|
function* figure(target, footnotes, opts = {}) {
|
|
7020
|
-
const refs = new multimap_1.MultiMap((0, array_1.push)((0, array_1.push)(
|
|
7001
|
+
const refs = new multimap_1.MultiMap((0, array_1.push)((0, array_1.push)([], target.querySelectorAll('a.label:not(.disabled)[data-label]')), footnotes?.references.querySelectorAll('a.label:not(.disabled)') ?? []).map(el => [el.getAttribute('data-label'), el]));
|
|
7021
7002
|
const labels = new global_1.Set();
|
|
7022
7003
|
const numbers = new global_1.Map();
|
|
7023
7004
|
let base = '0';
|
|
@@ -7209,37 +7190,53 @@ const dom_1 = __webpack_require__(3252);
|
|
|
7209
7190
|
|
|
7210
7191
|
const multimap_1 = __webpack_require__(940);
|
|
7211
7192
|
|
|
7212
|
-
const
|
|
7193
|
+
const array_1 = __webpack_require__(8112);
|
|
7213
7194
|
|
|
7214
|
-
function* footnote(target, footnotes, opts = {}) {
|
|
7215
|
-
yield* (0, exports.reference)(target, footnotes?.references, opts,
|
|
7216
|
-
yield* (0, exports.annotation)(target, footnotes?.annotations, opts,
|
|
7195
|
+
function* footnote(target, footnotes, opts = {}, bottom = null) {
|
|
7196
|
+
yield* (0, exports.reference)(target, footnotes?.references, opts, bottom);
|
|
7197
|
+
yield* (0, exports.annotation)(target, footnotes?.annotations, opts, bottom);
|
|
7217
7198
|
return;
|
|
7218
7199
|
}
|
|
7219
7200
|
|
|
7220
7201
|
exports.footnote = footnote;
|
|
7221
|
-
exports.annotation = build('annotation', n => `*${n}
|
|
7202
|
+
exports.annotation = build('annotation', n => `*${n}`, 'h1, h2, h3, h4, h5, h6, aside.aside, hr');
|
|
7222
7203
|
exports.reference = build('reference', (n, abbr) => `[${abbr || n}]`);
|
|
7223
7204
|
|
|
7224
|
-
function build(syntax, marker) {
|
|
7205
|
+
function build(syntax, marker, splitter) {
|
|
7225
7206
|
// Referenceを含むAnnotationの重複排除は両構文が互いに処理済みであることを必要とするため
|
|
7226
7207
|
// 構文ごとに各1回の処理では不可能
|
|
7227
|
-
|
|
7228
|
-
const contentify = (0, memoize_1.memoize)(ref => (0, dom_1.frag)(ref.cloneNode(true).childNodes), new global_1.WeakMap());
|
|
7229
|
-
return function* (target, footnote, opts = {}, footnotes = []) {
|
|
7208
|
+
return function* (target, footnote, opts = {}, bottom = null) {
|
|
7230
7209
|
const defs = new global_1.Map();
|
|
7231
7210
|
const buffer = new multimap_1.MultiMap();
|
|
7232
|
-
const titles = new global_1.Map();
|
|
7233
|
-
const
|
|
7211
|
+
const titles = new global_1.Map(); // Bug: Firefox
|
|
7212
|
+
//const splitters = push([], target.querySelectorAll(`:scope > :is(${splitter ?? '_'})`));
|
|
7213
|
+
|
|
7214
|
+
const splitters = (0, array_1.push)([], target.querySelectorAll(splitter ?? '_')).filter(el => el.parentNode === target); // Bug: Firefox
|
|
7215
|
+
//target.querySelectorAll(`:scope > .${syntax}s`).forEach(el => el.remove());
|
|
7216
|
+
|
|
7217
|
+
target.querySelectorAll(`.${syntax}s`).forEach(el => el.parentNode === target && el.remove());
|
|
7218
|
+
let offset = 0;
|
|
7234
7219
|
let style;
|
|
7235
7220
|
|
|
7236
7221
|
for (let refs = target.querySelectorAll(`sup.${syntax}:not(.disabled)`), i = 0, len = refs.length; i < len; ++i) {
|
|
7237
7222
|
yield;
|
|
7238
7223
|
const ref = refs[i];
|
|
7239
|
-
|
|
7240
|
-
|
|
7224
|
+
|
|
7225
|
+
while (+splitters[0]?.compareDocumentPosition(ref) & global_1.Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
7226
|
+
if (defs.size > 0) {
|
|
7227
|
+
offset += defs.size;
|
|
7228
|
+
yield* proc(defs, target.insertBefore((0, dom_1.html)('ol', {
|
|
7229
|
+
class: `${syntax}s`
|
|
7230
|
+
}), splitters[0] ?? null));
|
|
7231
|
+
}
|
|
7232
|
+
|
|
7233
|
+
splitters.shift();
|
|
7234
|
+
}
|
|
7235
|
+
|
|
7236
|
+
if (syntax === 'annotation' && ref.closest('#annotations, .annotations, #references, .references')) continue;
|
|
7237
|
+
const identifier = `${+!ref.querySelector('.label')}:${ref.getAttribute('data-abbr') || '_' + ref.firstElementChild.innerHTML}`;
|
|
7241
7238
|
const abbr = ref.getAttribute('data-abbr') || global_1.undefined;
|
|
7242
|
-
const content =
|
|
7239
|
+
const content = (0, dom_1.frag)(ref.firstElementChild.cloneNode(true).childNodes);
|
|
7243
7240
|
style ??= abbr ? 'abbr' : 'count';
|
|
7244
7241
|
|
|
7245
7242
|
if (style === 'count' ? abbr : !abbr) {
|
|
@@ -7249,12 +7246,17 @@ function build(syntax, marker) {
|
|
|
7249
7246
|
'data-invalid-type': 'style',
|
|
7250
7247
|
'data-invalid-message': `${syntax[0].toUpperCase() + syntax.slice(1)} style must be consistent`
|
|
7251
7248
|
});
|
|
7249
|
+
} else if (ref.getAttribute('data-invalid-type') === 'style') {
|
|
7250
|
+
(0, dom_1.define)(ref, {
|
|
7251
|
+
class: void ref.classList.remove('invalid'),
|
|
7252
|
+
'data-invalid-syntax': null,
|
|
7253
|
+
'data-invalid-type': null,
|
|
7254
|
+
'data-invalid-message': null
|
|
7255
|
+
});
|
|
7252
7256
|
}
|
|
7253
7257
|
|
|
7254
|
-
if (ref.firstElementChild
|
|
7255
|
-
ref.
|
|
7256
|
-
hidden: ''
|
|
7257
|
-
}, ref.childNodes));
|
|
7258
|
+
if (!ref.firstElementChild.hasAttribute('hidden')) {
|
|
7259
|
+
ref.firstElementChild.setAttribute('hidden', '');
|
|
7258
7260
|
} else {
|
|
7259
7261
|
ref.lastChild?.remove();
|
|
7260
7262
|
}
|
|
@@ -7265,7 +7267,8 @@ function build(syntax, marker) {
|
|
|
7265
7267
|
const refIndex = i + 1;
|
|
7266
7268
|
const refId = opts.id !== '' ? ref.id || `${syntax}:${opts.id ? `${opts.id}:` : ''}ref:${refIndex}` : global_1.undefined;
|
|
7267
7269
|
const def = global_1.undefined || defs.get(identifier) || defs.set(identifier, (0, dom_1.html)('li', {
|
|
7268
|
-
id: opts.id !== '' ? `${syntax}:${opts.id ? `${opts.id}:` : ''}def:${defs.size + 1}` : global_1.undefined
|
|
7270
|
+
id: opts.id !== '' ? `${syntax}:${opts.id ? `${opts.id}:` : ''}def:${defs.size + offset + 1}` : global_1.undefined,
|
|
7271
|
+
'data-marker': !footnote ? marker(defs.size + offset + 1, abbr) : global_1.undefined
|
|
7269
7272
|
}, [content.cloneNode(true), (0, dom_1.html)('sup')])).get(identifier);
|
|
7270
7273
|
|
|
7271
7274
|
if (title && !blank && def.childNodes.length === 1) {
|
|
@@ -7283,7 +7286,7 @@ function build(syntax, marker) {
|
|
|
7283
7286
|
}
|
|
7284
7287
|
}
|
|
7285
7288
|
|
|
7286
|
-
const defIndex = +def.id.slice(def.id.lastIndexOf(':') + 1) || defs.size;
|
|
7289
|
+
const defIndex = +def.id.slice(def.id.lastIndexOf(':') + 1) || defs.size + offset;
|
|
7287
7290
|
const defId = def.id || global_1.undefined;
|
|
7288
7291
|
(0, dom_1.define)(ref, {
|
|
7289
7292
|
id: refId,
|
|
@@ -7306,7 +7309,16 @@ function build(syntax, marker) {
|
|
|
7306
7309
|
}, `^${refIndex}`));
|
|
7307
7310
|
}
|
|
7308
7311
|
|
|
7309
|
-
if (
|
|
7312
|
+
if (defs.size > 0 || footnote) {
|
|
7313
|
+
yield* proc(defs, footnote ?? target.insertBefore((0, dom_1.html)('ol', {
|
|
7314
|
+
class: `${syntax}s`
|
|
7315
|
+
}), splitters[0] ?? bottom));
|
|
7316
|
+
}
|
|
7317
|
+
|
|
7318
|
+
return;
|
|
7319
|
+
};
|
|
7320
|
+
|
|
7321
|
+
function* proc(defs, footnote) {
|
|
7310
7322
|
const {
|
|
7311
7323
|
children
|
|
7312
7324
|
} = footnote;
|
|
@@ -7314,7 +7326,8 @@ function build(syntax, marker) {
|
|
|
7314
7326
|
let count = 0;
|
|
7315
7327
|
let length = children.length;
|
|
7316
7328
|
|
|
7317
|
-
I: for (const def of defs
|
|
7329
|
+
I: for (const [key, def] of defs) {
|
|
7330
|
+
defs.delete(key);
|
|
7318
7331
|
++count;
|
|
7319
7332
|
|
|
7320
7333
|
while (length > size) {
|
|
@@ -7336,7 +7349,7 @@ function build(syntax, marker) {
|
|
|
7336
7349
|
}
|
|
7337
7350
|
|
|
7338
7351
|
return;
|
|
7339
|
-
}
|
|
7352
|
+
}
|
|
7340
7353
|
}
|
|
7341
7354
|
|
|
7342
7355
|
function equal(a, b) {
|
|
@@ -7768,7 +7781,7 @@ const memoize_1 = __webpack_require__(1808);
|
|
|
7768
7781
|
|
|
7769
7782
|
const array_1 = __webpack_require__(8112);
|
|
7770
7783
|
|
|
7771
|
-
exports.regBlankStart = new RegExp(
|
|
7784
|
+
exports.regBlankStart = new RegExp(/^(?:\\?[^\S\n]|&IHN;|<wbr>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
|
|
7772
7785
|
|
|
7773
7786
|
function blankWith(starting, delimiter) {
|
|
7774
7787
|
if (delimiter === global_1.undefined) return blankWith('', starting);
|
|
@@ -7778,7 +7791,7 @@ function blankWith(starting, delimiter) {
|
|
|
7778
7791
|
exports.blankWith = blankWith;
|
|
7779
7792
|
|
|
7780
7793
|
function visualize(parser) {
|
|
7781
|
-
const blankline = new RegExp(
|
|
7794
|
+
const blankline = new RegExp(/^(?:\\$|\\?[^\S\n]|&IHN;|<wbr>)+$/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'gm');
|
|
7782
7795
|
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]))]);
|
|
7783
7796
|
}
|
|
7784
7797
|
|
|
@@ -8477,13 +8490,13 @@ exports.info = void 0;
|
|
|
8477
8490
|
|
|
8478
8491
|
const scope_1 = __webpack_require__(5202);
|
|
8479
8492
|
|
|
8480
|
-
const
|
|
8493
|
+
const array_1 = __webpack_require__(8112);
|
|
8481
8494
|
|
|
8482
8495
|
function info(source) {
|
|
8483
8496
|
const match = (0, scope_1.scope)(source, '.invalid');
|
|
8484
8497
|
return {
|
|
8485
|
-
url: find('a:not(
|
|
8486
|
-
tel: find('a:not(
|
|
8498
|
+
url: find('a:not(:is(.email, .account, .channel, .hashtag, .hashnum, .anchor))').filter(el => ['http:', 'https:'].includes(el.protocol)),
|
|
8499
|
+
tel: find('a:not(:is(.email, .account, .channel, .hashtag, .hashnum, .anchor))').filter(el => ['tel:'].includes(el.protocol)),
|
|
8487
8500
|
email: find('a.email'),
|
|
8488
8501
|
account: find('a.account'),
|
|
8489
8502
|
channel: find('a.channel'),
|
|
@@ -8495,7 +8508,7 @@ function info(source) {
|
|
|
8495
8508
|
};
|
|
8496
8509
|
|
|
8497
8510
|
function find(selector) {
|
|
8498
|
-
return (0,
|
|
8511
|
+
return (0, array_1.push)([], source.querySelectorAll(selector)).filter(match);
|
|
8499
8512
|
}
|
|
8500
8513
|
}
|
|
8501
8514
|
|
|
@@ -8668,29 +8681,21 @@ const array_1 = __webpack_require__(8112); // Bug: Firefox
|
|
|
8668
8681
|
//const selector = 'h1 h2 h3 h4 h5 h6 aside.aside'.split(' ').map(s => `:scope > ${s}[id]`).join();
|
|
8669
8682
|
|
|
8670
8683
|
|
|
8671
|
-
const selector = 'h1 h2 h3 h4 h5 h6 aside.aside
|
|
8684
|
+
const selector = ':is(h1, h2, h3, h4, h5, h6, aside.aside)[id]';
|
|
8672
8685
|
|
|
8673
8686
|
function toc(source) {
|
|
8674
|
-
const
|
|
8675
|
-
const hs = (0, global_1.Array)(es.length);
|
|
8676
|
-
|
|
8677
|
-
for (let i = 0; i < hs.length; ++i) {
|
|
8678
|
-
const el = es[i];
|
|
8679
|
-
|
|
8687
|
+
const hs = (0, array_1.push)([], source.querySelectorAll(selector)).map(el => {
|
|
8680
8688
|
switch (el.tagName) {
|
|
8681
8689
|
case 'ASIDE':
|
|
8682
|
-
|
|
8690
|
+
return (0, dom_1.html)(el.firstElementChild.tagName.toLowerCase(), {
|
|
8683
8691
|
id: el.id,
|
|
8684
8692
|
class: 'aside'
|
|
8685
8693
|
}, el.firstElementChild.cloneNode(true).childNodes);
|
|
8686
|
-
continue;
|
|
8687
8694
|
|
|
8688
8695
|
default:
|
|
8689
|
-
|
|
8690
|
-
continue;
|
|
8696
|
+
return el;
|
|
8691
8697
|
}
|
|
8692
|
-
}
|
|
8693
|
-
|
|
8698
|
+
});
|
|
8694
8699
|
return parse(cons(hs));
|
|
8695
8700
|
}
|
|
8696
8701
|
|
|
@@ -8735,7 +8740,7 @@ function fix(h) {
|
|
|
8735
8740
|
/***/ 3252:
|
|
8736
8741
|
/***/ (function(module) {
|
|
8737
8742
|
|
|
8738
|
-
/*! typed-dom v0.0.
|
|
8743
|
+
/*! typed-dom v0.0.299 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
8739
8744
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
8740
8745
|
if(true)
|
|
8741
8746
|
module.exports = factory();
|
|
@@ -9169,7 +9174,7 @@ exports.defrag = defrag;
|
|
|
9169
9174
|
/***/ 6120:
|
|
9170
9175
|
/***/ (function(module) {
|
|
9171
9176
|
|
|
9172
|
-
/*! typed-dom v0.0.
|
|
9177
|
+
/*! typed-dom v0.0.299 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
9173
9178
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
9174
9179
|
if(true)
|
|
9175
9180
|
module.exports = factory();
|
package/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author falsandtru https://github.com/falsandtru/securemark
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Dict } from 'spica/dict';
|
|
9
9
|
|
|
10
10
|
export function parse(source: string, options?: ParserOptions): DocumentFragment;
|
|
11
11
|
export function bind(target: DocumentFragment | HTMLElement | ShadowRoot, settings: ParserSettings): {
|
|
@@ -33,7 +33,6 @@ export interface ParserSettings {
|
|
|
33
33
|
// For editing.
|
|
34
34
|
readonly caches?: Partial<Caches>;
|
|
35
35
|
readonly footnotes: {
|
|
36
|
-
readonly annotations: HTMLOListElement;
|
|
37
36
|
readonly references: HTMLOListElement;
|
|
38
37
|
};
|
|
39
38
|
readonly chunk?: boolean;
|
|
@@ -48,23 +47,23 @@ export type Progress =
|
|
|
48
47
|
| { type: 'cancel' };
|
|
49
48
|
|
|
50
49
|
export interface RenderingOptions {
|
|
51
|
-
readonly code?: (target: HTMLElement, cache?:
|
|
52
|
-
readonly math?: (target: HTMLElement, cache?:
|
|
50
|
+
readonly code?: (target: HTMLElement, cache?: Dict<string, HTMLElement>) => void;
|
|
51
|
+
readonly math?: (target: HTMLElement, cache?: Dict<string, HTMLElement>) => void;
|
|
53
52
|
readonly media?: {
|
|
54
53
|
readonly twitter?: (source: HTMLImageElement, url: URL) => HTMLElement | undefined;
|
|
55
54
|
readonly youtube?: (source: HTMLImageElement, url: URL) => HTMLElement | undefined;
|
|
56
55
|
readonly pdf?: (source: HTMLImageElement, url: URL) => HTMLElement | undefined;
|
|
57
56
|
readonly video?: (source: HTMLImageElement, url: URL) => HTMLVideoElement | undefined;
|
|
58
57
|
readonly audio?: (source: HTMLImageElement, url: URL) => HTMLAudioElement | undefined;
|
|
59
|
-
readonly image?: (source: HTMLImageElement, url: URL, cache?:
|
|
58
|
+
readonly image?: (source: HTMLImageElement, url: URL, cache?: Dict<string, HTMLElement>) => HTMLImageElement;
|
|
60
59
|
};
|
|
61
60
|
readonly caches?: Partial<Caches>;
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
export interface Caches {
|
|
65
|
-
readonly code:
|
|
66
|
-
readonly math:
|
|
67
|
-
readonly media:
|
|
64
|
+
readonly code: Dict<string, HTMLElement>;
|
|
65
|
+
readonly math: Dict<string, HTMLElement>;
|
|
66
|
+
readonly media: Dict<string, HTMLElement>;
|
|
68
67
|
}
|
|
69
68
|
|
|
70
69
|
export interface Info {
|