securemark 0.257.0 → 0.257.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +21 -8
  3. package/dist/index.js +94 -102
  4. package/markdown.d.ts +21 -22
  5. package/package.json +1 -1
  6. package/src/combinator/data/parser/inits.ts +1 -1
  7. package/src/combinator/data/parser/sequence.ts +1 -1
  8. package/src/debug.test.ts +1 -1
  9. package/src/parser/block/table.test.ts +5 -0
  10. package/src/parser/block/table.ts +6 -5
  11. package/src/parser/inline/annotation.test.ts +6 -5
  12. package/src/parser/inline/annotation.ts +5 -4
  13. package/src/parser/inline/autolink/account.ts +3 -7
  14. package/src/parser/inline/autolink/anchor.ts +3 -7
  15. package/src/parser/inline/autolink/hashnum.ts +3 -7
  16. package/src/parser/inline/autolink/hashtag.ts +3 -7
  17. package/src/parser/inline/autolink/url.test.ts +1 -0
  18. package/src/parser/inline/autolink/url.ts +4 -5
  19. package/src/parser/inline/bracket.test.ts +3 -1
  20. package/src/parser/inline/bracket.ts +6 -6
  21. package/src/parser/inline/comment.test.ts +1 -0
  22. package/src/parser/inline/deletion.ts +1 -1
  23. package/src/parser/inline/extension/index.ts +2 -2
  24. package/src/parser/inline/extension/placeholder.ts +2 -2
  25. package/src/parser/inline/insertion.ts +1 -1
  26. package/src/parser/inline/link.ts +55 -14
  27. package/src/parser/inline/mark.ts +1 -1
  28. package/src/parser/inline/math.ts +8 -9
  29. package/src/parser/inline/media.ts +5 -5
  30. package/src/parser/inline/reference.test.ts +6 -5
  31. package/src/parser/inline/reference.ts +7 -15
  32. package/src/parser/inline/template.ts +1 -1
  33. package/src/parser/inline.test.ts +5 -3
  34. package/src/parser/inline.ts +1 -0
  35. package/src/parser/util.ts +18 -18
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.257.3
4
+
5
+ - Fix styled table parser.
6
+
7
+ ## 0.257.2
8
+
9
+ - Fix operator precedence.
10
+
11
+ ## 0.257.1
12
+
13
+ - Refactoring.
14
+
3
15
  ## 0.257.0
4
16
 
5
17
  - Introduce operator precedence.
package/README.md CHANGED
@@ -22,6 +22,15 @@ Secure markdown renderer working on browsers for user input data.
22
22
  - Cross reference generation for annotations and references.
23
23
  - Table of contents.
24
24
 
25
+ ## Media
26
+
27
+ - Twitter
28
+ - YouTube
29
+ - PDF (.pdf)
30
+ - Video (.webm, .ogv)
31
+ - Audio (.oga, .ogg)
32
+ - Images
33
+
25
34
  ## Demos
26
35
 
27
36
  https://falsandtru.github.io/securemark/
@@ -58,14 +67,18 @@ https://falsandtru.github.io/securemark/
58
67
  - Template ({{ template }})
59
68
  - Comment ([% comment %])
60
69
 
61
- ## Media
62
-
63
- - Twitter
64
- - YouTube
65
- - PDF (.pdf)
66
- - Video (.webm, .ogv)
67
- - Audio (.oga, .ogg)
68
- - Images
70
+ ## Operator precedence
71
+
72
+ |P| Operators |
73
+ |-|-------------------|
74
+ |9| \n, \\\n |
75
+ |8| `, " |
76
+ |6| (()), [[]], ${}$ |
77
+ |5| \<tag>\</tag> |
78
+ |4| [% %] |
79
+ |3| $ |
80
+ |2| (), [], {} |
81
+ |1| *, **, ==, ++, ~~ |
69
82
 
70
83
  ## Dependencies
71
84
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.257.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.257.3 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("DOMPurify"), require("Prism"));
@@ -2851,6 +2851,7 @@ function inits(parsers) {
2851
2851
 
2852
2852
  for (let i = 0, len = parsers.length; i < len; ++i) {
2853
2853
  if (rest === '') break;
2854
+ if (context.delimiters?.match(rest, context.precedence)) break;
2854
2855
  const result = parsers[i](rest, context);
2855
2856
  if (!result) break;
2856
2857
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
@@ -2890,6 +2891,7 @@ function sequence(parsers) {
2890
2891
 
2891
2892
  for (let i = 0, len = parsers.length; i < len; ++i) {
2892
2893
  if (rest === '') return;
2894
+ if (context.delimiters?.match(rest, context.precedence)) break;
2893
2895
  const result = parsers[i](rest, context);
2894
2896
  if (!result) return;
2895
2897
  nodes = nodes ? (0, array_1.push)(nodes, (0, parser_1.eval)(result)) : (0, parser_1.eval)(result);
@@ -5146,13 +5148,15 @@ const inline_1 = __webpack_require__(1160);
5146
5148
 
5147
5149
  const source_1 = __webpack_require__(6743);
5148
5150
 
5151
+ const util_1 = __webpack_require__(9437);
5152
+
5149
5153
  const dom_1 = __webpack_require__(3252);
5150
5154
 
5151
5155
  const array_1 = __webpack_require__(8112);
5152
5156
 
5153
5157
  exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^\|[^\n]*(?:\n\|[^\n]*){2}/, (0, combinator_1.sequence)([row((0, combinator_1.some)(head), true), row((0, combinator_1.some)(align), false), (0, combinator_1.some)(row((0, combinator_1.some)(data), true))])), rows => [(0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift()]), (0, dom_1.html)('tbody', format(rows))])])));
5154
5158
 
5155
- const row = (parser, optional) => (0, combinator_1.creator)((0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^\|?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, source => [[(0, dom_1.html)('tr', {
5159
+ const row = (parser, optional) => (0, combinator_1.creator)((0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^[|\\]?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, source => [[(0, dom_1.html)('tr', {
5156
5160
  class: 'invalid',
5157
5161
  'data-invalid-syntax': 'table-row',
5158
5162
  'data-invalid-type': 'syntax',
@@ -5160,9 +5164,9 @@ const row = (parser, optional) => (0, combinator_1.creator)((0, combinator_1.fal
5160
5164
  }, [(0, dom_1.html)('td', source.replace('\n', ''))])], ''])));
5161
5165
 
5162
5166
  const align = (0, combinator_1.creator)((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))]));
5163
- const cell = (0, combinator_1.surround)(/^\|(?:\\?\s)*(?=\S)/, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /^(?:\\?\s)*(?=\||\\?$)/), /^[^|]*/, true);
5164
- const head = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, dom_1.defrag)(ns))]));
5165
- const data = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, dom_1.defrag)(ns))]));
5167
+ const cell = (0, combinator_1.surround)(/^\|\s*(?=\S)/, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /^\|/, [[/^[|\\]?\s*$/, 9]]), /^[^|]*/, true);
5168
+ const head = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('th', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))]));
5169
+ const data = (0, combinator_1.creator)((0, combinator_1.fmap)(cell, ns => [(0, dom_1.html)('td', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))]));
5166
5170
 
5167
5171
  function format(rows) {
5168
5172
  const aligns = rows[0].classList.contains('invalid') ? [] : (0, array_1.push)([], rows.shift().children).map(el => el.textContent);
@@ -5402,13 +5406,13 @@ const combinator_1 = __webpack_require__(2087);
5402
5406
 
5403
5407
  const inline_1 = __webpack_require__(1160);
5404
5408
 
5405
- const reference_1 = __webpack_require__(3555);
5409
+ const link_1 = __webpack_require__(9628);
5406
5410
 
5407
5411
  const util_1 = __webpack_require__(9437);
5408
5412
 
5409
5413
  const dom_1 = __webpack_require__(3252);
5410
5414
 
5411
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.validate)('((', (0, combinator_1.surround)('((', (0, combinator_1.guard)(context => context.syntax?.inline?.annotation ?? true, (0, combinator_1.context)({
5415
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.validate)('((', (0, combinator_1.surround)('((', (0, combinator_1.guard)(context => context.syntax?.inline?.annotation ?? true, (0, util_1.startLoose)((0, combinator_1.context)({
5412
5416
  syntax: {
5413
5417
  inline: {
5414
5418
  annotation: false,
@@ -5423,9 +5427,9 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0,
5423
5427
  }
5424
5428
  },
5425
5429
  delimiters: global_1.undefined
5426
- }, (0, util_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 3], ['))', 6]])))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5430
+ }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5427
5431
  class: 'annotation'
5428
- }, [(0, dom_1.html)('span', (0, util_1.trimNodeEnd)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ')' ? global_1.undefined : (0, reference_1.optimize)('((', ns, rest)))))));
5432
+ }, [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ')' ? global_1.undefined : (0, link_1.optimize)('((', ns, rest)))))));
5429
5433
 
5430
5434
  /***/ }),
5431
5435
 
@@ -5488,14 +5492,7 @@ const source_1 = __webpack_require__(6743);
5488
5492
  const dom_1 = __webpack_require__(3252); // https://example/@user must be a user page or a redirect page going there.
5489
5493
 
5490
5494
 
5491
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)])), (0, combinator_1.context)({
5492
- syntax: {
5493
- inline: {
5494
- link: true,
5495
- autolink: false
5496
- }
5497
- }
5498
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5495
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5499
5496
  class: 'account'
5500
5497
  })]));
5501
5498
 
@@ -5524,14 +5521,7 @@ const dom_1 = __webpack_require__(3252); // Timeline(pseudonym): user/tid
5524
5521
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
5525
5522
 
5526
5523
 
5527
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.focus)(/^>>(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*\/)?[0-9A-Za-z]+(?:-[0-9A-Za-z]+)*(?![0-9A-Za-z@#:])/, (0, combinator_1.context)({
5528
- syntax: {
5529
- inline: {
5530
- link: true,
5531
- autolink: false
5532
- }
5533
- }
5534
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline/')}` : `?at=${source.slice(2)}`} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5524
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('>>', (0, combinator_1.fmap)((0, combinator_1.focus)(/^>>(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*\/)?[0-9A-Za-z]+(?:-[0-9A-Za-z]+)*(?![0-9A-Za-z@#:])/, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `/@${source.slice(2).replace('/', '/timeline/')}` : `?at=${source.slice(2)}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5535
5525
  class: 'anchor'
5536
5526
  })])));
5537
5527
 
@@ -5618,14 +5608,7 @@ const source_1 = __webpack_require__(6743);
5618
5608
 
5619
5609
  const dom_1 = __webpack_require__(3252);
5620
5610
 
5621
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.context)({
5622
- syntax: {
5623
- inline: {
5624
- link: true,
5625
- autolink: false
5626
- }
5627
- }
5628
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5611
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(/^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|emoji|['_])/u.source.replace(/emoji/, hashtag_1.emoji), 'u'))), (0, combinator_1.convert)(source => `[${source}]{ ${source.slice(1)} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5629
5612
  class: 'hashnum',
5630
5613
  href: null
5631
5614
  })]));
@@ -5654,14 +5637,7 @@ const dom_1 = __webpack_require__(3252); // https://example/hashtags/a must be a
5654
5637
 
5655
5638
 
5656
5639
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
5657
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.context)({
5658
- syntax: {
5659
- inline: {
5660
- link: true,
5661
- autolink: false
5662
- }
5663
- }
5664
- }, (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.link])))), ([el]) => [(0, dom_1.define)(el, {
5640
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//), ([source]) => source.length <= 253 + 1), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/^(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|emoji))/u.source, /(?:[^\p{C}\p{S}\p{P}\s]|emoji|_(?=[^\p{C}\p{S}\p{P}\s]|emoji)){1,128}/u.source, /(?!_?(?:[^\p{C}\p{S}\p{P}\s]|emoji)|')/u.source].join('').replace(/emoji/g, exports.emoji), 'u')), ([source]) => source.length <= 128)])), (0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/hashtags/')}` : `/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.textlink]))), ([el]) => [(0, dom_1.define)(el, {
5665
5641
  class: 'hashtag'
5666
5642
  }, el.innerText)]));
5667
5643
 
@@ -5684,11 +5660,9 @@ const link_1 = __webpack_require__(9628);
5684
5660
 
5685
5661
  const source_1 = __webpack_require__(6743);
5686
5662
 
5687
- const util_1 = __webpack_require__(9437);
5688
-
5689
- const closer = /^[-+*=~^,.;:!?]*(?=["`|\[\](){}<>]|\\?$)/;
5690
- 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, util_1.clean)((0, combinator_1.union)([link_1.link]))))));
5691
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (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)]))));
5663
+ const closer = /^[-+*=~^,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
5664
+ 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.textlink])))));
5665
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((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)]))));
5692
5666
 
5693
5667
  /***/ }),
5694
5668
 
@@ -5716,11 +5690,11 @@ const dom_1 = __webpack_require__(3252);
5716
5690
  const array_1 = __webpack_require__(8112);
5717
5691
 
5718
5692
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5719
- exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(0, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5693
+ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(0, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5720
5694
  class: 'paren'
5721
- }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5695
+ }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5722
5696
  class: 'paren'
5723
- }, (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.precedence)(3, (0, combinator_1.some)(inline_1.inline, ']', [[']', 3]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, '}', [['}', 3]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5697
+ }, (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.precedence)(2, (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5724
5698
  (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])])));
5725
5699
 
5726
5700
  /***/ }),
@@ -5804,7 +5778,7 @@ const dom_1 = __webpack_require__(3252);
5804
5778
 
5805
5779
  const array_1 = __webpack_require__(8112);
5806
5780
 
5807
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
5781
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
5808
5782
 
5809
5783
  /***/ }),
5810
5784
 
@@ -5969,7 +5943,7 @@ const util_1 = __webpack_require__(9437);
5969
5943
 
5970
5944
  const dom_1 = __webpack_require__(3252);
5971
5945
 
5972
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => context.syntax?.inline?.index ?? true, (0, util_1.startTight)((0, combinator_1.context)({
5946
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => context.syntax?.inline?.index ?? true, (0, util_1.startTight)((0, combinator_1.context)({
5973
5947
  syntax: {
5974
5948
  inline: {
5975
5949
  annotation: false,
@@ -5981,7 +5955,7 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0
5981
5955
  autolink: false
5982
5956
  }
5983
5957
  }
5984
- }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 3]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
5958
+ }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
5985
5959
  id: el.id ? null : global_1.undefined,
5986
5960
  class: 'index',
5987
5961
  href: el.id ? `#${el.id}` : global_1.undefined
@@ -6182,7 +6156,7 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6182
6156
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6183
6157
 
6184
6158
 
6185
- exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 3]])), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6159
+ exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6186
6160
  class: 'invalid',
6187
6161
  'data-invalid-syntax': 'extension',
6188
6162
  'data-invalid-type': 'syntax',
@@ -6343,7 +6317,7 @@ const dom_1 = __webpack_require__(3252);
6343
6317
 
6344
6318
  const array_1 = __webpack_require__(8112);
6345
6319
 
6346
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6320
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6347
6321
 
6348
6322
  /***/ }),
6349
6323
 
@@ -6356,7 +6330,7 @@ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, c
6356
6330
  Object.defineProperty(exports, "__esModule", ({
6357
6331
  value: true
6358
6332
  }));
6359
- exports.resolve = exports.option = exports.uri = exports.link = void 0;
6333
+ exports.optimize = exports.resolve = exports.option = exports.uri = exports.textlink = exports.link = void 0;
6360
6334
 
6361
6335
  const global_1 = __webpack_require__(4128);
6362
6336
 
@@ -6382,7 +6356,7 @@ const optspec = {
6382
6356
  rel: ['nofollow']
6383
6357
  };
6384
6358
  Object.setPrototypeOf(optspec, null);
6385
- exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.guard)(context => context.syntax?.inline?.link ?? true, (0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.context)({
6359
+ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (0, combinator_1.bind)((0, combinator_1.guard)(context => context.syntax?.inline?.link ?? true, (0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.context)({
6386
6360
  syntax: {
6387
6361
  inline: {
6388
6362
  link: false
@@ -6401,15 +6375,25 @@ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'
6401
6375
  autolink: false
6402
6376
  }
6403
6377
  }
6404
- }, (0, util_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3]]))), ']', true)]))), (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) => {
6405
- content = (0, util_1.trimNodeEnd)(content);
6378
+ }, (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2]])), ']', true, global_1.undefined, ([, ns = [], rest], next) => next[0] === ']' ? global_1.undefined : optimize('[', ns, rest))]))), // 全体の失敗が確定した時も解析し予算を浪費している
6379
+ (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))]), ([as, bs = []]) => bs[0] === '\r' && bs.shift() ? [as, bs] : as[0] === '\r' && as.shift() ? [[], as] : [as, []])), ([content, params], rest, context) => {
6380
+ if (params.length === 0) return;
6381
+ if (content[0] === '') return [content, rest];
6382
+ if (content.length !== 0 && (0, util_1.trimNode)(content).length === 0) return;
6406
6383
  if ((0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context))?.some(node => typeof node === 'object')) return;
6407
6384
  const INSECURE_URI = params.shift();
6408
6385
  const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6409
6386
  if (el.classList.contains('invalid')) return [[el], rest];
6410
6387
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6411
6388
  })))));
6412
- exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
6389
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => {
6390
+ params.shift();
6391
+ (0, util_1.trimNode)(content);
6392
+ const INSECURE_URI = params.shift();
6393
+ const el = elem(INSECURE_URI, (0, dom_1.defrag)(content), new url_1.ReadonlyURL(resolve(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href), context.host?.origin || global_1.location.origin);
6394
+ return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6395
+ })))));
6396
+ exports.uri = (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]), ([uri]) => ['\r', uri]);
6413
6397
  exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\s{}]+/), opt => [` \\${opt.slice(1)}`])]);
6414
6398
 
6415
6399
  function resolve(uri, host, source) {
@@ -6486,6 +6470,19 @@ function decode(uri) {
6486
6470
  }
6487
6471
  }
6488
6472
 
6473
+ function optimize(opener, ns, rest) {
6474
+ let count = 0;
6475
+
6476
+ for (let i = 0; i < ns.length - 1; i += 2) {
6477
+ if (ns[i] !== '' || ns[i + 1] !== opener[0]) break;
6478
+ ++count;
6479
+ }
6480
+
6481
+ return [['', opener[0].repeat(opener.length + count)], rest.slice(count)];
6482
+ }
6483
+
6484
+ exports.optimize = optimize;
6485
+
6489
6486
  /***/ }),
6490
6487
 
6491
6488
  /***/ 2480:
@@ -6511,7 +6508,7 @@ const dom_1 = __webpack_require__(3252);
6511
6508
 
6512
6509
  const array_1 = __webpack_require__(8112);
6513
6510
 
6514
- exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)]))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6511
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), exports.mark)]))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]))));
6515
6512
 
6516
6513
  /***/ }),
6517
6514
 
@@ -6532,9 +6529,8 @@ const source_1 = __webpack_require__(6743);
6532
6529
 
6533
6530
  const dom_1 = __webpack_require__(3252);
6534
6531
 
6535
- const syntax = /^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/;
6536
6532
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
6537
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creator)((0, combinator_1.precedence)(7, (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', bracket, '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, source_1.str)(syntax)])), /^\$(?![0-9A-Za-z])/)]), (source, {
6533
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', (0, combinator_1.precedence)(6, bracket), '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.precedence)(3, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.focus)(/^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/, (0, combinator_1.some)(source_1.unescsource))]))), /^\$(?![0-9A-Za-z])/)]), (source, {
6538
6534
  caches: {
6539
6535
  math: cache
6540
6536
  } = {}
@@ -6548,7 +6544,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0,
6548
6544
  'data-invalid-syntax': 'math',
6549
6545
  'data-invalid-type': 'content',
6550
6546
  'data-invalid-message': `"${source.match(forbiddenCommand)[0]}" command is forbidden`
6551
- }, source)], ''])))));
6547
+ }, source)], '']))));
6552
6548
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /^(?:[{}$]|\\?\n)/)])), '}', true)));
6553
6549
 
6554
6550
  /***/ }),
@@ -6589,7 +6585,7 @@ const optspec = {
6589
6585
  rel: global_1.undefined
6590
6586
  };
6591
6587
  Object.setPrototypeOf(optspec, null);
6592
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]))), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6588
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]))), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], (0, array_1.shift)(bs)[1]] : [[''], (0, array_1.shift)(as)[1]]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6593
6589
  const INSECURE_URI = params.shift();
6594
6590
  const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href);
6595
6591
  let cache;
@@ -6608,7 +6604,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
6608
6604
  }
6609
6605
 
6610
6606
  if (context.syntax?.inline?.link === false || cache && cache.tagName !== 'IMG') return [[el], rest];
6611
- return (0, combinator_1.fmap)(link_1.link, ([link]) => [(0, dom_1.define)(link, {
6607
+ return (0, combinator_1.fmap)(link_1.textlink, ([link]) => [(0, dom_1.define)(link, {
6612
6608
  target: '_blank'
6613
6609
  }, [el])])(`{ ${INSECURE_URI}${params.join('')} }${rest}`, context);
6614
6610
  })))));
@@ -6666,7 +6662,7 @@ function sanitize(target, uri, alt) {
6666
6662
  Object.defineProperty(exports, "__esModule", ({
6667
6663
  value: true
6668
6664
  }));
6669
- exports.optimize = exports.reference = void 0;
6665
+ exports.reference = void 0;
6670
6666
 
6671
6667
  const global_1 = __webpack_require__(4128);
6672
6668
 
@@ -6674,13 +6670,15 @@ const combinator_1 = __webpack_require__(2087);
6674
6670
 
6675
6671
  const inline_1 = __webpack_require__(1160);
6676
6672
 
6673
+ const link_1 = __webpack_require__(9628);
6674
+
6677
6675
  const source_1 = __webpack_require__(6743);
6678
6676
 
6679
6677
  const util_1 = __webpack_require__(9437);
6680
6678
 
6681
6679
  const dom_1 = __webpack_require__(3252);
6682
6680
 
6683
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[[', (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => context.syntax?.inline?.reference ?? true, (0, combinator_1.context)({
6681
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[[', (0, combinator_1.creator)((0, combinator_1.recursion)((0, combinator_1.precedence)(6, (0, combinator_1.surround)('[[', (0, combinator_1.guard)(context => context.syntax?.inline?.reference ?? true, (0, util_1.startLoose)((0, combinator_1.context)({
6684
6682
  syntax: {
6685
6683
  inline: {
6686
6684
  annotation: false,
@@ -6694,7 +6692,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[['
6694
6692
  }
6695
6693
  },
6696
6694
  delimiters: global_1.undefined
6697
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]])), (0, util_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]]))]))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, util_1.trimNodeEnd)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : optimize('[[', ns, rest)))))));
6695
+ }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']')), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest)))))));
6698
6696
  const abbr = (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(util_1.regBlankStart, '')]));
6699
6697
 
6700
6698
  function attributes(ns) {
@@ -6711,19 +6709,6 @@ function attributes(ns) {
6711
6709
  };
6712
6710
  }
6713
6711
 
6714
- function optimize(opener, ns, rest) {
6715
- let count = 0;
6716
-
6717
- for (let i = 0; i < ns.length - 1; i += 2) {
6718
- if (ns[i] !== '' || ns[i + 1] !== opener[0]) break;
6719
- ++count;
6720
- }
6721
-
6722
- return [[opener[0].repeat(opener.length + count)], rest.slice(count)];
6723
- }
6724
-
6725
- exports.optimize = optimize;
6726
-
6727
6712
  /***/ }),
6728
6713
 
6729
6714
  /***/ 6705:
@@ -6896,7 +6881,7 @@ const dom_1 = __webpack_require__(3252);
6896
6881
 
6897
6882
  const array_1 = __webpack_require__(8112);
6898
6883
 
6899
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.rewrite)((0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true), source => [[(0, dom_1.html)('span', {
6884
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.rewrite)((0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true), source => [[(0, dom_1.html)('span', {
6900
6885
  class: 'template'
6901
6886
  }, source.replace(/\x1B/g, ''))], '']))));
6902
6887
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true)]));
@@ -7798,7 +7783,7 @@ exports.unescsource = (0, combinator_1.creator)(source => {
7798
7783
  Object.defineProperty(exports, "__esModule", ({
7799
7784
  value: true
7800
7785
  }));
7801
- exports.stringify = exports.trimNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = exports.clean = void 0;
7786
+ exports.stringify = exports.trimNode = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isStartTightNodes = exports.isStartLooseNodes = exports.startTight = exports.startLoose = exports.visualize = exports.blankWith = exports.regBlankStart = exports.clean = void 0;
7802
7787
 
7803
7788
  const global_1 = __webpack_require__(4128);
7804
7789
 
@@ -7993,23 +7978,32 @@ function trimBlankEnd(parser) {
7993
7978
  return (0, combinator_1.fmap)(parser, trimNodeEnd);
7994
7979
  }
7995
7980
 
7996
- exports.trimBlankEnd = trimBlankEnd; //export function trimNode(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
7997
- // return trimNodeStart(trimNodeEnd(nodes));
7998
- //}
7999
- //function trimNodeStart(nodes: (HTMLElement | string)[]): (HTMLElement | string)[] {
8000
- // for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
8001
- // if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer') break;
8002
- // if (typeof node === 'string') {
8003
- // const pos = node.length - node.trimStart().length;
8004
- // if (pos > 0) {
8005
- // nodes[0] = node.slice(pos);
8006
- // break;
8007
- // }
8008
- // }
8009
- // nodes.shift();
8010
- // }
8011
- // return nodes;
8012
- //}
7981
+ exports.trimBlankEnd = trimBlankEnd;
7982
+
7983
+ function trimNode(nodes) {
7984
+ return trimNodeStart(trimNodeEnd(nodes));
7985
+ }
7986
+
7987
+ exports.trimNode = trimNode;
7988
+
7989
+ function trimNodeStart(nodes) {
7990
+ for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
7991
+ if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer') break;
7992
+
7993
+ if (typeof node === 'string') {
7994
+ const pos = node.trimStart().length;
7995
+
7996
+ if (pos > 0) {
7997
+ nodes[0] = node.slice(-pos);
7998
+ break;
7999
+ }
8000
+ }
8001
+
8002
+ nodes.shift();
8003
+ }
8004
+
8005
+ return nodes;
8006
+ }
8013
8007
 
8014
8008
  function trimNodeEnd(nodes) {
8015
8009
  const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];
@@ -8030,8 +8024,6 @@ function trimNodeEnd(nodes) {
8030
8024
  return (0, array_1.push)(nodes, skip);
8031
8025
  }
8032
8026
 
8033
- exports.trimNodeEnd = trimNodeEnd;
8034
-
8035
8027
  function stringify(nodes) {
8036
8028
  let acc = '';
8037
8029