securemark 0.271.0 → 0.273.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.js +99 -100
- package/index.d.ts +2 -2
- package/package.json +16 -16
- package/src/parser/api/bind.test.ts +5 -5
- package/src/parser/api/bind.ts +4 -4
- package/src/parser/api/parse.test.ts +9 -9
- package/src/parser/api/parse.ts +4 -4
- package/src/parser/block/blockquote.ts +1 -1
- package/src/parser/block/extension/aside.ts +4 -4
- package/src/parser/block/extension/example.ts +1 -1
- package/src/parser/inline/autolink/url.ts +2 -2
- package/src/parser/inline/autolink.ts +3 -3
- package/src/parser/inline/extension/indexee.ts +9 -5
- package/src/parser/inline/media.ts +2 -2
- package/src/parser/inline.ts +3 -3
- package/src/parser/processor/figure.ts +2 -2
- package/src/parser/processor/note.test.ts +369 -0
- package/src/parser/processor/{footnote.ts → note.ts} +38 -43
- package/tsconfig.json +2 -1
- package/webpack.config.js +4 -4
- package/src/parser/processor/footnote.test.ts +0 -317
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.273.0 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"));
|
|
@@ -1373,17 +1373,18 @@ exports.suppressAsyncException = suppressAsyncException;
|
|
|
1373
1373
|
/***/ }),
|
|
1374
1374
|
|
|
1375
1375
|
/***/ 4128:
|
|
1376
|
-
/***/ ((
|
|
1376
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1377
1377
|
|
|
1378
1378
|
"use strict";
|
|
1379
1379
|
|
|
1380
1380
|
|
|
1381
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
1382
|
+
value: true
|
|
1383
|
+
}));
|
|
1381
1384
|
__webpack_require__(6921);
|
|
1382
|
-
const global =
|
|
1383
|
-
// @ts-ignore
|
|
1384
|
-
|| typeof self !== 'undefined' && self || Function('return this')();
|
|
1385
|
+
const global = globalThis;
|
|
1385
1386
|
global.global = global;
|
|
1386
|
-
|
|
1387
|
+
exports["default"] = global;
|
|
1387
1388
|
|
|
1388
1389
|
/***/ }),
|
|
1389
1390
|
|
|
@@ -1394,9 +1395,7 @@ module.exports = global;
|
|
|
1394
1395
|
|
|
1395
1396
|
|
|
1396
1397
|
// @ts-ignore
|
|
1397
|
-
var globalThis;
|
|
1398
|
-
// @ts-ignore
|
|
1399
|
-
var global = (/* unused pure expression or super */ null && (globalThis));
|
|
1398
|
+
var global = globalThis;
|
|
1400
1399
|
|
|
1401
1400
|
/***/ }),
|
|
1402
1401
|
|
|
@@ -1487,9 +1486,9 @@ class Heap {
|
|
|
1487
1486
|
this.$length = 0;
|
|
1488
1487
|
}
|
|
1489
1488
|
}
|
|
1490
|
-
exports.Heap = Heap;
|
|
1491
1489
|
Heap.max = (a, b) => a > b ? -1 : a < b ? 1 : 0;
|
|
1492
1490
|
Heap.min = (a, b) => a > b ? 1 : a < b ? -1 : 0;
|
|
1491
|
+
exports.Heap = Heap;
|
|
1493
1492
|
function sort(cmp, array, index, length, stable) {
|
|
1494
1493
|
if (length === 0) return false;
|
|
1495
1494
|
switch (index) {
|
|
@@ -1631,9 +1630,9 @@ class MultiHeap {
|
|
|
1631
1630
|
this.$length = 0;
|
|
1632
1631
|
}
|
|
1633
1632
|
}
|
|
1634
|
-
exports.MultiHeap = MultiHeap;
|
|
1635
1633
|
MultiHeap.max = Heap.max;
|
|
1636
1634
|
MultiHeap.min = Heap.min;
|
|
1635
|
+
exports.MultiHeap = MultiHeap;
|
|
1637
1636
|
|
|
1638
1637
|
/***/ }),
|
|
1639
1638
|
|
|
@@ -1993,10 +1992,10 @@ class PriorityQueue {
|
|
|
1993
1992
|
return;
|
|
1994
1993
|
}
|
|
1995
1994
|
}
|
|
1996
|
-
exports.PriorityQueue = PriorityQueue;
|
|
1997
1995
|
PriorityQueue.priority = Symbol('priority');
|
|
1998
1996
|
PriorityQueue.max = heap_1.Heap.max;
|
|
1999
1997
|
PriorityQueue.min = heap_1.Heap.min;
|
|
1998
|
+
exports.PriorityQueue = PriorityQueue;
|
|
2000
1999
|
class MultiQueue {
|
|
2001
2000
|
constructor(entries) {
|
|
2002
2001
|
this.dict = new Map();
|
|
@@ -2570,7 +2569,6 @@ class ReadonlyURL {
|
|
|
2570
2569
|
return this.href;
|
|
2571
2570
|
}
|
|
2572
2571
|
}
|
|
2573
|
-
exports.ReadonlyURL = ReadonlyURL;
|
|
2574
2572
|
// Can't freeze URL object in the Firefox extension environment.
|
|
2575
2573
|
// ref: https://github.com/falsandtru/pjax-api/issues/44#issuecomment-633915035
|
|
2576
2574
|
// Bug: Error in dependents.
|
|
@@ -2578,6 +2576,7 @@ exports.ReadonlyURL = ReadonlyURL;
|
|
|
2578
2576
|
ReadonlyURL.get = (0, memoize_1.memoize)((url, base) => ({
|
|
2579
2577
|
url: new __webpack_require__.g.URL(url, base)
|
|
2580
2578
|
}), (url, base = '') => `${base.indexOf('\n') > -1 ? base.replace(/\n+/g, '') : base}\n${url}`, new cache_1.Cache(10000));
|
|
2579
|
+
exports.ReadonlyURL = ReadonlyURL;
|
|
2581
2580
|
|
|
2582
2581
|
/***/ }),
|
|
2583
2582
|
|
|
@@ -3540,7 +3539,6 @@ class Delimiters {
|
|
|
3540
3539
|
return false;
|
|
3541
3540
|
}
|
|
3542
3541
|
}
|
|
3543
|
-
exports.Delimiters = Delimiters;
|
|
3544
3542
|
_a = Delimiters;
|
|
3545
3543
|
Delimiters.matcher = (0, memoize_1.memoize)(pattern => {
|
|
3546
3544
|
switch (typeof pattern) {
|
|
@@ -3552,6 +3550,7 @@ Delimiters.matcher = (0, memoize_1.memoize)(pattern => {
|
|
|
3552
3550
|
return (0, memoize_1.reduce)(source => pattern.test(source) || undefined);
|
|
3553
3551
|
}
|
|
3554
3552
|
}, _a.signature);
|
|
3553
|
+
exports.Delimiters = Delimiters;
|
|
3555
3554
|
|
|
3556
3555
|
/***/ }),
|
|
3557
3556
|
|
|
@@ -3905,7 +3904,7 @@ const block_1 = __webpack_require__(4032);
|
|
|
3905
3904
|
const normalize_1 = __webpack_require__(185);
|
|
3906
3905
|
const header_2 = __webpack_require__(7790);
|
|
3907
3906
|
const figure_1 = __webpack_require__(9123);
|
|
3908
|
-
const
|
|
3907
|
+
const note_1 = __webpack_require__(6745);
|
|
3909
3908
|
const url_1 = __webpack_require__(2261);
|
|
3910
3909
|
const array_1 = __webpack_require__(8112);
|
|
3911
3910
|
function bind(target, settings) {
|
|
@@ -4016,7 +4015,7 @@ function bind(target, settings) {
|
|
|
4016
4015
|
type: 'cancel'
|
|
4017
4016
|
};
|
|
4018
4017
|
}
|
|
4019
|
-
for (const el of (0, figure_1.figure)(next(0)?.parentNode ?? target, settings.
|
|
4018
|
+
for (const el of (0, figure_1.figure)(next(0)?.parentNode ?? target, settings.notes, context)) {
|
|
4020
4019
|
el ? yield {
|
|
4021
4020
|
type: 'figure',
|
|
4022
4021
|
value: el
|
|
@@ -4027,9 +4026,9 @@ function bind(target, settings) {
|
|
|
4027
4026
|
type: 'cancel'
|
|
4028
4027
|
};
|
|
4029
4028
|
}
|
|
4030
|
-
for (const el of (0,
|
|
4029
|
+
for (const el of (0, note_1.note)(next(0)?.parentNode ?? target, settings.notes, context, bottom)) {
|
|
4031
4030
|
el ? yield {
|
|
4032
|
-
type: '
|
|
4031
|
+
type: 'note',
|
|
4033
4032
|
value: el
|
|
4034
4033
|
} : yield {
|
|
4035
4034
|
type: 'break'
|
|
@@ -4230,7 +4229,7 @@ const block_1 = __webpack_require__(4032);
|
|
|
4230
4229
|
const normalize_1 = __webpack_require__(185);
|
|
4231
4230
|
const header_2 = __webpack_require__(7790);
|
|
4232
4231
|
const figure_1 = __webpack_require__(9123);
|
|
4233
|
-
const
|
|
4232
|
+
const note_1 = __webpack_require__(6745);
|
|
4234
4233
|
const url_1 = __webpack_require__(2261);
|
|
4235
4234
|
const dom_1 = __webpack_require__(3252);
|
|
4236
4235
|
function parse(source, opts = {}, context) {
|
|
@@ -4266,8 +4265,8 @@ function parse(source, opts = {}, context) {
|
|
|
4266
4265
|
}), []));
|
|
4267
4266
|
}
|
|
4268
4267
|
if (opts.test) return node;
|
|
4269
|
-
for (const _ of (0, figure_1.figure)(node, opts.
|
|
4270
|
-
for (const _ of (0,
|
|
4268
|
+
for (const _ of (0, figure_1.figure)(node, opts.notes, context));
|
|
4269
|
+
for (const _ of (0, note_1.note)(node, opts.notes, context));
|
|
4271
4270
|
return node;
|
|
4272
4271
|
}
|
|
4273
4272
|
exports.parse = parse;
|
|
@@ -4376,7 +4375,7 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
|
|
|
4376
4375
|
});
|
|
4377
4376
|
const document = (0, parse_1.parse)(source, {
|
|
4378
4377
|
id: '',
|
|
4379
|
-
|
|
4378
|
+
notes: {
|
|
4380
4379
|
references
|
|
4381
4380
|
}
|
|
4382
4381
|
}, context);
|
|
@@ -4526,7 +4525,7 @@ exports.aside = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
|
|
|
4526
4525
|
});
|
|
4527
4526
|
const document = (0, parse_1.parse)(body.slice(0, -1), {
|
|
4528
4527
|
id: '',
|
|
4529
|
-
|
|
4528
|
+
notes: {
|
|
4530
4529
|
references
|
|
4531
4530
|
}
|
|
4532
4531
|
}, context);
|
|
@@ -4539,7 +4538,7 @@ exports.aside = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, co
|
|
|
4539
4538
|
'data-invalid-message': 'Missing the title at the first line'
|
|
4540
4539
|
}, `${opener}${body}${closer}`)];
|
|
4541
4540
|
return [(0, dom_1.html)('aside', {
|
|
4542
|
-
id: (0, indexee_1.identity)(context.id, (0, indexee_1.
|
|
4541
|
+
id: (0, indexee_1.identity)(context.id, (0, indexee_1.index)(heading)),
|
|
4543
4542
|
class: 'aside'
|
|
4544
4543
|
}, [document, (0, dom_1.html)('h2', 'References'), references])];
|
|
4545
4544
|
})));
|
|
@@ -4580,7 +4579,7 @@ exports.example = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0,
|
|
|
4580
4579
|
});
|
|
4581
4580
|
const document = (0, parse_1.parse)(body.slice(0, -1), {
|
|
4582
4581
|
id: '',
|
|
4583
|
-
|
|
4582
|
+
notes: {
|
|
4584
4583
|
references
|
|
4585
4584
|
}
|
|
4586
4585
|
}, context);
|
|
@@ -5737,7 +5736,7 @@ const shortmedia_1 = __webpack_require__(4189);
|
|
|
5737
5736
|
const autolink_1 = __webpack_require__(6051);
|
|
5738
5737
|
const bracket_1 = __webpack_require__(5196);
|
|
5739
5738
|
const source_1 = __webpack_require__(6743);
|
|
5740
|
-
exports.inline = (0, combinator_1.union)([annotation_1.annotation, reference_1.reference, template_1.template, comment_1.comment, math_1.math, extension_1.extension, ruby_1.ruby, link_1.textlink, link_1.linemedialink, media_1.linemedia, html_1.html, insertion_1.insertion, deletion_1.deletion, mark_1.mark, strong_1.strong, emphasis_1.emphasis, code_1.code, htmlentity_1.htmlentity, shortmedia_1.lineshortmedia, autolink_1.autolink, bracket_1.bracket, source_1.text]);
|
|
5739
|
+
exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([annotation_1.annotation, reference_1.reference, template_1.template, comment_1.comment, math_1.math, extension_1.extension, ruby_1.ruby, link_1.textlink, link_1.linemedialink, media_1.linemedia, html_1.html, insertion_1.insertion, deletion_1.deletion, mark_1.mark, strong_1.strong, emphasis_1.emphasis, code_1.code, htmlentity_1.htmlentity, shortmedia_1.lineshortmedia, autolink_1.autolink, bracket_1.bracket, source_1.text]));
|
|
5741
5740
|
var indexee_1 = __webpack_require__(1269);
|
|
5742
5741
|
Object.defineProperty(exports, "indexee", ({
|
|
5743
5742
|
enumerable: true,
|
|
@@ -5809,7 +5808,7 @@ const hashnum_1 = __webpack_require__(5631);
|
|
|
5809
5808
|
const anchor_1 = __webpack_require__(6495);
|
|
5810
5809
|
const source_1 = __webpack_require__(6743);
|
|
5811
5810
|
const util_1 = __webpack_require__(9437);
|
|
5812
|
-
exports.autolink = (0, combinator_1.validate)(/^(?:[@#>0-9a-z\r\n]|\S[#>])/i, (0, combinator_1.constraint)(2 /* State.autolink */, false, (0, combinator_1.syntax)(2 /* Syntax.autolink */, 1, 1, ~1 /* State.shortcut */, (0, combinator_1.union)([(0, combinator_1.some)((0, combinator_1.union)([url_1.lineurl])), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email,
|
|
5811
|
+
exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/^(?:[@#>0-9a-z\r\n]|\S[#>])/i, (0, combinator_1.constraint)(2 /* State.autolink */, false, (0, combinator_1.syntax)(2 /* Syntax.autolink */, 1, 1, ~1 /* State.shortcut */, (0, combinator_1.union)([(0, combinator_1.some)((0, combinator_1.union)([url_1.lineurl])), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email,
|
|
5813
5812
|
// Escape unmatched email-like strings.
|
|
5814
5813
|
(0, combinator_1.focus)(/^[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z])*(?:@(?:[0-9a-z]+(?:[.-][0-9a-z]+)*)?)*/i, ({
|
|
5815
5814
|
source
|
|
@@ -5826,7 +5825,7 @@ exports.autolink = (0, combinator_1.validate)(/^(?:[@#>0-9a-z\r\n]|\S[#>])/i, (0
|
|
|
5826
5825
|
// Escape unmatched hashtag-like strings.
|
|
5827
5826
|
(0, source_1.str)(new RegExp(/^#+(?:[^\p{C}\p{S}\p{P}\s]|emoji|')*/u.source.replace('emoji', hashtag_1.emoji), 'u')),
|
|
5828
5827
|
// Escape invalid leading characters.
|
|
5829
|
-
(0, source_1.str)(/^[0-9\p{Sc}](?=>)/u), anchor_1.anchor])), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)])]))));
|
|
5828
|
+
(0, source_1.str)(/^[0-9\p{Sc}](?=>)/u), anchor_1.anchor])), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)])])))));
|
|
5830
5829
|
|
|
5831
5830
|
/***/ }),
|
|
5832
5831
|
|
|
@@ -5988,7 +5987,7 @@ const link_1 = __webpack_require__(9628);
|
|
|
5988
5987
|
const source_1 = __webpack_require__(6743);
|
|
5989
5988
|
const closer = /^[-+*=~^_,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
|
|
5990
5989
|
exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.unsafelink])))));
|
|
5991
|
-
exports.lineurl = (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.focus)(/^https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink))]));
|
|
5990
|
+
exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.open)(source_1.linebreak, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.focus)(/^https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/, (0, combinator_1.convert)(url => `{ ${url} }`, link_1.unsafelink))])));
|
|
5992
5991
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.precedence)(2, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
|
|
5993
5992
|
|
|
5994
5993
|
/***/ }),
|
|
@@ -6162,14 +6161,15 @@ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, comb
|
|
|
6162
6161
|
Object.defineProperty(exports, "__esModule", ({
|
|
6163
6162
|
value: true
|
|
6164
6163
|
}));
|
|
6165
|
-
exports.text = exports.identity = exports.indexee = void 0;
|
|
6164
|
+
exports.text = exports.index = exports.identity = exports.indexee = void 0;
|
|
6166
6165
|
const combinator_1 = __webpack_require__(2087);
|
|
6166
|
+
const memoize_1 = __webpack_require__(1808);
|
|
6167
6167
|
const dom_1 = __webpack_require__(3252);
|
|
6168
6168
|
function indexee(parser, optional) {
|
|
6169
6169
|
return (0, combinator_1.fmap)(parser, ([el], _, {
|
|
6170
6170
|
id
|
|
6171
6171
|
}) => [(0, dom_1.define)(el, {
|
|
6172
|
-
id: identity(id,
|
|
6172
|
+
id: identity(id, index(el, optional))
|
|
6173
6173
|
})]);
|
|
6174
6174
|
}
|
|
6175
6175
|
exports.indexee = indexee;
|
|
@@ -6183,17 +6183,20 @@ function identity(id, text, name = 'index') {
|
|
|
6183
6183
|
case 'index':
|
|
6184
6184
|
return `${name}:${id ?? ''}:${cs.slice(0, 97).join('')}...`;
|
|
6185
6185
|
case 'mark':
|
|
6186
|
-
case 'note':
|
|
6187
6186
|
return `${name}:${id ?? ''}:${cs.slice(0, 50).join('')}...${cs.slice(-47).join('')}`;
|
|
6188
6187
|
}
|
|
6189
6188
|
}
|
|
6190
6189
|
exports.identity = identity;
|
|
6191
|
-
function
|
|
6190
|
+
function index(source, optional = false) {
|
|
6192
6191
|
if (!source.firstChild) return '';
|
|
6193
6192
|
const indexer = source.querySelector(':scope > .indexer');
|
|
6194
6193
|
const index = indexer?.getAttribute('data-index');
|
|
6195
6194
|
if (index) return index;
|
|
6196
6195
|
if (index === '' && optional) return '';
|
|
6196
|
+
return (0, exports.text)(source);
|
|
6197
|
+
}
|
|
6198
|
+
exports.index = index;
|
|
6199
|
+
exports.text = (0, memoize_1.reduce)(source => {
|
|
6197
6200
|
const target = source.cloneNode(true);
|
|
6198
6201
|
for (let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, br, .annotation, .reference, .checkbox, ul, ol'), len = es.length, i = 0; i < len; ++i) {
|
|
6199
6202
|
const el = es[i];
|
|
@@ -6224,8 +6227,7 @@ function text(source, optional = false) {
|
|
|
6224
6227
|
// Better:
|
|
6225
6228
|
//return target.innerText;
|
|
6226
6229
|
return target.textContent;
|
|
6227
|
-
}
|
|
6228
|
-
exports.text = text;
|
|
6230
|
+
});
|
|
6229
6231
|
|
|
6230
6232
|
/***/ }),
|
|
6231
6233
|
|
|
@@ -6684,7 +6686,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
|
|
|
6684
6686
|
}))))));
|
|
6685
6687
|
exports.linemedia = (0, combinator_1.surround)(source_1.linebreak, (0, combinator_1.union)([exports.media]), /^(?=[^\S\n]*(?:$|\n))/);
|
|
6686
6688
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true)])));
|
|
6687
|
-
const option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]);
|
|
6689
|
+
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*x[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` width="${opt.slice(1).split('x')[0]}"`, ` height="${opt.slice(1).split('x')[1]}"`]), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[1-9][0-9]*:[1-9][0-9]*(?=[^\S\n]|})/), ([opt]) => [` aspect-ratio="${opt.slice(1).split(':').join('/')}"`]), link_1.option]));
|
|
6688
6690
|
function sanitize(target, uri, alt) {
|
|
6689
6691
|
switch (uri.protocol) {
|
|
6690
6692
|
case 'http:':
|
|
@@ -6926,8 +6928,8 @@ const queue_1 = __webpack_require__(4934);
|
|
|
6926
6928
|
const array_1 = __webpack_require__(8112);
|
|
6927
6929
|
const dom_1 = __webpack_require__(3252);
|
|
6928
6930
|
const query_1 = __webpack_require__(6120);
|
|
6929
|
-
function* figure(target,
|
|
6930
|
-
const refs = new queue_1.MultiQueue((0, array_1.push)((0, query_1.querySelectorAll)(target, 'a.label:not(.disabled)[data-label]'),
|
|
6931
|
+
function* figure(target, notes, opts = {}) {
|
|
6932
|
+
const refs = new queue_1.MultiQueue((0, array_1.push)((0, query_1.querySelectorAll)(target, 'a.label:not(.disabled)[data-label]'), notes && (0, query_1.querySelectorAll)(notes.references, 'a.label:not(.disabled)') || []).map(el => [el.getAttribute('data-label'), el]));
|
|
6931
6933
|
const labels = new Set();
|
|
6932
6934
|
const numbers = new Map();
|
|
6933
6935
|
let base = '0';
|
|
@@ -7078,7 +7080,7 @@ function capitalize(label) {
|
|
|
7078
7080
|
|
|
7079
7081
|
/***/ }),
|
|
7080
7082
|
|
|
7081
|
-
/***/
|
|
7083
|
+
/***/ 6745:
|
|
7082
7084
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
7083
7085
|
|
|
7084
7086
|
"use strict";
|
|
@@ -7087,25 +7089,25 @@ function capitalize(label) {
|
|
|
7087
7089
|
Object.defineProperty(exports, "__esModule", ({
|
|
7088
7090
|
value: true
|
|
7089
7091
|
}));
|
|
7090
|
-
exports.reference = exports.annotation = exports.
|
|
7092
|
+
exports.reference = exports.annotation = exports.note = void 0;
|
|
7091
7093
|
const indexee_1 = __webpack_require__(1269);
|
|
7092
7094
|
const dom_1 = __webpack_require__(3252);
|
|
7093
|
-
function*
|
|
7095
|
+
function* note(target, notes, opts = {}, bottom = null) {
|
|
7094
7096
|
for (let es = target.querySelectorAll(`.annotations`), len = es.length, i = 0; i < len; ++i) {
|
|
7095
7097
|
const el = es[i];
|
|
7096
7098
|
el.parentNode === target && el.remove();
|
|
7097
7099
|
}
|
|
7098
|
-
yield* (0, exports.
|
|
7099
|
-
yield* (0, exports.
|
|
7100
|
+
yield* (0, exports.annotation)(target, notes?.annotations, opts, bottom);
|
|
7101
|
+
yield* (0, exports.reference)(target, notes?.references, opts, bottom);
|
|
7100
7102
|
return;
|
|
7101
7103
|
}
|
|
7102
|
-
exports.
|
|
7104
|
+
exports.note = note;
|
|
7103
7105
|
exports.annotation = build('annotation', n => `*${n}`, 'h1, h2, h3, h4, h5, h6, aside.aside, hr');
|
|
7104
7106
|
exports.reference = build('reference', (n, abbr) => `[${abbr || n}]`);
|
|
7105
7107
|
function build(syntax, marker, splitter = '_') {
|
|
7106
7108
|
// Referenceを含むAnnotationの重複排除は両構文が互いに処理済みであることを必要とするため
|
|
7107
7109
|
// 構文ごとに各1回の処理では不可能
|
|
7108
|
-
return function* (target,
|
|
7110
|
+
return function* (target, note, opts = {}, bottom = null) {
|
|
7109
7111
|
const defs = new Map();
|
|
7110
7112
|
const splitters = [];
|
|
7111
7113
|
for (let es = target.querySelectorAll(splitter), len = es.length, i = 0; i < len; ++i) {
|
|
@@ -7115,25 +7117,16 @@ function build(syntax, marker, splitter = '_') {
|
|
|
7115
7117
|
}
|
|
7116
7118
|
const refs = target.querySelectorAll(`sup.${syntax}:not(.disabled)`);
|
|
7117
7119
|
const titles = new Map();
|
|
7118
|
-
const
|
|
7119
|
-
for (let len = refs.length, i = 0; i < len; ++i) {
|
|
7120
|
-
if (i % 10 === 9) yield;
|
|
7121
|
-
const ref = refs[i];
|
|
7122
|
-
const identifier = ref.getAttribute('data-abbr') || ` ${ref.firstElementChild.innerHTML}`;
|
|
7123
|
-
if (titles.has(identifier)) continue;
|
|
7124
|
-
const content = (0, dom_1.html)('span', {
|
|
7125
|
-
id: (0, indexee_1.identity)(opts.id, (0, indexee_1.text)(ref.firstElementChild), 'note')
|
|
7126
|
-
}, ref.firstElementChild.cloneNode(true).childNodes);
|
|
7127
|
-
const title = (0, indexee_1.text)(content).trim();
|
|
7128
|
-
if (!title) continue;
|
|
7129
|
-
titles.set(identifier, title);
|
|
7130
|
-
contents.set(identifier, content);
|
|
7131
|
-
}
|
|
7120
|
+
const indexes = new Map();
|
|
7132
7121
|
let count = 0;
|
|
7133
7122
|
let total = 0;
|
|
7134
7123
|
let style;
|
|
7135
7124
|
for (let len = refs.length, i = 0; i < len; ++i) {
|
|
7136
7125
|
const ref = refs[i];
|
|
7126
|
+
if (ref.closest('[hidden]')) {
|
|
7127
|
+
yield;
|
|
7128
|
+
continue;
|
|
7129
|
+
}
|
|
7137
7130
|
while (splitters.length > 0 && splitters[0].compareDocumentPosition(ref) & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
7138
7131
|
if (defs.size > 0) {
|
|
7139
7132
|
total += defs.size;
|
|
@@ -7145,8 +7138,9 @@ function build(syntax, marker, splitter = '_') {
|
|
|
7145
7138
|
}
|
|
7146
7139
|
splitters.shift();
|
|
7147
7140
|
}
|
|
7148
|
-
const identifier = ref.getAttribute('data-abbr') || ` ${ref.firstElementChild.innerHTML}`;
|
|
7149
7141
|
const abbr = ref.getAttribute('data-abbr') || undefined;
|
|
7142
|
+
const identifier = abbr || (0, indexee_1.identity)(undefined, (0, indexee_1.text)(ref.firstElementChild), 'mark')?.slice(6) || '';
|
|
7143
|
+
const title = false || titles.get(identifier) || titles.set(identifier, (0, indexee_1.text)(ref.firstElementChild)).get(identifier) || null;
|
|
7150
7144
|
style ??= abbr ? 'abbr' : 'count';
|
|
7151
7145
|
if (style === 'count' ? abbr : !abbr) {
|
|
7152
7146
|
(0, dom_1.define)(ref, {
|
|
@@ -7168,21 +7162,21 @@ function build(syntax, marker, splitter = '_') {
|
|
|
7168
7162
|
} else {
|
|
7169
7163
|
ref.lastChild?.remove();
|
|
7170
7164
|
}
|
|
7171
|
-
const title = titles.get(identifier);
|
|
7172
7165
|
const refIndex = ++count;
|
|
7173
7166
|
const refId = opts.id !== '' ? `${syntax}:${opts.id ?? ''}:ref:${refIndex}` : undefined;
|
|
7174
7167
|
const def = false || defs.get(identifier) || defs.set(identifier, (0, dom_1.html)('li', {
|
|
7175
|
-
id: opts.id !== '' ? `${syntax}:${opts.id ?? ''}:def:${
|
|
7176
|
-
'data-marker': !
|
|
7177
|
-
}, [
|
|
7178
|
-
|
|
7168
|
+
id: opts.id !== '' ? `${syntax}:${opts.id ?? ''}:def:${identifier}` : undefined,
|
|
7169
|
+
'data-marker': !note ? marker(total + defs.size + 1, abbr) : undefined
|
|
7170
|
+
}, [(0, dom_1.define)(ref.firstElementChild.cloneNode(true), {
|
|
7171
|
+
hidden: null
|
|
7172
|
+
}), (0, dom_1.html)('sup')])).get(identifier);
|
|
7173
|
+
const defIndex = false || indexes.get(def) || indexes.set(def, total + defs.size).get(def);
|
|
7179
7174
|
const defId = def.id || undefined;
|
|
7180
7175
|
(0, dom_1.define)(ref, {
|
|
7181
7176
|
id: refId,
|
|
7182
|
-
class: opts.id !== '' ? undefined :
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
} : {
|
|
7177
|
+
class: opts.id !== '' ? undefined : void ref.classList.add('disabled'),
|
|
7178
|
+
title,
|
|
7179
|
+
...(!title && {
|
|
7186
7180
|
class: void ref.classList.add('invalid'),
|
|
7187
7181
|
'data-invalid-syntax': syntax,
|
|
7188
7182
|
'data-invalid-type': 'content',
|
|
@@ -7197,17 +7191,17 @@ function build(syntax, marker, splitter = '_') {
|
|
|
7197
7191
|
title: abbr && (0, indexee_1.text)((0, dom_1.frag)(ref.firstElementChild.cloneNode(true).childNodes)).trim() || undefined
|
|
7198
7192
|
}, `^${refIndex}`));
|
|
7199
7193
|
}
|
|
7200
|
-
if (defs.size > 0 ||
|
|
7201
|
-
yield* proc(defs,
|
|
7194
|
+
if (defs.size > 0 || note) {
|
|
7195
|
+
yield* proc(defs, note ?? target.insertBefore((0, dom_1.html)('ol', {
|
|
7202
7196
|
class: `${syntax}s`
|
|
7203
7197
|
}), splitters[0] ?? bottom));
|
|
7204
7198
|
}
|
|
7205
7199
|
return;
|
|
7206
7200
|
};
|
|
7207
|
-
function* proc(defs,
|
|
7201
|
+
function* proc(defs, note) {
|
|
7208
7202
|
const {
|
|
7209
7203
|
children
|
|
7210
|
-
} =
|
|
7204
|
+
} = note;
|
|
7211
7205
|
const size = defs.size;
|
|
7212
7206
|
let count = 0;
|
|
7213
7207
|
let length = children.length;
|
|
@@ -7217,16 +7211,16 @@ function build(syntax, marker, splitter = '_') {
|
|
|
7217
7211
|
while (length > size) {
|
|
7218
7212
|
const node = children[count - 1];
|
|
7219
7213
|
if (equal(node, def)) continue I;
|
|
7220
|
-
yield
|
|
7214
|
+
yield note.removeChild(node);
|
|
7221
7215
|
--length;
|
|
7222
7216
|
}
|
|
7223
7217
|
const node = count <= length ? children[count - 1] : null;
|
|
7224
7218
|
if (node && equal(node, def)) continue;
|
|
7225
|
-
yield
|
|
7219
|
+
yield note.insertBefore(def, node);
|
|
7226
7220
|
++length;
|
|
7227
7221
|
}
|
|
7228
7222
|
while (length > size) {
|
|
7229
|
-
yield
|
|
7223
|
+
yield note.removeChild(children[size]);
|
|
7230
7224
|
--length;
|
|
7231
7225
|
}
|
|
7232
7226
|
return;
|
|
@@ -8434,7 +8428,7 @@ function unlink(h) {
|
|
|
8434
8428
|
/***/ 3252:
|
|
8435
8429
|
/***/ (function(module) {
|
|
8436
8430
|
|
|
8437
|
-
/*! typed-dom v0.0.
|
|
8431
|
+
/*! typed-dom v0.0.330 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
8438
8432
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
8439
8433
|
if(true)
|
|
8440
8434
|
module.exports = factory();
|
|
@@ -8444,7 +8438,7 @@ return /******/ (() => { // webpackBootstrap
|
|
|
8444
8438
|
/******/ "use strict";
|
|
8445
8439
|
/******/ var __webpack_modules__ = ({
|
|
8446
8440
|
|
|
8447
|
-
/***/
|
|
8441
|
+
/***/ 5406:
|
|
8448
8442
|
/***/ ((__unused_webpack_module, exports) => {
|
|
8449
8443
|
|
|
8450
8444
|
|
|
@@ -8467,7 +8461,7 @@ exports.ObjectSetPrototypeOf = Object.setPrototypeOf;
|
|
|
8467
8461
|
|
|
8468
8462
|
/***/ }),
|
|
8469
8463
|
|
|
8470
|
-
/***/
|
|
8464
|
+
/***/ 5529:
|
|
8471
8465
|
/***/ ((__unused_webpack_module, exports) => {
|
|
8472
8466
|
|
|
8473
8467
|
|
|
@@ -8483,8 +8477,8 @@ exports.equal = equal;
|
|
|
8483
8477
|
|
|
8484
8478
|
/***/ }),
|
|
8485
8479
|
|
|
8486
|
-
/***/
|
|
8487
|
-
/***/ ((__unused_webpack_module, exports,
|
|
8480
|
+
/***/ 1808:
|
|
8481
|
+
/***/ ((__unused_webpack_module, exports, __nested_webpack_require_3150__) => {
|
|
8488
8482
|
|
|
8489
8483
|
|
|
8490
8484
|
|
|
@@ -8492,8 +8486,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8492
8486
|
value: true
|
|
8493
8487
|
}));
|
|
8494
8488
|
exports.reduce = exports.memoize = void 0;
|
|
8495
|
-
const alias_1 =
|
|
8496
|
-
const compare_1 =
|
|
8489
|
+
const alias_1 = __nested_webpack_require_3150__(5406);
|
|
8490
|
+
const compare_1 = __nested_webpack_require_3150__(5529);
|
|
8497
8491
|
function memoize(f, identify = (...as) => as[0], memory) {
|
|
8498
8492
|
if (typeof identify === 'object') return memoize(f, undefined, identify);
|
|
8499
8493
|
return (0, alias_1.isArray)(memory) || memory?.constructor === Object ? memoizeRecord(f, identify, memory) : memoizeDict(f, identify, memory ?? new Map());
|
|
@@ -8539,8 +8533,8 @@ exports.reduce = reduce;
|
|
|
8539
8533
|
|
|
8540
8534
|
/***/ }),
|
|
8541
8535
|
|
|
8542
|
-
/***/
|
|
8543
|
-
/***/ ((__unused_webpack_module, exports,
|
|
8536
|
+
/***/ 7521:
|
|
8537
|
+
/***/ ((__unused_webpack_module, exports, __nested_webpack_require_4668__) => {
|
|
8544
8538
|
|
|
8545
8539
|
|
|
8546
8540
|
|
|
@@ -8548,8 +8542,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8548
8542
|
value: true
|
|
8549
8543
|
}));
|
|
8550
8544
|
exports.defrag = exports.prepend = exports.append = exports.isChildren = exports.define = exports.element = exports.text = exports.svg = exports.html = exports.frag = exports.shadow = void 0;
|
|
8551
|
-
const alias_1 =
|
|
8552
|
-
const memoize_1 =
|
|
8545
|
+
const alias_1 = __nested_webpack_require_4668__(5406);
|
|
8546
|
+
const memoize_1 = __nested_webpack_require_4668__(1808);
|
|
8553
8547
|
var caches;
|
|
8554
8548
|
(function (caches) {
|
|
8555
8549
|
caches.shadows = new WeakMap();
|
|
@@ -8578,20 +8572,22 @@ function text(source) {
|
|
|
8578
8572
|
exports.text = text;
|
|
8579
8573
|
function element(context, ns) {
|
|
8580
8574
|
return (tag, attrs, children) => {
|
|
8581
|
-
|
|
8582
|
-
return !attrs || isChildren(attrs) ? defineChildren(el, attrs ?? children) : defineChildren(defineAttrs(el, attrs), children);
|
|
8575
|
+
return !attrs || isChildren(attrs) ? defineChildren(elem(context, ns, tag, {}), attrs ?? children) : defineChildren(defineAttrs(elem(context, ns, tag, attrs), attrs), children);
|
|
8583
8576
|
};
|
|
8584
8577
|
}
|
|
8585
8578
|
exports.element = element;
|
|
8586
|
-
function elem(context, ns, tag) {
|
|
8579
|
+
function elem(context, ns, tag, attrs) {
|
|
8587
8580
|
if (!('createElement' in context)) throw new Error(`TypedDOM: Scoped custom elements are not supported on this browser.`);
|
|
8581
|
+
const opts = 'is' in attrs ? {
|
|
8582
|
+
is: attrs['is']
|
|
8583
|
+
} : undefined;
|
|
8588
8584
|
switch (ns) {
|
|
8589
8585
|
case "HTML" /* NS.HTML */:
|
|
8590
|
-
return context.createElement(tag);
|
|
8586
|
+
return context.createElement(tag, opts);
|
|
8591
8587
|
case "SVG" /* NS.SVG */:
|
|
8592
|
-
return context.createElementNS('http://www.w3.org/2000/svg', tag);
|
|
8588
|
+
return context.createElementNS('http://www.w3.org/2000/svg', tag, opts);
|
|
8593
8589
|
case "MathML" /* NS.MathML */:
|
|
8594
|
-
return context.createElementNS('http://www.w3.org/1998/Math/MathML', tag);
|
|
8590
|
+
return context.createElementNS('http://www.w3.org/1998/Math/MathML', tag, opts);
|
|
8595
8591
|
}
|
|
8596
8592
|
}
|
|
8597
8593
|
function define(node, attrs, children) {
|
|
@@ -8606,8 +8602,11 @@ function define(node, attrs, children) {
|
|
|
8606
8602
|
}
|
|
8607
8603
|
exports.define = define;
|
|
8608
8604
|
function defineAttrs(el, attrs) {
|
|
8609
|
-
for (const name
|
|
8610
|
-
|
|
8605
|
+
for (const name of Object.keys(attrs)) {
|
|
8606
|
+
switch (name) {
|
|
8607
|
+
case 'is':
|
|
8608
|
+
continue;
|
|
8609
|
+
}
|
|
8611
8610
|
const value = attrs[name];
|
|
8612
8611
|
switch (typeof value) {
|
|
8613
8612
|
case 'string':
|
|
@@ -8675,7 +8674,7 @@ function defineChildren(node, children) {
|
|
|
8675
8674
|
return node;
|
|
8676
8675
|
}
|
|
8677
8676
|
function isChildren(value) {
|
|
8678
|
-
return
|
|
8677
|
+
return value?.[Symbol.iterator] !== undefined;
|
|
8679
8678
|
}
|
|
8680
8679
|
exports.isChildren = isChildren;
|
|
8681
8680
|
function append(node, children) {
|
|
@@ -8728,7 +8727,7 @@ exports.defrag = defrag;
|
|
|
8728
8727
|
/******/ var __webpack_module_cache__ = {};
|
|
8729
8728
|
/******/
|
|
8730
8729
|
/******/ // The require function
|
|
8731
|
-
/******/ function
|
|
8730
|
+
/******/ function __nested_webpack_require_11589__(moduleId) {
|
|
8732
8731
|
/******/ // Check if module is in cache
|
|
8733
8732
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
8734
8733
|
/******/ if (cachedModule !== undefined) {
|
|
@@ -8742,7 +8741,7 @@ exports.defrag = defrag;
|
|
|
8742
8741
|
/******/ };
|
|
8743
8742
|
/******/
|
|
8744
8743
|
/******/ // Execute the module function
|
|
8745
|
-
/******/ __webpack_modules__[moduleId](module, module.exports,
|
|
8744
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_11589__);
|
|
8746
8745
|
/******/
|
|
8747
8746
|
/******/ // Return the exports of the module
|
|
8748
8747
|
/******/ return module.exports;
|
|
@@ -8753,7 +8752,7 @@ exports.defrag = defrag;
|
|
|
8753
8752
|
/******/ // startup
|
|
8754
8753
|
/******/ // Load entry module and return exports
|
|
8755
8754
|
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
8756
|
-
/******/ var __nested_webpack_exports__ =
|
|
8755
|
+
/******/ var __nested_webpack_exports__ = __nested_webpack_require_11589__(7521);
|
|
8757
8756
|
/******/
|
|
8758
8757
|
/******/ return __nested_webpack_exports__;
|
|
8759
8758
|
/******/ })()
|
|
@@ -8765,7 +8764,7 @@ exports.defrag = defrag;
|
|
|
8765
8764
|
/***/ 6120:
|
|
8766
8765
|
/***/ (function(module) {
|
|
8767
8766
|
|
|
8768
|
-
/*! typed-dom v0.0.
|
|
8767
|
+
/*! typed-dom v0.0.330 https://github.com/falsandtru/typed-dom | (c) 2016, falsandtru | (Apache-2.0 AND MPL-2.0) License */
|
|
8769
8768
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
8770
8769
|
if(true)
|
|
8771
8770
|
module.exports = factory();
|
package/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface ParserSettings {
|
|
|
32
32
|
readonly id?: string;
|
|
33
33
|
// For editing.
|
|
34
34
|
readonly caches?: Partial<Caches>;
|
|
35
|
-
readonly
|
|
35
|
+
readonly notes: {
|
|
36
36
|
readonly references: HTMLOListElement;
|
|
37
37
|
};
|
|
38
38
|
readonly chunk?: boolean;
|
|
@@ -42,7 +42,7 @@ export type Progress =
|
|
|
42
42
|
| { readonly type: 'segment'; readonly value: string; }
|
|
43
43
|
| { readonly type: 'block'; readonly value: HTMLElement; }
|
|
44
44
|
| { readonly type: 'figure'; readonly value: HTMLAnchorElement; }
|
|
45
|
-
| { readonly type: '
|
|
45
|
+
| { readonly type: 'note'; readonly value: HTMLLIElement | HTMLElement; }
|
|
46
46
|
| { readonly type: 'break'; }
|
|
47
47
|
| { readonly type: 'cancel'; };
|
|
48
48
|
|