securemark 0.225.2 → 0.226.3
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 +16 -0
- package/design.md +13 -5
- package/dist/securemark.js +115 -86
- package/markdown.d.ts +14 -5
- package/package-lock.json +75 -95
- package/package.json +1 -1
- package/src/combinator/control/manipulation/scope.ts +1 -0
- package/src/parser/api/normalize.ts +6 -6
- package/src/parser/block/codeblock.ts +2 -2
- package/src/parser/block/extension/aside.ts +2 -2
- package/src/parser/block/extension/example.ts +2 -2
- package/src/parser/block/extension/message.ts +2 -2
- package/src/parser/block/extension/placeholder.ts +2 -2
- package/src/parser/block/extension/table.ts +2 -2
- package/src/parser/block/mathblock.test.ts +4 -3
- package/src/parser/block/mathblock.ts +6 -6
- package/src/parser/header.ts +1 -1
- package/src/parser/inline/bracket.ts +3 -3
- package/src/parser/inline/code.ts +1 -1
- package/src/parser/inline/extension/index.test.ts +1 -1
- package/src/parser/inline/extension/label.ts +2 -2
- package/src/parser/inline/html.ts +1 -1
- package/src/parser/inline/htmlentity.test.ts +1 -0
- package/src/parser/inline/htmlentity.ts +19 -4
- package/src/parser/inline/link.test.ts +1 -1
- package/src/parser/inline/math.test.ts +38 -32
- package/src/parser/inline/math.ts +6 -8
- package/src/parser/inline/media.ts +6 -6
- package/src/parser/inline/ruby.ts +9 -5
- package/src/parser/inline.ts +1 -0
- package/src/parser/locale.ts +17 -19
- package/src/parser/processor/footnote.ts +11 -0
- package/src/parser/segment.ts +1 -1
- package/src/parser/source/escapable.test.ts +9 -1
- package/src/parser/source/escapable.ts +3 -3
- package/src/parser/source/text.test.ts +2 -3
- package/src/parser/source/text.ts +17 -8
- package/src/parser/source/unescapable.test.ts +9 -0
- package/src/parser/util.ts +5 -4
package/CHANGELOG.md
CHANGED
package/design.md
CHANGED
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
|
|
70
70
|
### 自己完結性
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
ドキュメントはすべて初期(共通)構成の閲覧環境で閲覧できなければならない。
|
|
73
73
|
よって閲覧に拡張機能等の追加が必要となってはならない
|
|
74
74
|
|
|
75
75
|
ゆえにドキュメントはサードパーティツールなど自己完結性を損なうツールの使用をサポートしない。
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
|
|
140
140
|
オートリンクは原則としてコピー&ペーストによる引用等を経た際にその解釈が変わってはならない。
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
ゆえにハッシュタグ構文は構文が表示文字列と一致する構文であるオートリンク構文としてのみ構文化され、表示文字列からの構文の範囲の特定が不可能となる通常の構文を持たない。
|
|
143
143
|
|
|
144
144
|
### 自動附番
|
|
145
145
|
|
|
@@ -148,6 +148,14 @@
|
|
|
148
148
|
ゆえに参照箇所に実体を記述する注釈構文および識別に文字列を使用する図表構文を採用し、その表示方法は任意とする。
|
|
149
149
|
脚注構文は附番が手作業となり参照と実体の対応の管理が困難であるため不採用とし注釈構文により生成可能とする。
|
|
150
150
|
|
|
151
|
+
### 羅列的知識への非依存
|
|
152
|
+
|
|
153
|
+
構文はその使用のために羅列的知識を求めてはならない。
|
|
154
|
+
|
|
155
|
+
ゆえにバックスラッシュエスケープの特殊処理の対象は改行文字のみに限られる。
|
|
156
|
+
またURL構文はHTMLエンティティの参照の有効性を検査しない。
|
|
157
|
+
HTMLEntity構文はエンティティ追加時の互換性確保のため不正なエンティティを検出する。
|
|
158
|
+
|
|
151
159
|
### テンプレート対応
|
|
152
160
|
|
|
153
161
|
ソーステキストは自身をテンプレートとして別のソーステキストを生成するための構文を使用できなければならない。
|
|
@@ -271,7 +279,7 @@ CodeMirrorが素では速いがVimModeでは数万文字程度でも耐え難く
|
|
|
271
279
|
### バックトラック
|
|
272
280
|
|
|
273
281
|
SecuremarkのAnnotation構文に典型的であるようにスコープの生成規則を変える構文が存在する場合文脈の相違から解析結果を再利用不能な(`αA'β | αAB`)バックトラックが再帰的に生じ、このような言語を線形時間で解析することは基本的に不可能であり直ちに文脈を確定する任意の構文または記号の前に文脈の差異が生じない(`αAβ | αAB`)場合のみ再利用可能なバックトラックにより線形時間で解析できると思われる。
|
|
274
|
-
このため線形時間で解析可能な文法に制約されるCommonMark
|
|
282
|
+
このため線形時間で解析可能な文法に制約されるCommonMarkがこの制約を破らずこのような文脈不確定文法を導入することは不可能であるという拡張性の限界が存在する。
|
|
275
283
|
|
|
276
284
|
### 標準化
|
|
277
285
|
|
|
@@ -279,8 +287,8 @@ Markdownのように自然言語と自身の文法を分離する汎用構造が
|
|
|
279
287
|
このためCommonMarkは拡張構文を標準化した次期標準仕様との互換性を確保する役には立たずその有用性は構文の拡張を考慮しない範囲での効率的な実装方法の例示およびテストケースの集積による個別実装の支援ならびにその結果としての限定的互換性にとどまる。
|
|
280
288
|
さらにCommonMarkは前述の解析時間の制約から拡張性が低く、高度な構文や機能の実装可能性を考慮していないことから拡張仕様において準拠すべき技術的正当性もない。
|
|
281
289
|
|
|
282
|
-
よってMarkdown
|
|
283
|
-
MarkdownはGFM
|
|
290
|
+
よってMarkdownの標準化は後方互換性確保が不可能であることから発展性がなくスナップショット以上の技術的意味を持たない。
|
|
291
|
+
MarkdownはGFMのように最初から高機能で完成度の高い拡張不要な独自実装のほうが標準としての互換性を確保でき、構文に曖昧さがない形式言語と異なりまず最小限の標準仕様を策定しのちに拡張していく通常の標準化方法が適さない特殊な言語である。
|
|
284
292
|
|
|
285
293
|
### トランスクルージョン
|
|
286
294
|
|
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.226.3 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
|
|
2
2
|
require = function () {
|
|
3
3
|
function r(e, n, t) {
|
|
4
4
|
function o(i, f) {
|
|
@@ -4719,7 +4719,7 @@ require = function () {
|
|
|
4719
4719
|
const parser_1 = _dereq_('../../combinator/data/parser');
|
|
4720
4720
|
const UNICODE_REPLACEMENT_CHARACTER = '\uFFFD';
|
|
4721
4721
|
function normalize(source) {
|
|
4722
|
-
return format(
|
|
4722
|
+
return sanitize(format(source));
|
|
4723
4723
|
}
|
|
4724
4724
|
exports.normalize = normalize;
|
|
4725
4725
|
function format(source) {
|
|
@@ -4760,7 +4760,7 @@ require = function () {
|
|
|
4760
4760
|
'InvisibleComma',
|
|
4761
4761
|
'ic'
|
|
4762
4762
|
];
|
|
4763
|
-
const unreadableEscapableCharacters = unreadableHTMLEntityNames.flatMap(name => (0, parser_1.eval)((0, htmlentity_1.
|
|
4763
|
+
const unreadableEscapableCharacters = unreadableHTMLEntityNames.flatMap(name => (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(`&${ name };`, {}), []));
|
|
4764
4764
|
const unreadableEscapableCharacter = new RegExp(`[${ [...new Set(unreadableEscapableCharacters)].join('') }]`, 'g');
|
|
4765
4765
|
const unreadableSpecialCharacters = [
|
|
4766
4766
|
'\u2006',
|
|
@@ -5038,8 +5038,8 @@ require = function () {
|
|
|
5038
5038
|
class: 'invalid',
|
|
5039
5039
|
translate: 'no',
|
|
5040
5040
|
'data-invalid-syntax': 'codeblock',
|
|
5041
|
-
'data-invalid-type': closer ? '
|
|
5042
|
-
'data-invalid-description': closer ?
|
|
5041
|
+
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
5042
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5043
5043
|
}, `${ opener }${ body }${ closer }`)];
|
|
5044
5044
|
const file = (_a = path.split('/').pop()) !== null && _a !== void 0 ? _a : '';
|
|
5045
5045
|
const ext = file && file.includes('.', 1) ? file.split('.').pop() : '';
|
|
@@ -5176,8 +5176,8 @@ require = function () {
|
|
|
5176
5176
|
class: 'invalid',
|
|
5177
5177
|
translate: 'no',
|
|
5178
5178
|
'data-invalid-syntax': 'aside',
|
|
5179
|
-
'data-invalid-type': closer ? '
|
|
5180
|
-
'data-invalid-description': closer ?
|
|
5179
|
+
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
5180
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5181
5181
|
}, `${ opener }${ body }${ closer }`)];
|
|
5182
5182
|
const annotations = (0, typed_dom_1.html)('ol', { class: 'annotations' });
|
|
5183
5183
|
const references = (0, typed_dom_1.html)('ol', { class: 'references' });
|
|
@@ -5231,8 +5231,8 @@ require = function () {
|
|
|
5231
5231
|
class: 'invalid',
|
|
5232
5232
|
translate: 'no',
|
|
5233
5233
|
'data-invalid-syntax': 'example',
|
|
5234
|
-
'data-invalid-type': closer ? '
|
|
5235
|
-
'data-invalid-description': closer ?
|
|
5234
|
+
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
5235
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5236
5236
|
}, `${ opener }${ body }${ closer }`)];
|
|
5237
5237
|
switch (type) {
|
|
5238
5238
|
case 'markdown': {
|
|
@@ -5488,8 +5488,8 @@ require = function () {
|
|
|
5488
5488
|
class: 'invalid',
|
|
5489
5489
|
translate: 'no',
|
|
5490
5490
|
'data-invalid-syntax': 'message',
|
|
5491
|
-
'data-invalid-type': closer ? '
|
|
5492
|
-
'data-invalid-description': closer ?
|
|
5491
|
+
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
5492
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5493
5493
|
}, `${ opener }${ body }${ closer }`)];
|
|
5494
5494
|
switch (type) {
|
|
5495
5495
|
case 'note':
|
|
@@ -5559,8 +5559,8 @@ require = function () {
|
|
|
5559
5559
|
class: 'invalid',
|
|
5560
5560
|
translate: 'no',
|
|
5561
5561
|
'data-invalid-syntax': 'extension',
|
|
5562
|
-
'data-invalid-type': closer ? '
|
|
5563
|
-
'data-invalid-description': closer ?
|
|
5562
|
+
'data-invalid-type': !closer ? 'closer' : 'syntax',
|
|
5563
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid syntax.'
|
|
5564
5564
|
}, `${ opener }${ body }${ closer }`)])));
|
|
5565
5565
|
},
|
|
5566
5566
|
{
|
|
@@ -5593,8 +5593,8 @@ require = function () {
|
|
|
5593
5593
|
class: 'invalid',
|
|
5594
5594
|
translate: 'no',
|
|
5595
5595
|
'data-invalid-syntax': 'table',
|
|
5596
|
-
'data-invalid-type': closer ? '
|
|
5597
|
-
'data-invalid-description': closer ?
|
|
5596
|
+
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
5597
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5598
5598
|
}, `${ opener }${ body }${ closer }`)],
|
|
5599
5599
|
''
|
|
5600
5600
|
];
|
|
@@ -5957,7 +5957,7 @@ require = function () {
|
|
|
5957
5957
|
const global_1 = _dereq_('spica/global');
|
|
5958
5958
|
const combinator_1 = _dereq_('../../combinator');
|
|
5959
5959
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5960
|
-
const opener = /^(
|
|
5960
|
+
const opener = /^(\${2,})(?!\$)([^\n]*)(?:$|\n)/;
|
|
5961
5961
|
exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 100))));
|
|
5962
5962
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 100, false))), false);
|
|
5963
5963
|
exports.mathblock = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 100), ([body, closer, opener, delim, param], _, {
|
|
@@ -5966,15 +5966,15 @@ require = function () {
|
|
|
5966
5966
|
} = {}
|
|
5967
5967
|
}) => {
|
|
5968
5968
|
var _a;
|
|
5969
|
-
return [closer && param.trimStart() === '' ? ((_a = cache === null || cache === void 0 ? void 0 : cache.get(
|
|
5969
|
+
return [delim.length === 2 && closer && param.trimStart() === '' ? ((_a = cache === null || cache === void 0 ? void 0 : cache.get(`\n${ body }`)) === null || _a === void 0 ? void 0 : _a.cloneNode(true)) || (0, typed_dom_1.html)('div', {
|
|
5970
5970
|
class: 'math',
|
|
5971
5971
|
translate: 'no'
|
|
5972
|
-
},
|
|
5972
|
+
}, `${ delim }\n${ body }${ delim }`) : (0, typed_dom_1.html)('pre', {
|
|
5973
5973
|
class: 'invalid',
|
|
5974
5974
|
translate: 'no',
|
|
5975
5975
|
'data-invalid-syntax': 'mathblock',
|
|
5976
|
-
'data-invalid-type':
|
|
5977
|
-
'data-invalid-description':
|
|
5976
|
+
'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? 'closer' : 'argument',
|
|
5977
|
+
'data-invalid-description': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5978
5978
|
}, `${ opener }${ body }${ closer }`)];
|
|
5979
5979
|
})));
|
|
5980
5980
|
},
|
|
@@ -6402,8 +6402,8 @@ require = function () {
|
|
|
6402
6402
|
exports.header = void 0;
|
|
6403
6403
|
const combinator_1 = _dereq_('../combinator');
|
|
6404
6404
|
const segment_1 = _dereq_('./segment');
|
|
6405
|
-
const normalize_1 = _dereq_('./api/normalize');
|
|
6406
6405
|
const source_1 = _dereq_('./source');
|
|
6406
|
+
const normalize_1 = _dereq_('./api/normalize');
|
|
6407
6407
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6408
6408
|
exports.header = (0, combinator_1.validate)(/^---+[^\S\v\f\r\n]*\r?\n[^\S\n]*(?=\S)/, (0, combinator_1.inits)([
|
|
6409
6409
|
(0, combinator_1.rewrite)((source, context) => {
|
|
@@ -6844,13 +6844,7 @@ require = function () {
|
|
|
6844
6844
|
/[0-9]{1,4}|[A-Za-z]/
|
|
6845
6845
|
].map(r => r.source).join('|') })`);
|
|
6846
6846
|
const indexFW = new RegExp(index.source.replace(/[019AZaz](?!,)/g, c => String.fromCharCode(c.charCodeAt(0) + 65248)));
|
|
6847
|
-
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
6848
|
-
'(',
|
|
6849
|
-
'\uFF08',
|
|
6850
|
-
'[',
|
|
6851
|
-
'{',
|
|
6852
|
-
'"'
|
|
6853
|
-
], (0, combinator_1.union)([
|
|
6847
|
+
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([
|
|
6854
6848
|
(0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(index), (0, source_1.str)(')'), false, ([as, bs = [], cs], rest) => [
|
|
6855
6849
|
(0, typed_dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)),
|
|
6856
6850
|
rest
|
|
@@ -6885,7 +6879,7 @@ require = function () {
|
|
|
6885
6879
|
(0, array_1.unshift)(as, bs),
|
|
6886
6880
|
rest
|
|
6887
6881
|
])
|
|
6888
|
-
]))
|
|
6882
|
+
]));
|
|
6889
6883
|
},
|
|
6890
6884
|
{
|
|
6891
6885
|
'../../combinator': 30,
|
|
@@ -6903,7 +6897,7 @@ require = function () {
|
|
|
6903
6897
|
exports.code = void 0;
|
|
6904
6898
|
const combinator_1 = _dereq_('../../combinator');
|
|
6905
6899
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6906
|
-
exports.code = (0, combinator_1.creator)((0, combinator_1.validate)('`',
|
|
6900
|
+
exports.code = (0, combinator_1.creator)((0, combinator_1.validate)('`', (0, combinator_1.match)(/^(`+)(?!`)([^\n]*?[^`\n])\1(?!`)/, ([whole, , body]) => rest => [
|
|
6907
6901
|
[(0, typed_dom_1.html)('code', { 'data-src': whole }, format(body))],
|
|
6908
6902
|
rest
|
|
6909
6903
|
])));
|
|
@@ -7301,14 +7295,14 @@ require = function () {
|
|
|
7301
7295
|
exports.segment = (0, combinator_1.clear)((0, combinator_1.validate)([
|
|
7302
7296
|
'[$',
|
|
7303
7297
|
'$'
|
|
7304
|
-
],
|
|
7298
|
+
], (0, combinator_1.union)([
|
|
7305
7299
|
(0, combinator_1.surround)('[', body, ']'),
|
|
7306
7300
|
body
|
|
7307
7301
|
])));
|
|
7308
7302
|
exports.label = (0, combinator_1.creator)((0, combinator_1.validate)([
|
|
7309
7303
|
'[$',
|
|
7310
7304
|
'$'
|
|
7311
|
-
],
|
|
7305
|
+
], (0, combinator_1.fmap)((0, combinator_1.guard)(context => {
|
|
7312
7306
|
var _a, _b, _c;
|
|
7313
7307
|
return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.label) !== null && _c !== void 0 ? _c : true;
|
|
7314
7308
|
}, (0, combinator_1.union)([
|
|
@@ -7413,7 +7407,7 @@ require = function () {
|
|
|
7413
7407
|
};
|
|
7414
7408
|
(0, alias_1.ObjectSetPrototypeOf)(attrspec, null);
|
|
7415
7409
|
(0, alias_1.ObjectValues)(attrspec).forEach(o => (0, alias_1.ObjectSetPrototypeOf)(o, null));
|
|
7416
|
-
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<',
|
|
7410
|
+
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)([
|
|
7417
7411
|
(0, combinator_1.match)(/^(?=<(wbr)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)('>'), true, ([, as = []], rest) => [
|
|
7418
7412
|
[(0, typed_dom_1.html)(tag, attributes('html', [], attrspec[tag], as))],
|
|
7419
7413
|
rest
|
|
@@ -7535,14 +7529,26 @@ require = function () {
|
|
|
7535
7529
|
function (_dereq_, module, exports) {
|
|
7536
7530
|
'use strict';
|
|
7537
7531
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7538
|
-
exports.htmlentity = void 0;
|
|
7532
|
+
exports.htmlentity = exports.unsafehtmlentity = void 0;
|
|
7539
7533
|
const combinator_1 = _dereq_('../../combinator');
|
|
7540
7534
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7541
7535
|
const parser = (0, typed_dom_1.html)('textarea');
|
|
7542
|
-
exports.
|
|
7536
|
+
exports.unsafehtmlentity = (0, combinator_1.creator)((0, combinator_1.validate)('&', (0, combinator_1.verify)((0, combinator_1.focus)(/^&[0-9A-Za-z]+;/, entity => [
|
|
7543
7537
|
[(parser.innerHTML = entity, parser.value)],
|
|
7544
7538
|
''
|
|
7545
|
-
])));
|
|
7539
|
+
]), ([str]) => str[0] !== '&' || str.length < 3)));
|
|
7540
|
+
exports.htmlentity = (0, combinator_1.creator)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]+;/, (0, combinator_1.union)([
|
|
7541
|
+
exports.unsafehtmlentity,
|
|
7542
|
+
str => [
|
|
7543
|
+
[(0, typed_dom_1.html)('span', {
|
|
7544
|
+
class: 'invalid',
|
|
7545
|
+
'data-invalid-syntax': 'htmlentity',
|
|
7546
|
+
'data-invalid-type': 'syntax',
|
|
7547
|
+
'data-invalid-description': 'Invalid HTML entity.'
|
|
7548
|
+
}, str)],
|
|
7549
|
+
''
|
|
7550
|
+
]
|
|
7551
|
+
]))));
|
|
7546
7552
|
},
|
|
7547
7553
|
{
|
|
7548
7554
|
'../../combinator': 30,
|
|
@@ -7762,9 +7768,9 @@ require = function () {
|
|
|
7762
7768
|
const util_1 = _dereq_('../util');
|
|
7763
7769
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7764
7770
|
const disallowedCommand = /\\(?:begin|tiny|huge|large)(?![0-9a-z])/i;
|
|
7765
|
-
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('$',
|
|
7766
|
-
(0, combinator_1.surround)('$',
|
|
7767
|
-
(0, combinator_1.surround)('$',
|
|
7771
|
+
exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('$', (0, combinator_1.rewrite)((0, combinator_1.union)([
|
|
7772
|
+
(0, combinator_1.surround)('$', (0, combinator_1.verify)((0, source_1.str)(/^(?![\s{}#$%&]|\d+(?:[,.]\d+)*[^-+*/=<>^_~\\$]|-[\da-z]|[a-z]+-)(?:\\\$|[\x20-\x23\x25-\x7E])+/i), util_1.isEndTightNodes), /^\$(?![0-9a-z])/i),
|
|
7773
|
+
(0, combinator_1.surround)('$', bracket, '$')
|
|
7768
7774
|
]), (source, {
|
|
7769
7775
|
caches: {math: cache} = {}
|
|
7770
7776
|
}) => {
|
|
@@ -7786,7 +7792,7 @@ require = function () {
|
|
|
7786
7792
|
}))));
|
|
7787
7793
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([
|
|
7788
7794
|
bracket,
|
|
7789
|
-
(0, combinator_1.some)(source_1.escsource, /^[{}]/)
|
|
7795
|
+
(0, combinator_1.some)(source_1.escsource, /^(?:[{}]|\\?\n)/)
|
|
7790
7796
|
])), '}', true)));
|
|
7791
7797
|
},
|
|
7792
7798
|
{
|
|
@@ -7826,7 +7832,7 @@ require = function () {
|
|
|
7826
7832
|
return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.media) !== null && _c !== void 0 ? _c : true;
|
|
7827
7833
|
}, (0, combinator_1.tails)([
|
|
7828
7834
|
(0, combinator_1.dup)((0, combinator_1.surround)(/^\[(?!\s*\\\s)/, (0, combinator_1.some)((0, combinator_1.union)([
|
|
7829
|
-
htmlentity_1.
|
|
7835
|
+
htmlentity_1.unsafehtmlentity,
|
|
7830
7836
|
bracket,
|
|
7831
7837
|
source_1.txt
|
|
7832
7838
|
]), ']', /^\\?\n/), ']', true)),
|
|
@@ -7866,7 +7872,7 @@ require = function () {
|
|
|
7866
7872
|
})));
|
|
7867
7873
|
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([
|
|
7868
7874
|
(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([
|
|
7869
|
-
htmlentity_1.
|
|
7875
|
+
htmlentity_1.unsafehtmlentity,
|
|
7870
7876
|
bracket,
|
|
7871
7877
|
source_1.txt
|
|
7872
7878
|
]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [
|
|
@@ -7874,7 +7880,7 @@ require = function () {
|
|
|
7874
7880
|
rest
|
|
7875
7881
|
]),
|
|
7876
7882
|
(0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([
|
|
7877
|
-
htmlentity_1.
|
|
7883
|
+
htmlentity_1.unsafehtmlentity,
|
|
7878
7884
|
bracket,
|
|
7879
7885
|
source_1.txt
|
|
7880
7886
|
]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [
|
|
@@ -7882,7 +7888,7 @@ require = function () {
|
|
|
7882
7888
|
rest
|
|
7883
7889
|
]),
|
|
7884
7890
|
(0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([
|
|
7885
|
-
htmlentity_1.
|
|
7891
|
+
htmlentity_1.unsafehtmlentity,
|
|
7886
7892
|
bracket,
|
|
7887
7893
|
source_1.txt
|
|
7888
7894
|
]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [
|
|
@@ -7890,7 +7896,7 @@ require = function () {
|
|
|
7890
7896
|
rest
|
|
7891
7897
|
]),
|
|
7892
7898
|
(0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.some)((0, combinator_1.union)([
|
|
7893
|
-
htmlentity_1.
|
|
7899
|
+
htmlentity_1.unsafehtmlentity,
|
|
7894
7900
|
source_1.txt
|
|
7895
7901
|
]), '"'), (0, source_1.str)('"'), true)
|
|
7896
7902
|
]));
|
|
@@ -8052,10 +8058,12 @@ require = function () {
|
|
|
8052
8058
|
while (source !== '') {
|
|
8053
8059
|
switch (source[0]) {
|
|
8054
8060
|
case '&': {
|
|
8055
|
-
const result = (0, htmlentity_1.
|
|
8056
|
-
|
|
8057
|
-
|
|
8058
|
-
|
|
8061
|
+
const result = (0, htmlentity_1.unsafehtmlentity)(source, context);
|
|
8062
|
+
if (result) {
|
|
8063
|
+
acc[acc.length - 1] += (0, parser_1.eval)(result, [source[0]])[0];
|
|
8064
|
+
source = (0, parser_1.exec)(result, source.slice(1));
|
|
8065
|
+
continue;
|
|
8066
|
+
}
|
|
8059
8067
|
}
|
|
8060
8068
|
default: {
|
|
8061
8069
|
if (source[0].trimStart() === '') {
|
|
@@ -8206,11 +8214,9 @@ require = function () {
|
|
|
8206
8214
|
if (ns.length === 0)
|
|
8207
8215
|
return ns;
|
|
8208
8216
|
const el = ns.length === 1 && typeof ns[0] === 'object' ? ns[0] : (0, typed_dom_1.html)('div', ns);
|
|
8209
|
-
const es = el.
|
|
8217
|
+
const es = el.querySelectorAll('.linebreak:not(:empty)');
|
|
8210
8218
|
for (let i = 0, len = es.length; i < len; ++i) {
|
|
8211
8219
|
const sb = es[i];
|
|
8212
|
-
if (!sb.firstChild)
|
|
8213
|
-
continue;
|
|
8214
8220
|
if (!check(sb))
|
|
8215
8221
|
continue;
|
|
8216
8222
|
sb.firstChild.remove();
|
|
@@ -8226,28 +8232,28 @@ require = function () {
|
|
|
8226
8232
|
return (0, ja_1.japanese)(char);
|
|
8227
8233
|
}
|
|
8228
8234
|
function lastChar(node) {
|
|
8235
|
+
var _a, _b;
|
|
8229
8236
|
while (node = node === null || node === void 0 ? void 0 : node.previousSibling) {
|
|
8230
|
-
if ('id' in node
|
|
8231
|
-
|
|
8232
|
-
|
|
8237
|
+
if (!('id' in node))
|
|
8238
|
+
return (_a = [...node.data.slice(-2)].pop()) !== null && _a !== void 0 ? _a : '';
|
|
8239
|
+
if (node.firstChild)
|
|
8240
|
+
return (_b = [...text(node).slice(-2)].pop()) !== null && _b !== void 0 ? _b : '';
|
|
8241
|
+
switch (node.tagName) {
|
|
8242
|
+
case 'BR':
|
|
8243
|
+
return '';
|
|
8244
|
+
case 'SPAN':
|
|
8245
|
+
switch (node.className) {
|
|
8246
|
+
case 'linebreak':
|
|
8233
8247
|
return '';
|
|
8234
|
-
case 'SPAN':
|
|
8235
|
-
if (node.className === 'linebreak')
|
|
8236
|
-
return '';
|
|
8237
8248
|
}
|
|
8238
|
-
continue;
|
|
8239
8249
|
}
|
|
8240
|
-
const str = text(node);
|
|
8241
|
-
return str && [...str.slice(-2)].pop();
|
|
8242
8250
|
}
|
|
8243
8251
|
return '';
|
|
8244
8252
|
}
|
|
8245
|
-
function text(
|
|
8246
|
-
|
|
8247
|
-
return node.data;
|
|
8248
|
-
switch (node.tagName) {
|
|
8253
|
+
function text(el) {
|
|
8254
|
+
switch (el.tagName) {
|
|
8249
8255
|
case 'RUBY':
|
|
8250
|
-
for (let ns =
|
|
8256
|
+
for (let ns = el.childNodes, i = ns.length; i--;) {
|
|
8251
8257
|
const child = ns[i];
|
|
8252
8258
|
if ('id' in child)
|
|
8253
8259
|
continue;
|
|
@@ -8255,7 +8261,7 @@ require = function () {
|
|
|
8255
8261
|
}
|
|
8256
8262
|
return '';
|
|
8257
8263
|
default:
|
|
8258
|
-
return
|
|
8264
|
+
return el.textContent;
|
|
8259
8265
|
}
|
|
8260
8266
|
}
|
|
8261
8267
|
},
|
|
@@ -8417,6 +8423,7 @@ require = function () {
|
|
|
8417
8423
|
const buffer = new multimap_1.MultiMap();
|
|
8418
8424
|
const titles = new global_1.Map();
|
|
8419
8425
|
const check = footnotes.some(el => target.contains(el));
|
|
8426
|
+
let style;
|
|
8420
8427
|
for (let refs = target.querySelectorAll(`sup.${ syntax }:not(.disabled)`), i = 0, len = refs.length; i < len; ++i) {
|
|
8421
8428
|
yield;
|
|
8422
8429
|
const ref = refs[i];
|
|
@@ -8425,6 +8432,15 @@ require = function () {
|
|
|
8425
8432
|
const identifier = identify(ref);
|
|
8426
8433
|
const abbr = ref.getAttribute('data-abbr') || global_1.undefined;
|
|
8427
8434
|
const content = contentify(ref);
|
|
8435
|
+
style !== null && style !== void 0 ? style : style = abbr ? 'abbr' : 'count';
|
|
8436
|
+
if (style === 'count' ? abbr : !abbr) {
|
|
8437
|
+
(0, typed_dom_1.define)(ref, {
|
|
8438
|
+
class: `${ ref.className } invalid`,
|
|
8439
|
+
'data-invalid-syntax': syntax,
|
|
8440
|
+
'data-invalid-type': 'style',
|
|
8441
|
+
'data-invalid-description': `${ syntax[0].toUpperCase() + syntax.slice(1) } style must be consistent.`
|
|
8442
|
+
});
|
|
8443
|
+
}
|
|
8428
8444
|
if (((_a = ref.firstElementChild) === null || _a === void 0 ? void 0 : _a.getAttribute('hidden')) !== '') {
|
|
8429
8445
|
ref.replaceChildren((0, typed_dom_1.html)('span', { hidden: '' }, ref.childNodes));
|
|
8430
8446
|
} else {
|
|
@@ -8442,6 +8458,8 @@ require = function () {
|
|
|
8442
8458
|
if (title && !blank && def.childNodes.length === 1) {
|
|
8443
8459
|
def.insertBefore(content.cloneNode(true), def.lastChild);
|
|
8444
8460
|
for (const ref of buffer.take(identifier, global_1.Infinity)) {
|
|
8461
|
+
if (ref.getAttribute('data-invalid-type') !== 'content')
|
|
8462
|
+
continue;
|
|
8445
8463
|
(0, typed_dom_1.define)(ref, {
|
|
8446
8464
|
title,
|
|
8447
8465
|
class: void ref.classList.remove('invalid'),
|
|
@@ -8548,7 +8566,7 @@ require = function () {
|
|
|
8548
8566
|
}
|
|
8549
8567
|
exports.segment = segment;
|
|
8550
8568
|
function validate(source, size) {
|
|
8551
|
-
return source.length <= size /
|
|
8569
|
+
return source.length <= size / 4 || source.length <= size && new global_1.Blob([source]).size <= size;
|
|
8552
8570
|
}
|
|
8553
8571
|
exports.validate = validate;
|
|
8554
8572
|
},
|
|
@@ -8663,7 +8681,7 @@ require = function () {
|
|
|
8663
8681
|
];
|
|
8664
8682
|
default:
|
|
8665
8683
|
const b = source[0] !== '\n' && source[0].trimStart() === '';
|
|
8666
|
-
const i = b
|
|
8684
|
+
const i = b ? source.search(text_1.nonWhitespace) : 1;
|
|
8667
8685
|
return [
|
|
8668
8686
|
[source.slice(0, i)],
|
|
8669
8687
|
source.slice(i)
|
|
@@ -8764,6 +8782,30 @@ require = function () {
|
|
|
8764
8782
|
''
|
|
8765
8783
|
];
|
|
8766
8784
|
case 0:
|
|
8785
|
+
switch (source[0]) {
|
|
8786
|
+
case '\\':
|
|
8787
|
+
switch (source[1]) {
|
|
8788
|
+
case '\u3001':
|
|
8789
|
+
case '\u3002':
|
|
8790
|
+
case '\uFF01':
|
|
8791
|
+
case '\uFF1F':
|
|
8792
|
+
return (0, exports.text)(source.slice(1), context);
|
|
8793
|
+
}
|
|
8794
|
+
break;
|
|
8795
|
+
case '\u3001':
|
|
8796
|
+
case '\u3002':
|
|
8797
|
+
case '\uFF01':
|
|
8798
|
+
case '\uFF1F':
|
|
8799
|
+
const i = source.slice(1).search(exports.nonWhitespace) + 1;
|
|
8800
|
+
if (i > 0 && source.slice(i, i + 2) === '\\\n')
|
|
8801
|
+
return [
|
|
8802
|
+
[
|
|
8803
|
+
source[0],
|
|
8804
|
+
(0, typed_dom_1.html)('span', { class: 'linebreak' })
|
|
8805
|
+
],
|
|
8806
|
+
source.slice(i + 2)
|
|
8807
|
+
];
|
|
8808
|
+
}
|
|
8767
8809
|
switch (source[0]) {
|
|
8768
8810
|
case '\x7F':
|
|
8769
8811
|
return [
|
|
@@ -8802,20 +8844,6 @@ require = function () {
|
|
|
8802
8844
|
[source[0]],
|
|
8803
8845
|
source.slice(1)
|
|
8804
8846
|
];
|
|
8805
|
-
case '\u3001':
|
|
8806
|
-
case '\u3002':
|
|
8807
|
-
case '\uFF01':
|
|
8808
|
-
case '\uFF1F': {
|
|
8809
|
-
const i = source.slice(1).search(exports.nonWhitespace) + 1;
|
|
8810
|
-
if (i > 0 && source.slice(i, i + 2) === '\\\n')
|
|
8811
|
-
return [
|
|
8812
|
-
[
|
|
8813
|
-
source[0],
|
|
8814
|
-
(0, typed_dom_1.html)('span', { class: 'linebreak' })
|
|
8815
|
-
],
|
|
8816
|
-
source.slice(i + 2)
|
|
8817
|
-
];
|
|
8818
|
-
}
|
|
8819
8847
|
default:
|
|
8820
8848
|
const b = source[0].trimStart() === '';
|
|
8821
8849
|
const i = b || isAlphanumeric(source[0]) ? source.search(b ? exports.nonWhitespace : exports.nonAlphanumeric) : 1;
|
|
@@ -8997,7 +9025,7 @@ require = function () {
|
|
|
8997
9025
|
return ((_a = source[1]) === null || _a === void 0 ? void 0 : _a.trimStart()) !== '';
|
|
8998
9026
|
case '&':
|
|
8999
9027
|
switch (true) {
|
|
9000
|
-
case source.length > 2 && source[1] !== ' ' && ((_b = (0, parser_1.eval)((0, htmlentity_1.
|
|
9028
|
+
case source.length > 2 && source[1] !== ' ' && ((_b = (0, parser_1.eval)((0, htmlentity_1.unsafehtmlentity)(source, context))) === null || _b === void 0 ? void 0 : _b[0].trimStart()) === '':
|
|
9001
9029
|
return false;
|
|
9002
9030
|
}
|
|
9003
9031
|
return true;
|
|
@@ -9027,9 +9055,10 @@ require = function () {
|
|
|
9027
9055
|
if (nodes.length === 0)
|
|
9028
9056
|
return true;
|
|
9029
9057
|
for (let i = nodes.length; i--;) {
|
|
9030
|
-
|
|
9058
|
+
const node = nodes[i];
|
|
9059
|
+
if (typeof node === 'object' && node.className === 'comment')
|
|
9031
9060
|
continue;
|
|
9032
|
-
return isVisible(
|
|
9061
|
+
return isVisible(node, -1);
|
|
9033
9062
|
}
|
|
9034
9063
|
return false;
|
|
9035
9064
|
}
|
package/markdown.d.ts
CHANGED
|
@@ -844,7 +844,7 @@ export namespace MarkdownParser {
|
|
|
844
844
|
export interface TextParser extends
|
|
845
845
|
Inline<'media/text'>,
|
|
846
846
|
Parser<string[], Context, [
|
|
847
|
-
|
|
847
|
+
UnsafeHTMLEntityParser,
|
|
848
848
|
TextParser.BracketParser,
|
|
849
849
|
SourceParser.TxtParser,
|
|
850
850
|
]> {
|
|
@@ -854,22 +854,22 @@ export namespace MarkdownParser {
|
|
|
854
854
|
Inline<'media/text/bracket'>,
|
|
855
855
|
Parser<string, Context, [
|
|
856
856
|
Parser<string, Context, [
|
|
857
|
-
|
|
857
|
+
UnsafeHTMLEntityParser,
|
|
858
858
|
BracketParser,
|
|
859
859
|
SourceParser.TxtParser,
|
|
860
860
|
]>,
|
|
861
861
|
Parser<string, Context, [
|
|
862
|
-
|
|
862
|
+
UnsafeHTMLEntityParser,
|
|
863
863
|
BracketParser,
|
|
864
864
|
SourceParser.TxtParser,
|
|
865
865
|
]>,
|
|
866
866
|
Parser<string, Context, [
|
|
867
|
-
|
|
867
|
+
UnsafeHTMLEntityParser,
|
|
868
868
|
BracketParser,
|
|
869
869
|
SourceParser.TxtParser,
|
|
870
870
|
]>,
|
|
871
871
|
Parser<string, Context, [
|
|
872
|
-
|
|
872
|
+
UnsafeHTMLEntityParser,
|
|
873
873
|
SourceParser.TxtParser,
|
|
874
874
|
]>,
|
|
875
875
|
]> {
|
|
@@ -988,6 +988,7 @@ export namespace MarkdownParser {
|
|
|
988
988
|
Inline<'math'>,
|
|
989
989
|
Parser<HTMLElement, Context, [
|
|
990
990
|
SourceParser.StrParser,
|
|
991
|
+
MathParser.BracketParser,
|
|
991
992
|
]> {
|
|
992
993
|
}
|
|
993
994
|
export namespace MathParser {
|
|
@@ -1002,6 +1003,14 @@ export namespace MarkdownParser {
|
|
|
1002
1003
|
export interface HTMLEntityParser extends
|
|
1003
1004
|
// ©
|
|
1004
1005
|
Inline<'htmlentity'>,
|
|
1006
|
+
Parser<HTMLSpanElement | string, Context, [
|
|
1007
|
+
UnsafeHTMLEntityParser,
|
|
1008
|
+
Parser<HTMLSpanElement, Context, []>,
|
|
1009
|
+
]> {
|
|
1010
|
+
}
|
|
1011
|
+
export interface UnsafeHTMLEntityParser extends
|
|
1012
|
+
// ©
|
|
1013
|
+
Inline<'unsafehtmlentity'>,
|
|
1005
1014
|
Parser<string, Context, []> {
|
|
1006
1015
|
}
|
|
1007
1016
|
export interface ShortmediaParser extends
|