securemark 0.283.4 → 0.283.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/index.js +76 -55
- package/package.json +1 -1
- package/src/parser/block/blockquote.ts +1 -1
- package/src/parser/block/dlist.ts +6 -6
- package/src/parser/block/extension/aside.ts +1 -1
- package/src/parser/block/extension/example.ts +2 -2
- package/src/parser/block/extension/figure.ts +3 -3
- package/src/parser/block/extension/table.ts +5 -5
- package/src/parser/block/heading.ts +6 -6
- package/src/parser/block/ilist.ts +1 -1
- package/src/parser/block/olist.ts +1 -1
- package/src/parser/block/paragraph.ts +3 -3
- package/src/parser/block/reply.ts +2 -2
- package/src/parser/block/sidefence.ts +1 -1
- package/src/parser/block/table.ts +4 -4
- package/src/parser/block/ulist.ts +1 -1
- package/src/parser/block.ts +4 -3
- package/src/parser/context.ts +10 -0
- package/src/parser/inline/annotation.ts +7 -4
- package/src/parser/inline/autolink/account.ts +1 -1
- package/src/parser/inline/autolink/anchor.ts +1 -1
- package/src/parser/inline/autolink/channel.ts +1 -1
- package/src/parser/inline/autolink/email.ts +1 -1
- package/src/parser/inline/autolink/hashnum.ts +1 -1
- package/src/parser/inline/autolink/hashtag.ts +1 -1
- package/src/parser/inline/autolink/url.ts +1 -1
- package/src/parser/inline/autolink.ts +1 -1
- package/src/parser/inline/bracket.ts +6 -6
- package/src/parser/inline/code.ts +1 -1
- package/src/parser/inline/deletion.ts +1 -1
- package/src/parser/inline/emphasis.ts +1 -1
- package/src/parser/inline/emstrong.ts +1 -1
- package/src/parser/inline/extension/index.ts +9 -6
- package/src/parser/inline/extension/indexer.ts +1 -1
- package/src/parser/inline/extension/label.ts +1 -1
- package/src/parser/inline/extension/placeholder.ts +1 -1
- package/src/parser/inline/html.ts +1 -1
- package/src/parser/inline/htmlentity.ts +3 -3
- package/src/parser/inline/insertion.ts +1 -1
- package/src/parser/inline/link.test.ts +7 -2
- package/src/parser/inline/link.ts +5 -10
- package/src/parser/inline/mark.ts +1 -1
- package/src/parser/inline/math.ts +1 -1
- package/src/parser/inline/media.ts +4 -4
- package/src/parser/inline/reference.ts +7 -4
- package/src/parser/inline/remark.ts +1 -1
- package/src/parser/inline/ruby.ts +3 -3
- package/src/parser/inline/shortmedia.ts +1 -1
- package/src/parser/inline/strong.ts +1 -1
- package/src/parser/inline/template.ts +2 -2
- package/src/parser/segment.ts +3 -2
- package/src/parser/source/escapable.ts +2 -2
- package/src/parser/source/str.ts +1 -1
- package/src/parser/source/text.ts +3 -3
- package/src/parser/source/unescapable.ts +4 -2
- package/src/parser/visibility.ts +14 -13
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.283.
|
|
1
|
+
/*! securemark v0.283.5 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -907,8 +907,8 @@ const dom_1 = __webpack_require__(394);
|
|
|
907
907
|
const memoize_1 = __webpack_require__(6925);
|
|
908
908
|
exports.unsafehtmlentity = (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]{1,99};/, ({
|
|
909
909
|
source
|
|
910
|
-
}) => [[parse(source) ??
|
|
911
|
-
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([text]) => [text[0] ===
|
|
910
|
+
}) => [[parse(source) ?? `${"\u001B" /* Command.Escape */}${source}`], ''])));
|
|
911
|
+
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([text]) => [text[0] === "\u001B" /* Command.Escape */ ? (0, dom_1.html)('span', {
|
|
912
912
|
class: 'invalid',
|
|
913
913
|
'data-invalid-syntax': 'htmlentity',
|
|
914
914
|
'data-invalid-type': 'syntax',
|
|
@@ -1032,10 +1032,10 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
1032
1032
|
const array_1 = __webpack_require__(6876);
|
|
1033
1033
|
const dom_1 = __webpack_require__(394);
|
|
1034
1034
|
exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */ | 4 /* State.media */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), es => [(0, dom_1.html)('dl', fillTrailingDescription(es))])));
|
|
1035
|
-
const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, visibility_1.visualize)((0, visibility_1.
|
|
1035
|
+
const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => [(0, dom_1.html)('dt', {
|
|
1036
1036
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
1037
|
-
}, (0,
|
|
1038
|
-
const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/^:[^\S\n]+(?=\S)|/, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /^[~:][^\S\n]+\S/), (0, visibility_1.visualize)((0, util_1.lineable)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, dom_1.html)('dd', (0,
|
|
1037
|
+
}, (0, dom_1.defrag)(ns))])));
|
|
1038
|
+
const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/^:[^\S\n]+(?=\S)|/, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /^[~:][^\S\n]+\S/), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, util_1.lineable)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))))), true), ns => [(0, dom_1.html)('dd', (0, dom_1.defrag)(ns))]), false);
|
|
1039
1039
|
function fillTrailingDescription(es) {
|
|
1040
1040
|
return es.length > 0 && es.at(-1).tagName === 'DT' ? (0, array_1.push)(es, [(0, dom_1.html)('dd')]) : es;
|
|
1041
1041
|
}
|
|
@@ -2294,9 +2294,9 @@ const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fm
|
|
|
2294
2294
|
'data-invalid-message': 'Missing the start symbol of the table row'
|
|
2295
2295
|
}, [(0, dom_1.html)('td', source.replace('\n', ''))])], '']));
|
|
2296
2296
|
const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/^:-+:/, () => [['center'], '']), (0, combinator_1.focus)(/^:-+/, () => [['start'], '']), (0, combinator_1.focus)(/^-+:/, () => [['end'], '']), (0, combinator_1.focus)(/^-+/, () => [[''], ''])])), ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
|
|
2297
|
-
const cell = (0, combinator_1.surround)(/^\|\s*(?=\S)/, (0, combinator_1.trimStart)((0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /^\s*(?=\||$)/), (0, combinator_1.close)(inline_1.media, /^\s*(?=\||$)/), (0, combinator_1.close)(inline_1.shortmedia, /^\s*(?=\||$)/), (0, visibility_1.
|
|
2298
|
-
const head = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0,
|
|
2299
|
-
const data = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0,
|
|
2297
|
+
const cell = (0, combinator_1.surround)(/^\|\s*(?=\S)/, (0, combinator_1.trimStart)((0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /^\s*(?=\||$)/), (0, combinator_1.close)(inline_1.media, /^\s*(?=\||$)/), (0, combinator_1.close)(inline_1.shortmedia, /^\s*(?=\||$)/), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /^\|/, [[/^[|\\]?\s*$/, 9]]))])), /^[^|]*/, true);
|
|
2298
|
+
const head = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, dom_1.defrag)(ns))]);
|
|
2299
|
+
const data = (0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]);
|
|
2300
2300
|
function format(rows) {
|
|
2301
2301
|
const aligns = rows[0].className === 'invalid' ? [] : (0, duff_1.duffReduce)(rows.shift().children, (acc, el) => (0, array_1.push)(acc, [el.textContent]), []);
|
|
2302
2302
|
for (let i = 0; i < rows.length; ++i) {
|
|
@@ -2333,14 +2333,14 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, co
|
|
|
2333
2333
|
}) => [[source], ''])))));
|
|
2334
2334
|
exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
|
|
2335
2335
|
// その他の表示制御は各所のCSSで行う。
|
|
2336
|
-
(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */ | 4 /* State.media */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, visibility_1.visualize)((0, visibility_1.
|
|
2336
|
+
(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */ | 4 /* State.media */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/^##+/), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), ([h, ...ns]) => [h.length <= 6 ? (0, dom_1.html)(`h${h.length}`, {
|
|
2337
2337
|
'data-index': (0, inline_1.dataindex)(ns)
|
|
2338
|
-
}, (0,
|
|
2338
|
+
}, (0, dom_1.defrag)(ns)) : (0, dom_1.html)(`h6`, {
|
|
2339
2339
|
class: 'invalid',
|
|
2340
2340
|
'data-invalid-syntax': 'heading',
|
|
2341
2341
|
'data-invalid-type': 'syntax',
|
|
2342
2342
|
'data-invalid-message': 'Heading level must be up to 6'
|
|
2343
|
-
}, (0,
|
|
2343
|
+
}, (0, dom_1.defrag)(ns))]))))));
|
|
2344
2344
|
|
|
2345
2345
|
/***/ },
|
|
2346
2346
|
|
|
@@ -3224,7 +3224,7 @@ exports.media = media;
|
|
|
3224
3224
|
Object.defineProperty(exports, "__esModule", ({
|
|
3225
3225
|
value: true
|
|
3226
3226
|
}));
|
|
3227
|
-
exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.linemedialink = exports.medialink = exports.textlink =
|
|
3227
|
+
exports.resolve = exports.option = exports.uri = exports.unsafelink = exports.linemedialink = exports.medialink = exports.textlink = void 0;
|
|
3228
3228
|
const combinator_1 = __webpack_require__(3484);
|
|
3229
3229
|
const inline_1 = __webpack_require__(7973);
|
|
3230
3230
|
const html_1 = __webpack_require__(5013);
|
|
@@ -3237,10 +3237,9 @@ const optspec = {
|
|
|
3237
3237
|
rel: ['nofollow']
|
|
3238
3238
|
};
|
|
3239
3239
|
Object.setPrototypeOf(optspec, null);
|
|
3240
|
-
exports.
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
return [[parse(content, params, context)], rest];
|
|
3240
|
+
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.constraint)(8 /* State.link */, false, (0, combinator_1.syntax)(1, 251 /* State.linkers */ | 4 /* State.media */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [['\n', 9], [']', 1]])), ']', true, undefined, undefined, 1 | 4 /* Backtrack.bracket */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/, false, undefined, undefined, 3 | 16 /* Backtrack.link */))])), ([params, content = []], rest, context) => {
|
|
3241
|
+
if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
|
|
3242
|
+
return [[parse((0, dom_1.defrag)(content), params, context)], rest];
|
|
3244
3243
|
}))))));
|
|
3245
3244
|
exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, false, (0, combinator_1.syntax)(1, 251 /* State.linkers */, (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((0, dom_1.defrag)(content), params, context)], rest]))))));
|
|
3246
3245
|
exports.linemedialink = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.medialink]), /^(?=[^\S\n]*(?:$|\n))/);
|
|
@@ -3386,8 +3385,8 @@ const row = (0, combinator_1.lazy)(() => (0, combinator_1.dup)((0, combinator_1.
|
|
|
3386
3385
|
const alignment = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
|
|
3387
3386
|
const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([s]) => s.split('/').map(s => s.split(''))));
|
|
3388
3387
|
const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/;
|
|
3389
|
-
const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.medialink, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.media, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.shortmedia, /^\s*$/)), (0, combinator_1.open)(/^(?:\s*\n|\s)/, (0, visibility_1.visualize)((0, visibility_1.
|
|
3390
|
-
const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.medialink, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.media, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.shortmedia, /^\s*$/)), (0, combinator_1.open)(/^(?:\s*\n|\s)/, (0, visibility_1.visualize)((0, util_1.lineable)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => [(0, dom_1.html)('td', attributes(ns.shift()), (0,
|
|
3388
|
+
const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.medialink, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.media, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.shortmedia, /^\s*$/)), (0, combinator_1.open)(/^(?:\s*\n|\s)/, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => [(0, dom_1.html)('th', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false);
|
|
3389
|
+
const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.medialink, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.media, /^\s*$/)), (0, combinator_1.block)((0, combinator_1.surround)(/^[^\n]/, inline_1.shortmedia, /^\s*$/)), (0, combinator_1.open)(/^(?:\s*\n|\s)/, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, util_1.lineable)((0, combinator_1.some)(inline_1.inline)))), true)])), true), ns => [(0, dom_1.html)('td', attributes(ns.shift()), (0, dom_1.defrag)(ns))]), false);
|
|
3391
3390
|
const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/^!+\s/, (0, combinator_1.convert)(source => `:${source}`, data)), (0, combinator_1.convert)(source => `: ${source}`, data)])));
|
|
3392
3391
|
function attributes(source) {
|
|
3393
3392
|
let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
|
|
@@ -3948,7 +3947,7 @@ exports.escsource = (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, ({
|
|
|
3948
3947
|
case '\r':
|
|
3949
3948
|
context.resources && ++context.resources.clock;
|
|
3950
3949
|
return [[], source.slice(1)];
|
|
3951
|
-
case
|
|
3950
|
+
case "\u001B" /* Command.Escape */:
|
|
3952
3951
|
return [[source.slice(1, 2)], source.slice(2)];
|
|
3953
3952
|
case '\\':
|
|
3954
3953
|
switch (source[1]) {
|
|
@@ -3995,7 +3994,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
3995
3994
|
対象をURLで指定すべき(引用ツリーにルートを追加する)場合はない
|
|
3996
3995
|
対象と引用は1:N(分割)、N:1(統合)のみ可能、N:N(混合)は不可能
|
|
3997
3996
|
*/
|
|
3998
|
-
exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.some)((0, combinator_1.inits)([cite_1.cite, quote_1.quote])), (0, combinator_1.some)((0, combinator_1.subsequence)([(0, combinator_1.some)(quote_1.quote), (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, visibility_1.visualize)((0, util_1.lineable)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, dom_1.html)('br')]))]))]), ns => [(0, dom_1.html)('p', (0, visibility_1.
|
|
3997
|
+
exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, combinator_1.fmap)((0, combinator_1.inits)([(0, combinator_1.some)((0, combinator_1.inits)([cite_1.cite, quote_1.quote])), (0, combinator_1.some)((0, combinator_1.subsequence)([(0, combinator_1.some)(quote_1.quote), (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, visibility_1.visualize)((0, util_1.lineable)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, dom_1.html)('br')]))]))]), ns => [(0, dom_1.html)('p', (0, visibility_1.trimBlankNodeEnd)((0, dom_1.defrag)(ns)))])));
|
|
3999
3998
|
|
|
4000
3999
|
/***/ },
|
|
4001
4000
|
|
|
@@ -4093,7 +4092,7 @@ exports.MAX_SEGMENT_SIZE = 100_000; // 100,000 bytes (Max value size of FDB)
|
|
|
4093
4092
|
exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
|
|
4094
4093
|
const parser = (0, combinator_1.union)([heading_1.segment, codeblock_1.segment, mathblock_1.segment, extension_1.segment, (0, combinator_1.some)(source_1.contentline, exports.MAX_SEGMENT_SIZE * 2), (0, combinator_1.some)(source_1.emptyline, exports.MAX_SEGMENT_SIZE * 2)]);
|
|
4095
4094
|
function* segment(source) {
|
|
4096
|
-
if (!validate(source, exports.MAX_INPUT_SIZE)) return yield
|
|
4095
|
+
if (!validate(source, exports.MAX_INPUT_SIZE)) return yield `${"\u0007" /* Command.Error */}Too large input over ${exports.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`;
|
|
4097
4096
|
while (source !== '') {
|
|
4098
4097
|
const result = parser({
|
|
4099
4098
|
source,
|
|
@@ -4103,7 +4102,7 @@ function* segment(source) {
|
|
|
4103
4102
|
const segs = (0, parser_1.eval)(result).length ? (0, parser_1.eval)(result) : [source.slice(0, source.length - rest.length)];
|
|
4104
4103
|
for (let i = 0; i < segs.length; ++i) {
|
|
4105
4104
|
const seg = segs[i];
|
|
4106
|
-
validate(seg, exports.MAX_SEGMENT_SIZE) ? yield seg : yield
|
|
4105
|
+
validate(seg, exports.MAX_SEGMENT_SIZE) ? yield seg : yield `${"\u0007" /* Command.Error */}Too large segment over ${exports.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`;
|
|
4107
4106
|
}
|
|
4108
4107
|
source = rest;
|
|
4109
4108
|
}
|
|
@@ -4290,9 +4289,9 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
4290
4289
|
const inline_1 = __webpack_require__(7973);
|
|
4291
4290
|
const visibility_1 = __webpack_require__(6364);
|
|
4292
4291
|
const dom_1 = __webpack_require__(394);
|
|
4293
|
-
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('((', (0, combinator_1.constraint)(128 /* State.annotation */, false, (0, combinator_1.syntax)(1, 128 /* State.annotation */ | 4 /* State.media */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[
|
|
4292
|
+
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('((', (0, combinator_1.constraint)(128 /* State.annotation */, false, (0, combinator_1.syntax)(1, 128 /* State.annotation */ | 4 /* State.media */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [['\n', 9], [')', 1]])))), '))', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', {
|
|
4294
4293
|
class: 'annotation'
|
|
4295
|
-
}, [(0, dom_1.html)('span', (0,
|
|
4294
|
+
}, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, 1 | 4 /* Backtrack.bracket */)));
|
|
4296
4295
|
|
|
4297
4296
|
/***/ },
|
|
4298
4297
|
|
|
@@ -4640,11 +4639,11 @@ const dom_1 = __webpack_require__(394);
|
|
|
4640
4639
|
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n])?(?=\[?\$)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${fence}[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
|
|
4641
4640
|
// All parsers which can include closing terms.
|
|
4642
4641
|
(0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length, {})));
|
|
4643
|
-
exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.
|
|
4642
|
+
exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/^(?=\s).*\n/)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.shortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])])), ([label, param, content, ...caption]) => [(0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
|
|
4644
4643
|
class: 'figindex'
|
|
4645
4644
|
}), (0, dom_1.html)('span', {
|
|
4646
4645
|
class: 'figtext'
|
|
4647
|
-
}, (0,
|
|
4646
|
+
}, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])])])), (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/, 300), ([body, overflow, closer, opener, delim], _, context) => [(0, dom_1.html)('pre', {
|
|
4648
4647
|
class: 'invalid',
|
|
4649
4648
|
translate: 'no',
|
|
4650
4649
|
'data-invalid-syntax': 'figure',
|
|
@@ -4834,7 +4833,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
4834
4833
|
const util_1 = __webpack_require__(4992);
|
|
4835
4834
|
const visibility_1 = __webpack_require__(6364);
|
|
4836
4835
|
const dom_1 = __webpack_require__(394);
|
|
4837
|
-
exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, visibility_1.visualize)((0, util_1.lineable)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, dom_1.html)('p', (0,
|
|
4836
|
+
exports.paragraph = (0, combinator_1.block)((0, combinator_1.fmap)((0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, util_1.lineable)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), ns => [(0, dom_1.html)('p', (0, dom_1.defrag)(ns))]));
|
|
4838
4837
|
|
|
4839
4838
|
/***/ },
|
|
4840
4839
|
|
|
@@ -4963,7 +4962,7 @@ const array_1 = __webpack_require__(6876);
|
|
|
4963
4962
|
const dom_1 = __webpack_require__(394);
|
|
4964
4963
|
exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('{{', (0, combinator_1.syntax)(1, -1 /* State.all */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
|
|
4965
4964
|
class: 'template'
|
|
4966
|
-
}, `{{${ns.join('')
|
|
4965
|
+
}, `{{${ns.join('')}}}`)], rest], undefined, 3 | 28 /* Backtrack.template */)));
|
|
4967
4966
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(0, 6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 28 /* Backtrack.template */), (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, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 28 /* Backtrack.template */), (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, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 28 /* Backtrack.template */), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true, undefined, undefined, 3 | 28 /* Backtrack.template */)])));
|
|
4968
4967
|
|
|
4969
4968
|
/***/ },
|
|
@@ -5011,7 +5010,7 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, comb
|
|
|
5011
5010
|
class: 'paren'
|
|
5012
5011
|
}, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(1, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 4 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(1, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(1, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], 3 | 4 /* Backtrack.bracket */), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(1, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]),
|
|
5013
5012
|
// 改行禁止はバックトラックなしでは内側の構文を破壊するため安易に行えない。
|
|
5014
|
-
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(2, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '"', [[
|
|
5013
|
+
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(2, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '"', [['\n', 9], ['"', 2]]))), (0, source_1.str)('"'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('“'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(2, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '”', [['\n', 9], ['”', 2]]))), (0, source_1.str)('”'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('‘'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(2, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '’', [['\n', 9], ['’', 2]]))), (0, source_1.str)('’'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('「'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(2, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '」', [['\n', 9], ['」', 2]]))), (0, source_1.str)('」'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('『'), (0, combinator_1.creation)(0, 5 /* Recursion.bracket */, (0, combinator_1.syntax)(2, 0 /* State.none */, (0, combinator_1.some)(inline_1.inline, '』', [['\n', 9], ['』', 2]]))), (0, source_1.str)('』'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
|
|
5015
5014
|
|
|
5016
5015
|
/***/ },
|
|
5017
5016
|
|
|
@@ -5092,14 +5091,14 @@ const indexee_1 = __webpack_require__(7610);
|
|
|
5092
5091
|
const source_1 = __webpack_require__(8745);
|
|
5093
5092
|
const visibility_1 = __webpack_require__(6364);
|
|
5094
5093
|
const dom_1 = __webpack_require__(394);
|
|
5095
|
-
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.constraint)(32 /* State.index */, false, (0, combinator_1.syntax)(1, 251 /* State.linkers */ | 4 /* State.media */, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[
|
|
5094
|
+
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.constraint)(32 /* State.index */, false, (0, combinator_1.syntax)(1, 251 /* State.linkers */ | 4 /* State.media */, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [['\n', 9], [']', 1]])))), ']', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('a', {
|
|
5096
5095
|
'data-index': dataindex(ns)
|
|
5097
|
-
}, (0,
|
|
5096
|
+
}, (0, dom_1.defrag)(ns))], rest] : undefined, undefined, 1 | 4 /* Backtrack.bracket */)), ([el]) => [(0, dom_1.define)(el, {
|
|
5098
5097
|
id: el.id ? null : undefined,
|
|
5099
5098
|
class: 'index',
|
|
5100
5099
|
href: el.id ? `#${el.id}` : undefined
|
|
5101
5100
|
})]))));
|
|
5102
|
-
exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.fmap)((0, combinator_1.open)(
|
|
5101
|
+
exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.fmap)((0, combinator_1.open)(/^\|(?!\\?\s)/, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.txt]), ']')), ns => [(0, dom_1.html)('span', {
|
|
5103
5102
|
class: 'indexer',
|
|
5104
5103
|
'data-index': (0, indexee_1.identity)('index', undefined, ns.join('')).slice(7)
|
|
5105
5104
|
})]))));
|
|
@@ -5429,7 +5428,7 @@ exports.text = (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, ({
|
|
|
5429
5428
|
case '\r':
|
|
5430
5429
|
context.resources && ++context.resources.clock;
|
|
5431
5430
|
return [[], source.slice(1)];
|
|
5432
|
-
case
|
|
5431
|
+
case "\u001B" /* Command.Escape */:
|
|
5433
5432
|
case '\\':
|
|
5434
5433
|
switch (source[1]) {
|
|
5435
5434
|
case undefined:
|
|
@@ -6209,7 +6208,7 @@ __exportStar(__webpack_require__(1311), exports);
|
|
|
6209
6208
|
Object.defineProperty(exports, "__esModule", ({
|
|
6210
6209
|
value: true
|
|
6211
6210
|
}));
|
|
6212
|
-
exports.
|
|
6211
|
+
exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.blankWith = exports.visualize = exports.blank = void 0;
|
|
6213
6212
|
const parser_1 = __webpack_require__(605);
|
|
6214
6213
|
const combinator_1 = __webpack_require__(3484);
|
|
6215
6214
|
const htmlentity_1 = __webpack_require__(470);
|
|
@@ -6223,7 +6222,7 @@ var blank;
|
|
|
6223
6222
|
blank.start = new RegExp(/^(?:\\?[^\S\r\n]|&IHN;|<wbr[^\S\n]*>)+/.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`));
|
|
6224
6223
|
})(blank || (exports.blank = blank = {}));
|
|
6225
6224
|
function visualize(parser) {
|
|
6226
|
-
return (0, combinator_1.union)([(0, combinator_1.convert)(source => source.replace(blank.line, line => line.replace(/[\\&<]/g,
|
|
6225
|
+
return (0, combinator_1.union)([(0, combinator_1.convert)(source => source.replace(blank.line, line => line.replace(/[\\&<]/g, `${"\u001B" /* Command.Escape */}$&`)), (0, combinator_1.verify)(parser, (ns, rest) => !rest && hasVisible(ns))), (0, combinator_1.some)((0, combinator_1.union)([source_1.linebreak, source_1.unescsource]))]);
|
|
6227
6226
|
}
|
|
6228
6227
|
exports.visualize = visualize;
|
|
6229
6228
|
function hasVisible(nodes) {
|
|
@@ -6282,7 +6281,7 @@ const isStartTight = (0, memoize_1.reduce)(({
|
|
|
6282
6281
|
}
|
|
6283
6282
|
}, ({
|
|
6284
6283
|
source
|
|
6285
|
-
}, except = '') => `${source}\
|
|
6284
|
+
}, except = '') => `${source}${"\u001F" /* Command.Separator */}${except}`);
|
|
6286
6285
|
function isStartLooseNodes(nodes) {
|
|
6287
6286
|
if (nodes.length === 0) return true;
|
|
6288
6287
|
for (let i = 0; i < nodes.length; ++i) {
|
|
@@ -6334,12 +6333,13 @@ function trimBlankStart(parser) {
|
|
|
6334
6333
|
}
|
|
6335
6334
|
exports.trimBlankStart = trimBlankStart;
|
|
6336
6335
|
function trimBlankEnd(parser) {
|
|
6337
|
-
return (0, combinator_1.fmap)(parser,
|
|
6336
|
+
return (0, combinator_1.fmap)(parser, trimBlankNodeEnd);
|
|
6338
6337
|
}
|
|
6339
|
-
|
|
6340
|
-
//
|
|
6338
|
+
exports.trimBlankEnd = trimBlankEnd;
|
|
6339
|
+
//export function trimBlankNode<T extends HTMLElement | string>(nodes: T[]): T[] {
|
|
6340
|
+
// return trimBlankNodeStart(trimBlankNodeEnd(nodes));
|
|
6341
6341
|
//}
|
|
6342
|
-
//function
|
|
6342
|
+
//function trimBlankNodeStart<T extends HTMLElement | string>(nodes: T[]): T[] {
|
|
6343
6343
|
// for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
|
|
6344
6344
|
// if (typeof node === 'string') {
|
|
6345
6345
|
// const pos = node.trimStart().length;
|
|
@@ -6355,13 +6355,13 @@ function trimBlankEnd(parser) {
|
|
|
6355
6355
|
// }
|
|
6356
6356
|
// return nodes;
|
|
6357
6357
|
//}
|
|
6358
|
-
function
|
|
6358
|
+
function trimBlankNodeEnd(nodes) {
|
|
6359
6359
|
const skip = nodes.length > 0 && typeof nodes.at(-1) === 'object' && nodes.at(-1)['className'] === 'indexer' ? [nodes.pop()] : [];
|
|
6360
6360
|
for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes.at(-1), -1);) {
|
|
6361
6361
|
if (typeof node === 'string') {
|
|
6362
|
-
const
|
|
6363
|
-
if (
|
|
6364
|
-
nodes[nodes.length - 1] = node.slice(0,
|
|
6362
|
+
const len = node.trimEnd().length;
|
|
6363
|
+
if (len > 0) {
|
|
6364
|
+
nodes[nodes.length - 1] = node.slice(0, len);
|
|
6365
6365
|
break;
|
|
6366
6366
|
}
|
|
6367
6367
|
}
|
|
@@ -6369,7 +6369,7 @@ function trimNodeEnd(nodes) {
|
|
|
6369
6369
|
}
|
|
6370
6370
|
return (0, array_1.push)(nodes, skip);
|
|
6371
6371
|
}
|
|
6372
|
-
exports.
|
|
6372
|
+
exports.trimBlankNodeEnd = trimBlankNodeEnd;
|
|
6373
6373
|
|
|
6374
6374
|
/***/ },
|
|
6375
6375
|
|
|
@@ -6468,8 +6468,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
6468
6468
|
exports.example = void 0;
|
|
6469
6469
|
const parser_1 = __webpack_require__(605);
|
|
6470
6470
|
const combinator_1 = __webpack_require__(3484);
|
|
6471
|
-
const parse_1 = __webpack_require__(3662);
|
|
6472
6471
|
const mathblock_1 = __webpack_require__(4903);
|
|
6472
|
+
const parse_1 = __webpack_require__(3662);
|
|
6473
6473
|
const dom_1 = __webpack_require__(394);
|
|
6474
6474
|
const opener = /^(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/;
|
|
6475
6475
|
exports.example = (0, combinator_1.creation)(0, 1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
|
|
@@ -6900,7 +6900,8 @@ exports.block = (0, combinator_1.reset)({
|
|
|
6900
6900
|
}
|
|
6901
6901
|
}, error((0, combinator_1.union)([source_1.emptyline, pagebreak_1.pagebreak, 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, mediablock_1.mediablock, reply_1.reply, paragraph_1.paragraph])));
|
|
6902
6902
|
function error(parser) {
|
|
6903
|
-
|
|
6903
|
+
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}.*\n`);
|
|
6904
|
+
return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)("\u0007" /* Command.Error */, ({
|
|
6904
6905
|
source
|
|
6905
6906
|
}) => {
|
|
6906
6907
|
throw new Error(source.split('\n', 1)[0]);
|
|
@@ -6915,7 +6916,7 @@ function error(parser) {
|
|
|
6915
6916
|
}, reason instanceof Error ? `${reason.name}: ${reason.message}` : `UnknownError: ${reason}`), (0, dom_1.html)('pre', {
|
|
6916
6917
|
class: 'error',
|
|
6917
6918
|
translate: 'no'
|
|
6918
|
-
}, source.replace(
|
|
6919
|
+
}, source.replace(reg, '').slice(0, 1001).replace(/^(.{997}).{4}$/s, '$1...') || undefined)], '']);
|
|
6919
6920
|
}
|
|
6920
6921
|
|
|
6921
6922
|
/***/ },
|
|
@@ -7019,6 +7020,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7019
7020
|
value: true
|
|
7020
7021
|
}));
|
|
7021
7022
|
exports.ruby = void 0;
|
|
7023
|
+
const context_1 = __webpack_require__(8669);
|
|
7022
7024
|
const parser_1 = __webpack_require__(605);
|
|
7023
7025
|
const combinator_1 = __webpack_require__(3484);
|
|
7024
7026
|
const htmlentity_1 = __webpack_require__(470);
|
|
@@ -7093,8 +7095,8 @@ function attributes(texts, rubies) {
|
|
|
7093
7095
|
let attrs;
|
|
7094
7096
|
for (const ss of [texts, rubies]) {
|
|
7095
7097
|
for (let i = 0; i < ss.length; ++i) {
|
|
7096
|
-
if (!ss[i].includes(
|
|
7097
|
-
ss[i] = ss[i].replace(
|
|
7098
|
+
if (!ss[i].includes("\u001B" /* Command.Escape */)) continue;
|
|
7099
|
+
ss[i] = ss[i].replace(context_1.CmdRegExp.Escape, '');
|
|
7098
7100
|
attrs ??= {
|
|
7099
7101
|
class: 'invalid',
|
|
7100
7102
|
'data-invalid-syntax': 'ruby',
|
|
@@ -7170,6 +7172,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
7170
7172
|
value: true
|
|
7171
7173
|
}));
|
|
7172
7174
|
exports.linemedia = exports.media = void 0;
|
|
7175
|
+
const context_1 = __webpack_require__(8669);
|
|
7173
7176
|
const combinator_1 = __webpack_require__(3484);
|
|
7174
7177
|
const link_1 = __webpack_require__(3628);
|
|
7175
7178
|
const html_1 = __webpack_require__(5013);
|
|
@@ -7186,7 +7189,7 @@ const optspec = {
|
|
|
7186
7189
|
rel: undefined
|
|
7187
7190
|
};
|
|
7188
7191
|
Object.setPrototypeOf(optspec, null);
|
|
7189
|
-
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.open)('!', (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.syntax)(1, ~8 /* State.link */, (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]), ']', [[
|
|
7192
|
+
exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.open)('!', (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.syntax)(1, ~8 /* State.link */, (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, undefined, undefined, 1 | 12 /* Backtrack.media */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, 3 | 16 /* Backtrack.link */))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
|
|
7190
7193
|
const INSECURE_URI = params.shift();
|
|
7191
7194
|
const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
|
|
7192
7195
|
let cache;
|
|
@@ -7228,9 +7231,9 @@ function sanitize(target, uri, alt) {
|
|
|
7228
7231
|
(0, util_1.markInvalid)(target, 'media', 'argument', 'Invalid protocol');
|
|
7229
7232
|
return false;
|
|
7230
7233
|
}
|
|
7231
|
-
if (alt.includes(
|
|
7234
|
+
if (alt.includes("\u001B" /* Command.Escape */)) {
|
|
7232
7235
|
(0, dom_1.define)(target, {
|
|
7233
|
-
alt: target.getAttribute('alt')?.replace(
|
|
7236
|
+
alt: target.getAttribute('alt')?.replace(context_1.CmdRegExp.Escape, '')
|
|
7234
7237
|
});
|
|
7235
7238
|
(0, util_1.markInvalid)(target, 'media', 'content', `Cannot use invalid HTML entitiy "${alt.match(/&[0-9A-Za-z]+;/)[0]}"`);
|
|
7236
7239
|
return false;
|
|
@@ -8166,6 +8169,8 @@ exports.unescsource = (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, ({
|
|
|
8166
8169
|
case '\r':
|
|
8167
8170
|
context.resources && ++context.resources.clock;
|
|
8168
8171
|
return [[], source.slice(1)];
|
|
8172
|
+
case "\u001B" /* Command.Escape */:
|
|
8173
|
+
return [[source.slice(1, 2)], source.slice(2)];
|
|
8169
8174
|
}
|
|
8170
8175
|
const b = source[0] !== '\n' && source[0].trimStart() === '';
|
|
8171
8176
|
const i = b || (0, text_1.isAlphanumeric)(source[0]) ? source.search(b ? text_1.nonWhitespace : text_1.nonAlphanumeric) || 1 : 1;
|
|
@@ -8450,6 +8455,22 @@ function potision(n) {
|
|
|
8450
8455
|
|
|
8451
8456
|
/***/ },
|
|
8452
8457
|
|
|
8458
|
+
/***/ 8669
|
|
8459
|
+
(__unused_webpack_module, exports) {
|
|
8460
|
+
|
|
8461
|
+
"use strict";
|
|
8462
|
+
|
|
8463
|
+
|
|
8464
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
8465
|
+
value: true
|
|
8466
|
+
}));
|
|
8467
|
+
exports.CmdRegExp = void 0;
|
|
8468
|
+
exports.CmdRegExp = {
|
|
8469
|
+
Escape: /\x1B/g
|
|
8470
|
+
};
|
|
8471
|
+
|
|
8472
|
+
/***/ },
|
|
8473
|
+
|
|
8453
8474
|
/***/ 8673
|
|
8454
8475
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
8455
8476
|
|
|
@@ -8714,7 +8735,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
8714
8735
|
const source_1 = __webpack_require__(8745);
|
|
8715
8736
|
const visibility_1 = __webpack_require__(6364);
|
|
8716
8737
|
const dom_1 = __webpack_require__(394);
|
|
8717
|
-
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(64 /* State.reference */, false, (0, combinator_1.syntax)(1, 128 /* State.annotation */ | 64 /* State.reference */ | 4 /* State.media */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[
|
|
8738
|
+
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(64 /* State.reference */, false, (0, combinator_1.syntax)(1, 128 /* State.annotation */ | 64 /* State.reference */ | 4 /* State.media */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [['\n', 9], [']', 1]]))]))), ']]', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, 1 | 4 /* Backtrack.bracket */)));
|
|
8718
8739
|
// Chicago-Style
|
|
8719
8740
|
const abbr = (0, combinator_1.creation)(1, 0 /* Recursion.ignore */, (0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/)]), /^\|?(?=]])|^\|[^\S\n]*/, true, ([, ns], rest) => ns ? [['\n', ns[0].trimEnd()], rest.replace(visibility_1.blank.start, '')] : [[''], `^${rest}`], ([,, rest]) => [[''], `^${rest}`]));
|
|
8720
8741
|
function attributes(ns) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BlockquoteParser } from '../block';
|
|
2
|
+
import { Recursion } from '../context';
|
|
2
3
|
import { union, some, creation, block, validate, rewrite, open, convert, lazy, fmap } from '../../combinator';
|
|
3
4
|
import { autolink } from '../autolink';
|
|
4
5
|
import { contentline } from '../source';
|
|
5
|
-
import { Recursion } from '../context';
|
|
6
6
|
import { parse } from '../api/parse';
|
|
7
7
|
import { html, defrag } from 'typed-dom/dom';
|
|
8
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DListParser } from '../block';
|
|
2
|
+
import { State } from '../context';
|
|
2
3
|
import { union, inits, some, state, block, line, validate, rewrite, open, lazy, fmap } from '../../combinator';
|
|
3
4
|
import { inline, indexee, indexer, dataindex } from '../inline';
|
|
4
5
|
import { anyline } from '../source';
|
|
5
|
-
import { State } from '../context';
|
|
6
6
|
import { lineable } from '../util';
|
|
7
|
-
import { visualize,
|
|
7
|
+
import { visualize, trimBlank, trimBlankEnd } from '../visibility';
|
|
8
8
|
import { push } from 'spica/array';
|
|
9
9
|
import { html, defrag } from 'typed-dom/dom';
|
|
10
10
|
|
|
@@ -19,17 +19,17 @@ export const dlist: DListParser = lazy(() => block(fmap(validate(
|
|
|
19
19
|
|
|
20
20
|
const term: DListParser.TermParser = line(indexee(fmap(open(
|
|
21
21
|
/^~[^\S\n]+(?=\S)/,
|
|
22
|
-
visualize(
|
|
22
|
+
visualize(trimBlank(some(union([indexer, inline])))),
|
|
23
23
|
true),
|
|
24
|
-
ns => [html('dt', { 'data-index': dataindex(ns) },
|
|
24
|
+
ns => [html('dt', { 'data-index': dataindex(ns) }, defrag(ns))])));
|
|
25
25
|
|
|
26
26
|
const desc: DListParser.DescriptionParser = block(fmap(open(
|
|
27
27
|
/^:[^\S\n]+(?=\S)|/,
|
|
28
28
|
rewrite(
|
|
29
29
|
some(anyline, /^[~:][^\S\n]+\S/),
|
|
30
|
-
visualize(lineable(some(union([inline]))))),
|
|
30
|
+
visualize(trimBlankEnd(lineable(some(union([inline])))))),
|
|
31
31
|
true),
|
|
32
|
-
ns => [html('dd',
|
|
32
|
+
ns => [html('dd', defrag(ns))]),
|
|
33
33
|
false);
|
|
34
34
|
|
|
35
35
|
function fillTrailingDescription(es: HTMLElement[]): HTMLElement[] {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtensionParser } from '../../block';
|
|
2
|
+
import { Recursion } from '../../context';
|
|
2
3
|
import { creation, block, validate, fence, fmap } from '../../../combinator';
|
|
3
4
|
import { identity } from '../../inline/extension/indexee';
|
|
4
|
-
import { Recursion } from '../../context';
|
|
5
5
|
import { parse } from '../../api/parse';
|
|
6
6
|
import { html } from 'typed-dom/dom';
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ExtensionParser } from '../../block';
|
|
2
|
+
import { Recursion } from '../../context';
|
|
2
3
|
import { eval } from '../../../combinator/data/parser';
|
|
3
4
|
import { creation, block, validate, fence, fmap } from '../../../combinator';
|
|
4
|
-
import { parse } from '../../api/parse';
|
|
5
5
|
import { mathblock } from '../mathblock';
|
|
6
|
-
import {
|
|
6
|
+
import { parse } from '../../api/parse';
|
|
7
7
|
import { html } from 'typed-dom/dom';
|
|
8
8
|
|
|
9
9
|
const opener = /^(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/;
|
|
@@ -12,7 +12,7 @@ import { table, segment_ as seg_table } from './table';
|
|
|
12
12
|
import { blockquote, segment as seg_blockquote } from '../blockquote';
|
|
13
13
|
import { placeholder, segment_ as seg_placeholder } from './placeholder';
|
|
14
14
|
import { inline, media, shortmedia } from '../../inline';
|
|
15
|
-
import { visualize,
|
|
15
|
+
import { visualize, trimBlank } from '../../visibility';
|
|
16
16
|
import { memoize } from 'spica/memoize';
|
|
17
17
|
import { html, defrag } from 'typed-dom/dom';
|
|
18
18
|
|
|
@@ -63,7 +63,7 @@ export const figure: FigureParser = block(fallback(rewrite(segment, fmap(
|
|
|
63
63
|
line(shortmedia),
|
|
64
64
|
])),
|
|
65
65
|
emptyline,
|
|
66
|
-
block(visualize(
|
|
66
|
+
block(visualize(trimBlank(some(inline)))),
|
|
67
67
|
]),
|
|
68
68
|
])),
|
|
69
69
|
([label, param, content, ...caption]: [HTMLAnchorElement, string, ...HTMLElement[]]) => [
|
|
@@ -72,7 +72,7 @@ export const figure: FigureParser = block(fallback(rewrite(segment, fmap(
|
|
|
72
72
|
[
|
|
73
73
|
html('figcaption', [
|
|
74
74
|
html('span', { class: 'figindex' }),
|
|
75
|
-
html('span', { class: 'figtext' },
|
|
75
|
+
html('span', { class: 'figtext' }, defrag(caption)),
|
|
76
76
|
]),
|
|
77
77
|
html('div', [content]),
|
|
78
78
|
])
|
|
@@ -5,7 +5,7 @@ import { union, subsequence, inits, some, block, line, validate, fence, rewrite,
|
|
|
5
5
|
import { inline, medialink, media, shortmedia } from '../../inline';
|
|
6
6
|
import { str, anyline, emptyline, contentline } from '../../source';
|
|
7
7
|
import { lineable } from '../../util';
|
|
8
|
-
import { visualize,
|
|
8
|
+
import { visualize, trimBlank, trimBlankEnd } from '../../visibility';
|
|
9
9
|
import { unshift, splice } from 'spica/array';
|
|
10
10
|
import { html, define, defrag } from 'typed-dom/dom';
|
|
11
11
|
|
|
@@ -89,10 +89,10 @@ const head: CellParser.HeadParser = block(fmap(open(
|
|
|
89
89
|
block(surround(/^[^\n]/, medialink, /^\s*$/)),
|
|
90
90
|
block(surround(/^[^\n]/, media, /^\s*$/)),
|
|
91
91
|
block(surround(/^[^\n]/, shortmedia, /^\s*$/)),
|
|
92
|
-
open(/^(?:\s*\n|\s)/, visualize(
|
|
92
|
+
open(/^(?:\s*\n|\s)/, visualize(trimBlank(some(inline))), true),
|
|
93
93
|
])),
|
|
94
94
|
true),
|
|
95
|
-
ns => [html('th', attributes(ns.shift()! as string),
|
|
95
|
+
ns => [html('th', attributes(ns.shift()! as string), defrag(ns))]),
|
|
96
96
|
false);
|
|
97
97
|
|
|
98
98
|
const data: CellParser.DataParser = block(fmap(open(
|
|
@@ -106,10 +106,10 @@ const data: CellParser.DataParser = block(fmap(open(
|
|
|
106
106
|
block(surround(/^[^\n]/, medialink, /^\s*$/)),
|
|
107
107
|
block(surround(/^[^\n]/, media, /^\s*$/)),
|
|
108
108
|
block(surround(/^[^\n]/, shortmedia, /^\s*$/)),
|
|
109
|
-
open(/^(?:\s*\n|\s)/, visualize(lineable(some(inline))), true),
|
|
109
|
+
open(/^(?:\s*\n|\s)/, visualize(trimBlankEnd(lineable(some(inline)))), true),
|
|
110
110
|
])),
|
|
111
111
|
true),
|
|
112
|
-
ns => [html('td', attributes(ns.shift()! as string),
|
|
112
|
+
ns => [html('td', attributes(ns.shift()! as string), defrag(ns))]),
|
|
113
113
|
false);
|
|
114
114
|
|
|
115
115
|
const dataline: CellParser.DatalineParser = line(
|