securemark 0.294.4 → 0.294.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/index.js +140 -89
  3. package/package.json +3 -3
  4. package/src/combinator/control/manipulation/fence.ts +2 -0
  5. package/src/combinator/control/manipulation/indent.ts +1 -1
  6. package/src/combinator/control/manipulation/match.ts +11 -8
  7. package/src/parser/api/parse.test.ts +3 -3
  8. package/src/parser/block/blockquote.test.ts +3 -9
  9. package/src/parser/block/blockquote.ts +4 -4
  10. package/src/parser/block/dlist.ts +4 -4
  11. package/src/parser/block/extension/example.ts +1 -3
  12. package/src/parser/block/extension/fig.test.ts +0 -1
  13. package/src/parser/block/extension/fig.ts +6 -6
  14. package/src/parser/block/extension/figbase.ts +1 -1
  15. package/src/parser/block/extension/figure.test.ts +1 -1
  16. package/src/parser/block/extension/figure.ts +6 -6
  17. package/src/parser/block/extension/message.ts +1 -1
  18. package/src/parser/block/extension/table.ts +4 -4
  19. package/src/parser/block/heading.ts +4 -4
  20. package/src/parser/block/reply/cite.ts +1 -1
  21. package/src/parser/block/reply/quote.ts +2 -2
  22. package/src/parser/block/sidefence.test.ts +1 -3
  23. package/src/parser/block/sidefence.ts +4 -4
  24. package/src/parser/block/table.ts +2 -2
  25. package/src/parser/block.ts +1 -1
  26. package/src/parser/header.ts +3 -3
  27. package/src/parser/inline/autolink/account.ts +5 -7
  28. package/src/parser/inline/autolink/channel.ts +15 -15
  29. package/src/parser/inline/autolink/hashtag.ts +10 -8
  30. package/src/parser/inline/code.ts +12 -18
  31. package/src/parser/inline/deletion.ts +3 -3
  32. package/src/parser/inline/emstrong.ts +3 -3
  33. package/src/parser/inline/extension/indexer.ts +1 -1
  34. package/src/parser/inline/html.ts +1 -1
  35. package/src/parser/inline/insertion.ts +3 -3
  36. package/src/parser/inline/italic.ts +3 -3
  37. package/src/parser/inline/link.ts +3 -3
  38. package/src/parser/inline/mark.ts +3 -3
  39. package/src/parser/inline/remark.ts +3 -3
  40. package/src/parser/inline.ts +2 -0
  41. package/src/parser/source/text.ts +8 -4
  42. package/src/parser/util.ts +1 -1
  43. package/src/parser/visibility.ts +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.294.4 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.294.5 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("Prism"), require("DOMPurify"));
@@ -844,7 +844,7 @@ class List {
844
844
  if (list.length === 0) return this;
845
845
  if (this.length === 0) {
846
846
  this.head = list.head;
847
- this.length += list.length;
847
+ this.length = list.length;
848
848
  list.head = undefined;
849
849
  list.length = 0;
850
850
  return this;
@@ -993,20 +993,19 @@ class List {
993
993
  if (list.length === 0) return this;
994
994
  if (this.length === 0) {
995
995
  this.head = list.head;
996
- this.length += list.length;
997
- list.head = undefined;
998
- list.length = 0;
996
+ this.last = list.last;
997
+ this.length = list.length;
998
+ list.clear();
999
999
  return this;
1000
1000
  }
1001
1001
  const head = list.head;
1002
1002
  const last = list.last;
1003
- const next = last.next = before ?? this.head;
1004
- const prev = head.prev = next.prev;
1005
- next.prev = last;
1003
+ const next = last.next = before;
1004
+ const prev = head.prev = before?.prev ?? this.last;
1005
+ next === undefined ? this.last = last : next.prev = last;
1006
1006
  prev.next = head;
1007
1007
  this.length += list.length;
1008
- list.length = 0;
1009
- list.head = undefined;
1008
+ list.clear();
1010
1009
  return this;
1011
1010
  }
1012
1011
  clear() {
@@ -1038,7 +1037,7 @@ class List {
1038
1037
  return acc;
1039
1038
  }
1040
1039
  foldr(f, acc) {
1041
- for (let node = this.head?.prev; node && this.head;) {
1040
+ for (let node = this.last; node && this.head;) {
1042
1041
  const prev = node.prev;
1043
1042
  acc = f(node, acc);
1044
1043
  node = prev;
@@ -1078,17 +1077,18 @@ Object.defineProperty(exports, "__esModule", ({
1078
1077
  exports.reduce = exports.memoize = void 0;
1079
1078
  const alias_1 = __webpack_require__(5413);
1080
1079
  const compare_1 = __webpack_require__(1934);
1081
- function memoize(f, identify, memory) {
1080
+ function memoize(f, identify, memory, mask) {
1082
1081
  if (typeof identify === 'object') {
1082
+ mask = memory;
1083
1083
  memory = identify;
1084
1084
  identify = undefined;
1085
1085
  }
1086
1086
  identify ??= (...as) => as[0];
1087
1087
  switch (true) {
1088
1088
  case (0, alias_1.isArray)(memory):
1089
- return memoizeArray(f, identify, memory);
1089
+ return mask === undefined ? memoizeArray(f, identify, memory) : cacheArray(f, identify, memory, mask);
1090
1090
  case memory?.constructor === Object:
1091
- return memoizeObject(f, identify, memory);
1091
+ return mask === undefined ? memoizeObject(f, identify, memory) : cacheObject(f, identify, memory, mask);
1092
1092
  default:
1093
1093
  return memoizeDict(f, identify, memory ?? new Map());
1094
1094
  }
@@ -1097,7 +1097,6 @@ exports.memoize = memoize;
1097
1097
  function memoizeArray(f, identify, memory) {
1098
1098
  return (...as) => {
1099
1099
  const b = identify(...as);
1100
- if (!(b >= 0)) return f(...as);
1101
1100
  let z = memory[b];
1102
1101
  if (z !== undefined) return z;
1103
1102
  z = f(...as);
@@ -1105,11 +1104,33 @@ function memoizeArray(f, identify, memory) {
1105
1104
  return z;
1106
1105
  };
1107
1106
  }
1107
+ function cacheArray(f, identify, memory, mask) {
1108
+ const mask1 = mask >>>= 1;
1109
+ const mask2 = mask;
1110
+ const mem1 = memory;
1111
+ const mem2 = [];
1112
+ return (...as) => {
1113
+ const b = identify(...as);
1114
+ if (b <= mask1) {
1115
+ let z = mem1[b];
1116
+ if (z !== undefined) return z;
1117
+ z = f(...as);
1118
+ mem1[b] = z;
1119
+ return z;
1120
+ } else {
1121
+ const i = b & mask2;
1122
+ const t = mem2[i];
1123
+ if (t && t[0] === b) return t[1];
1124
+ const z = f(...as);
1125
+ mem2[i] = [b, z];
1126
+ return z;
1127
+ }
1128
+ };
1129
+ }
1108
1130
  function memoizeObject(f, identify, memory) {
1109
1131
  let nullable = false;
1110
1132
  return (...as) => {
1111
1133
  const b = identify(...as);
1112
- if (!(b >= 0)) return f(...as);
1113
1134
  let z = memory[b];
1114
1135
  if (z !== undefined || nullable && b in memory) return z;
1115
1136
  z = f(...as);
@@ -1118,6 +1139,31 @@ function memoizeObject(f, identify, memory) {
1118
1139
  return z;
1119
1140
  };
1120
1141
  }
1142
+ function cacheObject(f, identify, memory, mask) {
1143
+ const mask1 = mask >>>= 1;
1144
+ const mask2 = mask;
1145
+ const mem1 = memory;
1146
+ const mem2 = {};
1147
+ let nullable = false;
1148
+ return (...as) => {
1149
+ const b = identify(...as);
1150
+ if (b <= mask1) {
1151
+ let z = mem1[b];
1152
+ if (z !== undefined || nullable && b in mem1) return z;
1153
+ z = f(...as);
1154
+ nullable ||= z === undefined;
1155
+ mem1[b] = z;
1156
+ return z;
1157
+ } else {
1158
+ const i = b & mask2;
1159
+ const t = mem2[i];
1160
+ if (t && t[0] === b) return t[1];
1161
+ const z = f(...as);
1162
+ mem2[i] = [b, z];
1163
+ return z;
1164
+ }
1165
+ };
1166
+ }
1121
1167
  function memoizeDict(f, identify, memory) {
1122
1168
  let nullable = false;
1123
1169
  return (...as) => {
@@ -2758,6 +2804,7 @@ Object.defineProperty(exports, "__esModule", ({
2758
2804
  }));
2759
2805
  exports.fence = void 0;
2760
2806
  const parser_1 = __webpack_require__(605);
2807
+ const combinator_1 = __webpack_require__(3484);
2761
2808
  const line_1 = __webpack_require__(8287);
2762
2809
  const array_1 = __webpack_require__(6876);
2763
2810
  function fence(opener, limit, separation = true) {
@@ -2773,6 +2820,7 @@ function fence(opener, limit, separation = true) {
2773
2820
  opener.lastIndex = position;
2774
2821
  const matches = opener.exec(source);
2775
2822
  if (!matches) return;
2823
+ (0, combinator_1.consume)(matches[0].length, context);
2776
2824
  const delim = matches[1];
2777
2825
  if (matches[0].includes(delim, delim.length)) return;
2778
2826
  context.position += matches[0].length;
@@ -2846,7 +2894,7 @@ function indent(opener, parser = false, separation = false) {
2846
2894
  } = context;
2847
2895
  context.position = source.length;
2848
2896
  return new parser_1.List([new parser_1.Data(source.slice(position))]);
2849
- }))), ([indent]) => indent.length <= 16 ? indent.length * 2 + +(indent[0] === ' ') : -1, [])), separation), (lines, context) => {
2897
+ }))), ([indent]) => indent.length * 2 + -(indent[0] === ' '), [], 2 ** 4 - 1)), separation), (lines, context) => {
2850
2898
  return parser((0, parser_1.subinput)(trimBlockEnd(lines.foldl((acc, node) => acc + node.value, '')), context));
2851
2899
  }));
2852
2900
  }
@@ -2887,7 +2935,8 @@ Object.defineProperty(exports, "__esModule", ({
2887
2935
  exports.match = void 0;
2888
2936
  const parser_1 = __webpack_require__(605);
2889
2937
  const combinator_1 = __webpack_require__(3484);
2890
- function match(pattern, f, cost = false) {
2938
+ function match(pattern, f) {
2939
+ const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
2891
2940
  return (0, parser_1.failsafe)(input => {
2892
2941
  const {
2893
2942
  context
@@ -2898,11 +2947,11 @@ function match(pattern, f, cost = false) {
2898
2947
  } = context;
2899
2948
  if (position === source.length) return;
2900
2949
  pattern.lastIndex = position;
2901
- const param = pattern.exec(source);
2902
- if (!param) return;
2903
- cost && (0, combinator_1.consume)(param[0].length, context);
2904
- const result = f(param)(input);
2905
- context.position += result && context.position === position ? param[0].length : 0;
2950
+ const params = pattern.exec(source);
2951
+ if (!params) return;
2952
+ count && (0, combinator_1.consume)(params[0].length, context);
2953
+ const result = f(params)(input);
2954
+ context.position += result && context.position === position ? params[0].length : 0;
2906
2955
  return context.position > position ? result : undefined;
2907
2956
  });
2908
2957
  }
@@ -4559,7 +4608,7 @@ exports.block = (0, combinator_1.reset)({
4559
4608
  }
4560
4609
  }, paragraph_1.paragraph])));
4561
4610
  function error(parser) {
4562
- const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}.*\n`);
4611
+ const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}[^\n]*\n`);
4563
4612
  return (0, combinator_1.recover)((0, combinator_1.fallback)((0, combinator_1.open)("\u0007" /* Command.Error */, ({
4564
4613
  context: {
4565
4614
  source,
@@ -4601,11 +4650,11 @@ const source_1 = __webpack_require__(8745);
4601
4650
  const util_1 = __webpack_require__(4992);
4602
4651
  const parse_1 = __webpack_require__(3662);
4603
4652
  const dom_1 = __webpack_require__(394);
4604
- exports.segment = (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(/!?>+(?=[^\S\n]|\n[^\S\n]*\S)/y, (0, combinator_1.some)(source_1.contentline))]));
4653
+ exports.segment = (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(/!?>+ /y, (0, combinator_1.some)(source_1.contentline))]));
4605
4654
  exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.union)([(0, combinator_1.open)(/(?=>)/y, source), (0, combinator_1.open)(/!(?=>)/y, markdown)]))));
4606
- const opener = /(?=>>+(?:$|\s))/y;
4607
- const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|\s)/y)), false);
4608
- const unindent = source => source.replace(/(?<=^|\n)>(?:[^\S\n]|(?=>*(?:$|\s)))|\n$/g, '');
4655
+ const opener = /(?=>>+(?:$|[ \n]))/y;
4656
+ const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y)), false);
4657
+ const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
4609
4658
  const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4610
4659
  const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.union)([(0, combinator_1.rewrite)(indent, (0, combinator_1.convert)(unindent, markdown, false, true)), (0, combinator_1.creation)(10, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
4611
4660
  context
@@ -4705,11 +4754,11 @@ const source_1 = __webpack_require__(8745);
4705
4754
  const visibility_1 = __webpack_require__(6364);
4706
4755
  const util_1 = __webpack_require__(4992);
4707
4756
  const dom_1 = __webpack_require__(394);
4708
- exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~[^\S\n]+(?=\S)/y, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dl', (0, util_1.unwrap)(fillTrailingDescription(ns))))]))));
4709
- const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~[^\S\n]+(?=\S)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dt', {
4757
+ exports.dlist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/~ +(?=\S)/y, (0, combinator_1.some)((0, combinator_1.inits)([(0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.some)(term)), (0, combinator_1.some)(desc)]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dl', (0, util_1.unwrap)(fillTrailingDescription(ns))))]))));
4758
+ const term = (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/~ +(?=\S)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dt', {
4710
4759
  'data-index': (0, inline_1.dataindex)(ns)
4711
4760
  }, (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]))));
4712
- const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/:[^\S\n]+(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:][^\S\n]+\S/y), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dd', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
4761
+ const desc = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/: +(?=\S)|/y, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /[~:] +(?=\S)/y), (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('dd', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
4713
4762
  function fillTrailingDescription(nodes) {
4714
4763
  return nodes.last?.value.tagName === 'DT' ? nodes.push(new parser_1.Data((0, dom_1.html)('dd'))) && nodes : nodes;
4715
4764
  }
@@ -4804,8 +4853,7 @@ const mathblock_1 = __webpack_require__(4903);
4804
4853
  const util_1 = __webpack_require__(4992);
4805
4854
  const parse_1 = __webpack_require__(3662);
4806
4855
  const dom_1 = __webpack_require__(394);
4807
- const opener = /(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y;
4808
- exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
4856
+ exports.example = (0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y, 300),
4809
4857
  // Bug: Type mismatch between outer and inner.
4810
4858
  (nodes, context) => {
4811
4859
  const [body, overflow, closer, opener, delim, type = 'markdown', param] = (0, util_1.unwrap)(nodes);
@@ -4871,17 +4919,17 @@ const table_1 = __webpack_require__(3646);
4871
4919
  const blockquote_1 = __webpack_require__(5885);
4872
4920
  const placeholder_1 = __webpack_require__(4091);
4873
4921
  const inline_1 = __webpack_require__(7973);
4874
- exports.segment = (0, combinator_1.block)((0, combinator_1.validate)(/\[?\$/y, (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?=\s).*\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])])));
4922
+ exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]));
4875
4923
  exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
4876
4924
  // Bug: TypeScript
4877
- const fence = (/^[^\n]*\n!?>+\s/.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
4925
+ const fence = (/^[^\n]*\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
4878
4926
  return parser({
4879
4927
  context
4880
4928
  }) ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
4881
4929
  }, (0, combinator_1.union)([figure_1.figure]), false), ([{
4882
4930
  value: el
4883
4931
  }]) => el.tagName === 'FIGURE')));
4884
- const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?=\s).*\n/y)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)(source_1.contentline)]);
4932
+ const parser = (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\n/y)), (0, combinator_1.line)((0, combinator_1.union)([inline_1.media, inline_1.lineshortmedia])), (0, combinator_1.some)(source_1.contentline)]);
4885
4933
 
4886
4934
  /***/ },
4887
4935
 
@@ -4899,7 +4947,7 @@ const parser_1 = __webpack_require__(605);
4899
4947
  const combinator_1 = __webpack_require__(3484);
4900
4948
  const label_1 = __webpack_require__(2178);
4901
4949
  const dom_1 = __webpack_require__(394);
4902
- exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?[^\S\n]*(?!\S|\n[^\S\n]*\S)/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([{
4950
+ exports.figbase = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\[?\$-(?:[0-9]+\.)*0\]?(?:$|[ \n])/y, (0, combinator_1.line)((0, combinator_1.union)([label_1.label]))), ([{
4903
4951
  value: el
4904
4952
  }]) => {
4905
4953
  const label = el.getAttribute('data-label');
@@ -4941,19 +4989,19 @@ const visibility_1 = __webpack_require__(6364);
4941
4989
  const util_1 = __webpack_require__(4992);
4942
4990
  const memoize_1 = __webpack_require__(6925);
4943
4991
  const dom_1 = __webpack_require__(394);
4944
- exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure[^\S\n])?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\n]*(?:$|\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
4992
+ exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure )?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\n]*(?:$|\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
4945
4993
  // All parsers which can include closing terms.
4946
- (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length <= 16 ? fence.length : -1, [])));
4947
- exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?=\s).*\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])]), false), nodes => {
4994
+ (0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length - 1, [], 2 ** 4 - 1)));
4995
+ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?!\S).*\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])]), false), nodes => {
4948
4996
  const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
4949
4997
  return new parser_1.List([new parser_1.Data((0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [(0, dom_1.html)('figcaption', [(0, dom_1.html)('span', {
4950
4998
  class: 'figindex'
4951
4999
  }), (0, dom_1.html)('span', {
4952
5000
  class: 'figtext'
4953
5001
  }, (0, dom_1.defrag)(caption))]), (0, dom_1.html)('div', [content])]))]);
4954
- })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
5002
+ })), (0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})(?:figure(?=$|[ \n])|\[?\$)[^\n]*(?:$|\n)/y, 300), (nodes, context) => {
4955
5003
  const [body, overflow, closer, opener, delim] = (0, util_1.unwrap)(nodes);
4956
- const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
5004
+ const violation = !closer && ['fence', `Missing the closing delimiter "${delim}"`] || overflow && ['fence', `Invalid trailing line after the closing delimiter "${delim}"`] || !(0, label_1.segment)((0, parser_1.subinput)(opener.match(/^~+(?:figure )?(\[?\$\S+)/)?.[1] ?? '', context)) && ['label', 'Invalid label'] || /^~+(?:figure )?(\[?\$\S+)[^\S\n]+\S/.test(opener) && ['argument', 'Invalid argument'] || ['content', 'Invalid content'];
4957
5005
  return new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', {
4958
5006
  class: 'invalid',
4959
5007
  translate: 'no',
@@ -5027,7 +5075,7 @@ const paragraph_1 = __webpack_require__(4330);
5027
5075
  const util_1 = __webpack_require__(4992);
5028
5076
  const array_1 = __webpack_require__(6876);
5029
5077
  const dom_1 = __webpack_require__(394);
5030
- exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/y, 300),
5078
+ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(/(~{3,})message\/(\S+)(?!\S)([^\n]*)(?:$|\n)/y, 300),
5031
5079
  // Bug: Type mismatch between outer and inner.
5032
5080
  (nodes, context) => {
5033
5081
  const [body, overflow, closer, opener, delim, type, param] = (0, util_1.unwrap)(nodes);
@@ -5149,10 +5197,10 @@ const alignment = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/y;
5149
5197
  const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([{
5150
5198
  value
5151
5199
  }]) => new parser_1.List([new parser_1.Data(value.split('/').map(s => s.split('')))])));
5152
- const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y;
5153
- const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5154
- const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=\s)/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5155
- const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/!+\s/y, (0, combinator_1.convert)(source => `:${source}`, data, false)), (0, combinator_1.convert)(source => `: ${source}`, data, false)])));
5200
+ const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y;
5201
+ const head = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/#(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('th', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5202
+ const data = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/:(?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y), (0, combinator_1.rewrite)((0, combinator_1.inits)([source_1.anyline, (0, combinator_1.some)(source_1.contentline, delimiter)]), (0, combinator_1.union)([(0, combinator_1.block)((0, combinator_1.surround)(/\s/y, (0, combinator_1.union)([inline_1.medialink, inline_1.media, inline_1.lineshortmedia]), /[^\S\n]*(?:$|\n)/y)), (0, combinator_1.open)(/(?:[^\S\n]*\n|\s)/y, (0, visibility_1.visualize)((0, visibility_1.trimBlankEnd)((0, combinator_1.some)(inline_1.inline))), true)])), true), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', attributes(ns.shift().value), (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false);
5203
+ const dataline = (0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([(0, combinator_1.validate)(/!+ /y, (0, combinator_1.convert)(source => `:${source}`, data, false)), (0, combinator_1.convert)(source => `: ${source}`, data, false)])));
5156
5204
  function attributes(source) {
5157
5205
  let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
5158
5206
  rowspan === '1' ? rowspan = undefined : undefined;
@@ -5372,11 +5420,11 @@ const source_1 = __webpack_require__(8745);
5372
5420
  const visibility_1 = __webpack_require__(6364);
5373
5421
  const util_1 = __webpack_require__(4992);
5374
5422
  const dom_1 = __webpack_require__(394);
5375
- exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('#', (0, combinator_1.focus)(/#+[^\S\n]+\S[^\n]*(?:\n#+(?!\S)[^\n]*)*(?:$|\n)/y, (0, combinator_1.some)((0, combinator_1.line)(({
5423
+ exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(?:\n#+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, (0, combinator_1.some)((0, combinator_1.line)(({
5376
5424
  context: {
5377
5425
  source
5378
5426
  }
5379
- }) => new parser_1.List([new parser_1.Data(source)]))))));
5427
+ }) => new parser_1.List([new parser_1.Data(source)])))));
5380
5428
  exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
5381
5429
  // その他の表示制御は各所のCSSで行う。
5382
5430
  (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 32 /* State.index */ | 16 /* State.label */ | 8 /* State.link */, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.open)((0, source_1.str)(/##+/y), (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline])))), true), (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)((0, combinator_1.union)([inline_1.indexer, inline_1.inline]))))), true)]), (nodes, context) => {
@@ -5722,7 +5770,7 @@ exports.cite = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.op
5722
5770
  class: 'anchor',
5723
5771
  href: source.slice(2).trimEnd(),
5724
5772
  target: '_blank'
5725
- }, source))])), (0, combinator_1.focus)(/>>.+(?=\s*$)/y, ({
5773
+ }, source))])), (0, combinator_1.focus)(/>>\S+(?=\s*$)/y, ({
5726
5774
  context: {
5727
5775
  source
5728
5776
  }
@@ -5758,10 +5806,10 @@ const autolink_1 = __webpack_require__(8072);
5758
5806
  const source_1 = __webpack_require__(8745);
5759
5807
  const util_1 = __webpack_require__(4992);
5760
5808
  const dom_1 = __webpack_require__(394);
5761
- exports.syntax = />+[^\S\n]/y;
5809
+ exports.syntax = />+ /y;
5762
5810
  exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)((0, combinator_1.validate)(exports.syntax, source_1.anyline)), (0, combinator_1.convert)(
5763
5811
  // TODO: インデント数を渡してインデント数前の行頭確認を行う実装に置き換える
5764
- source => source.replace(/(?<=^>+[^\S\n])/mg, '\r'), (0, combinator_1.some)((0, combinator_1.union)([
5812
+ source => source.replace(/(?<=^>+ )/mg, '\r'), (0, combinator_1.some)((0, combinator_1.union)([
5765
5813
  // quote補助関数が残した数式をパースする。
5766
5814
  math_1.math, autolink_1.autolink, source_1.linebreak, source_1.unescsource])), false)), (ns, {
5767
5815
  source,
@@ -5788,15 +5836,15 @@ const autolink_1 = __webpack_require__(1671);
5788
5836
  const source_1 = __webpack_require__(8745);
5789
5837
  const util_1 = __webpack_require__(4992);
5790
5838
  const dom_1 = __webpack_require__(394);
5791
- exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/(?=\|+(?:[^\S\n]|\n\|))(?:\|+(?:[^\S\n][^\n]*)?(?:$|\n))+$/y, (0, combinator_1.union)([source])), ([{
5839
+ exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.focus)(/\|+ [^\n]*(?:\n\|+(?=$|[ \n])[^\n]*)*(?:$|\n)/y, (0, combinator_1.union)([source])), ([{
5792
5840
  value
5793
5841
  }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
5794
5842
  class: 'invalid',
5795
5843
  ...(0, util_1.invalid)('sidefence', 'syntax', 'Reserved syntax')
5796
5844
  }))]))));
5797
- const opener = /(?=\|\|+(?:$|\s))/y;
5798
- const unindent = source => source.replace(/(?<=^|\n)\|(?:[^\S\n]|(?=\|*(?:$|\s)))|\n$/g, '');
5799
- const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?:[^\S\n][^\n]*)?(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5845
+ const opener = /(?=\|\|+(?:$|[ \n]))/y;
5846
+ const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \n])))|\n$/g, '');
5847
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.union)([(0, combinator_1.focus)(/(?:\|\|+(?=$|[ \n])[^\n]*(?:$|\n))+/y, (0, combinator_1.convert)(unindent, source, false, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, (0, combinator_1.fmap)(autolink_1.autolink, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5800
5848
 
5801
5849
  /***/ },
5802
5850
 
@@ -5820,7 +5868,7 @@ const duff_1 = __webpack_require__(9202);
5820
5868
  const array_1 = __webpack_require__(6876);
5821
5869
  const dom_1 = __webpack_require__(394);
5822
5870
  exports.table = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/\|[^\n]*(?:\n\|[^\n]*){2}/y, (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 => new parser_1.List([new parser_1.Data((0, dom_1.html)('table', [(0, dom_1.html)('thead', [rows.shift().value]), (0, dom_1.html)('tbody', (0, util_1.unwrap)(format(rows)))]))]))));
5823
- const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /[|\\]?\s*$/y, optional)), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('tr', (0, util_1.unwrap)(ns)))])), (0, combinator_1.rewrite)(source_1.contentline, ({
5871
+ const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/(?=\|)/y, (0, combinator_1.some)((0, combinator_1.union)([parser])), /\|?\s*$/y, optional)), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('tr', (0, util_1.unwrap)(ns)))])), (0, combinator_1.rewrite)(source_1.contentline, ({
5824
5872
  context: {
5825
5873
  source
5826
5874
  }
@@ -5837,7 +5885,7 @@ const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_
5837
5885
  source
5838
5886
  }
5839
5887
  }) => new parser_1.List([new parser_1.Data(source.at(-1) === ':' ? 'end' : '')]))])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5840
- const cell = (0, combinator_1.surround)(/\|\s*(?=\S)/y, (0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.media, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.shortmedia, /\s*(?=\||$)/y), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /\|/y, [[/[|\\]?\s*$/y, 9]]))]), /[^|]*/y, true);
5888
+ const cell = (0, combinator_1.surround)(/\|\s*(?=\S)/y, (0, combinator_1.union)([(0, combinator_1.close)(inline_1.medialink, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.media, /\s*(?=\||$)/y), (0, combinator_1.close)(inline_1.shortmedia, /\s*(?=\||$)/y), (0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline, /\|/y, [[/\|?\s*$/y, 9]]))]), /[^|]*/y, true);
5841
5889
  const head = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('th', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5842
5890
  const data = (0, combinator_1.fmap)(cell, ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5843
5891
  function format(rows) {
@@ -5924,7 +5972,7 @@ const source_1 = __webpack_require__(8745);
5924
5972
  const util_1 = __webpack_require__(4992);
5925
5973
  const normalize_1 = __webpack_require__(4490);
5926
5974
  const dom_1 = __webpack_require__(394);
5927
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\v\f\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.rewrite)(({
5975
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.rewrite)(({
5928
5976
  context
5929
5977
  }) => {
5930
5978
  const {
@@ -5938,7 +5986,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
5938
5986
  return new parser_1.List();
5939
5987
  }, (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
5940
5988
  context
5941
- }) => context.header ?? true, (0, combinator_1.focus)(/(---+)[^\S\v\f\r\n]*\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[A-Za-z][0-9A-Za-z]*)*:[ \t]+\S[^\v\f\r\n]*\r?\n){1,100}\1[^\S\v\f\r\n]*(?:$|\r?\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
5989
+ }) => context.header ?? true, (0, combinator_1.focus)(/(---+) *\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1 *(?:$|\r?\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))).replace(/(\S)\s+$/mg, '$1'), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
5942
5990
  class: 'header'
5943
5991
  }, [(0, dom_1.html)('details', {
5944
5992
  open: ''
@@ -5955,7 +6003,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
5955
6003
  translate: 'no',
5956
6004
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
5957
6005
  }, (0, normalize_1.normalize)(source.slice(position))))]);
5958
- }]))), (0, combinator_1.clear)((0, source_1.str)(/[^\S\v\f\r\n]*\r?\n/y))])));
6006
+ }]))), (0, combinator_1.clear)((0, source_1.str)(/ *\r?\n/y))])));
5959
6007
  const field = (0, combinator_1.line)(({
5960
6008
  context: {
5961
6009
  source,
@@ -6027,13 +6075,13 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6027
6075
  case '[':
6028
6076
  return (0, reference_1.reference)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
6029
6077
  case '%':
6030
- return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
6078
+ return (0, remark_1.remark)(input) || (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input) || (0, bracket_1.bracket)(input);
6031
6079
  case '#':
6032
6080
  case '$':
6033
6081
  case ':':
6034
6082
  case '^':
6035
6083
  case '|':
6036
- return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, bracket_1.bracket)(input);
6084
+ return (0, extension_1.extension)(input) || (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input) || (0, bracket_1.bracket)(input);
6037
6085
  }
6038
6086
  return (0, link_1.textlink)(input) || (0, ruby_1.ruby)(input) || (0, bracket_1.bracket)(input);
6039
6087
  case '{':
@@ -6189,7 +6237,7 @@ const link_1 = __webpack_require__(3628);
6189
6237
  const source_1 = __webpack_require__(8745);
6190
6238
  const dom_1 = __webpack_require__(394);
6191
6239
  // https://example/@user must be a user page or a redirect page going there.
6192
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@#]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6240
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@#]|>>|:\S)/yi), true, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1).replace('/', '/@')}` : `/${source}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6193
6241
  value
6194
6242
  }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6195
6243
  class: 'account'
@@ -6244,9 +6292,9 @@ const hashtag_1 = __webpack_require__(5764);
6244
6292
  const source_1 = __webpack_require__(8745);
6245
6293
  const dom_1 = __webpack_require__(394);
6246
6294
  // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
6247
- exports.channel = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.sequence)([(0, combinator_1.open)(/(?<![0-9a-z])@/yi, (0, combinator_1.tails)([(0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi)]), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.open)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), ([{
6295
+ exports.channel = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.sequence)([(0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?(?:\.[0-9a-z](?:(?:[0-9a-z]|-(?=[0-9a-z])){0,61}[0-9a-z])?)*\//yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), true, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.verify)((0, combinator_1.surround)('#', (0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), (0, source_1.str)(new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, hashtag_1.emoji), 'yu')), false, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), ([{
6248
6296
  value
6249
- }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)), false, [3 | 0 /* Backtrack.autolink */]))]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1, source.indexOf('#')).replace('/', '/@')}` : `/${source.slice(0, source.indexOf('#'))}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6297
+ }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)))]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${source.includes('/') ? `https://${source.slice(1, source.indexOf('#')).replace('/', '/@')}` : `/${source.slice(0, source.indexOf('#'))}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6250
6298
  value: el
6251
6299
  }], {
6252
6300
  source,
@@ -6334,9 +6382,9 @@ const dom_1 = __webpack_require__(394);
6334
6382
  // https://example/hashtags/a must be a hashtag page or a redirect page going there.
6335
6383
  // https://github.com/tc39/proposal-regexp-unicode-property-escapes#matching-emoji
6336
6384
  exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
6337
- exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, exports.emoji), 'yu'), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^'\p{C}\p{S}\p{P}\s]|emoji))+(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, exports.emoji), 'yu')), ([{
6385
+ exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.verify)((0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yiu.source].join('').replace(/emoji/g, exports.emoji), 'yu'), (0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('').replace(/emoji/g, exports.emoji), 'yu')), (0, source_1.str)(new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('').replace(/emoji/g, exports.emoji), 'yu')), false, undefined, undefined, [3 | 0 /* Backtrack.autolink */]), ([{
6338
6386
  value
6339
- }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6387
+ }]) => !/^[0-9]{1,4}$|^[0-9]{5}/.test(value)), (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.fmap)((0, combinator_1.convert)(source => `[${source}]{ ${`/hashtags/${source.slice(1)}`} }`, (0, combinator_1.union)([link_1.unsafelink]), false), ([{
6340
6388
  value
6341
6389
  }]) => new parser_1.List([new parser_1.Data((0, dom_1.define)(value, {
6342
6390
  class: 'hashtag'
@@ -6476,12 +6524,12 @@ const parser_1 = __webpack_require__(605);
6476
6524
  const combinator_1 = __webpack_require__(3484);
6477
6525
  const util_1 = __webpack_require__(4992);
6478
6526
  const dom_1 = __webpack_require__(394);
6479
- exports.code = (0, combinator_1.open)(/(?=`)/y, (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
6527
+ exports.code = (0, combinator_1.match)(/(`+)(?!`)([^\n]*?)(?:((?<!`)\1(?!`))|(?=$|\n))/y, ([whole, opener, body, closer]) => () => closer ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
6480
6528
  'data-src': whole
6481
6529
  }, format(body)))]) : body ? new parser_1.List([new parser_1.Data((0, dom_1.html)('code', {
6482
6530
  class: 'invalid',
6483
6531
  ...(0, util_1.invalid)('code', 'syntax', `Missing the closing symbol "${opener}"`)
6484
- }, whole))]) : new parser_1.List([new parser_1.Data(opener)]), true), false, [3 | 64 /* Backtrack.bracket */]);
6532
+ }, whole))]) : new parser_1.List([new parser_1.Data(opener)]));
6485
6533
  function format(text) {
6486
6534
  return text.length > 2 && text[0] === ' ' && text[1] === '`' && text.at(-1) === ' ' ? text.slice(1, -1) : text;
6487
6535
  }
@@ -6504,11 +6552,11 @@ const inline_1 = __webpack_require__(7973);
6504
6552
  const visibility_1 = __webpack_require__(6364);
6505
6553
  const util_1 = __webpack_require__(4992);
6506
6554
  const dom_1 = __webpack_require__(394);
6507
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('~~', (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), '~~', false, ([, bs], {
6555
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)]))), '~~', false, ([, bs], {
6508
6556
  buffer
6509
6557
  }) => buffer.import(bs), ([, bs], {
6510
6558
  buffer
6511
- }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
6559
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
6512
6560
 
6513
6561
  /***/ },
6514
6562
 
@@ -6558,7 +6606,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
6558
6606
  // 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
6559
6607
  // 可能な限り早く閉じるよう解析しなければならない。
6560
6608
  // このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
6561
- exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('***', (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/\*{1,3}/y), false, ([, bs, cs], context) => {
6609
+ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('*')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)])))), (0, source_1.str)(/\*{1,3}/y), false, ([, bs, cs], context) => {
6562
6610
  const {
6563
6611
  buffer = new parser_1.List()
6564
6612
  } = context;
@@ -6665,7 +6713,7 @@ nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('em', [(0, dom_1.h
6665
6713
  nodes = prepend('*'.repeat(prefix - postfix), nodes);
6666
6714
  }
6667
6715
  return nodes;
6668
- }))));
6716
+ })));
6669
6717
  function prepend(prefix, nodes) {
6670
6718
  if (typeof nodes.head?.value === 'string') {
6671
6719
  nodes.head.value = prefix + nodes.head.value;
@@ -6911,7 +6959,7 @@ const dom_1 = __webpack_require__(394);
6911
6959
  // 複合生成インデクスを手動で同期させるより最初から重複のない
6912
6960
  // テキストまたはインデクスを付けて同期が必要な機会を減らすのが
6913
6961
  // 継続的編集において最も簡便となる。
6914
- exports.indexer = (0, combinator_1.surround)(/\s\[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6962
+ exports.indexer = (0, combinator_1.surround)(/ \[(?=\|\S)/y, (0, combinator_1.union)([index_1.signature, (0, combinator_1.focus)(/\|(?=\])/y, () => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
6915
6963
  class: 'indexer',
6916
6964
  'data-index': ''
6917
6965
  }))]))]), /\]\s*$/y);
@@ -7017,7 +7065,7 @@ Object.setPrototypeOf(attrspecs, null);
7017
7065
  Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
7018
7066
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/<[a-z]+(?=[ >])/yi, (0, combinator_1.union)([(0, combinator_1.surround)(
7019
7067
  // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
7020
- (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[^\S\n]|>)`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
7068
+ (0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/yi), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Data(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[ >])`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
7021
7069
  // 不可視のHTML構造が可視構造を変化させるべきでない。
7022
7070
  // 可視のHTMLは優先度変更を検討する。
7023
7071
  // このため<>は将来的に共通構造を変化させる可能性があり
@@ -7136,11 +7184,11 @@ const inline_1 = __webpack_require__(7973);
7136
7184
  const visibility_1 = __webpack_require__(6364);
7137
7185
  const util_1 = __webpack_require__(4992);
7138
7186
  const dom_1 = __webpack_require__(394);
7139
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('++', (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), '++', false, ([, bs], {
7187
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)]))), '++', false, ([, bs], {
7140
7188
  buffer
7141
7189
  }) => buffer.import(bs), ([, bs], {
7142
7190
  buffer
7143
- }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
7191
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
7144
7192
 
7145
7193
  /***/ },
7146
7194
 
@@ -7163,11 +7211,11 @@ const dom_1 = __webpack_require__(394);
7163
7211
  // 可読性のため実際にはオブリーク体を指定する。
7164
7212
  // 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
7165
7213
  // ある程度の長さのある文に使うのが望ましい。
7166
- exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('///', (0, combinator_1.precedence)(0, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('///')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '/'), inline_1.inline)])))), '///', false, ([, bs], {
7214
+ exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('///')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '/'), inline_1.inline)])))), '///', false, ([, bs], {
7167
7215
  buffer
7168
7216
  }) => buffer.import(bs), ([, bs], {
7169
7217
  buffer
7170
- }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
7218
+ }) => bs && buffer.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Data((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
7171
7219
 
7172
7220
  /***/ },
7173
7221
 
@@ -7227,11 +7275,11 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
7227
7275
  if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
7228
7276
  return new parser_1.List([new parser_1.Data(parse(content, params, context))]);
7229
7277
  }))))));
7230
- exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.validate)(/[[{]/y, (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))]), ([{
7278
+ exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (0, combinator_1.creation)(10, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.sequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.union)([inline_1.media, inline_1.shortmedia]), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))]), ([{
7231
7279
  value: content
7232
7280
  }, {
7233
7281
  value: params
7234
- }], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))])))))));
7282
+ }], context) => new parser_1.List([new parser_1.Data(parse(content, params, context))]))))));
7235
7283
  exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (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)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y))])), ([{
7236
7284
  value: params
7237
7285
  }, {
@@ -7345,7 +7393,7 @@ const indexee_1 = __webpack_require__(7610);
7345
7393
  const visibility_1 = __webpack_require__(6364);
7346
7394
  const util_1 = __webpack_require__(4992);
7347
7395
  const dom_1 = __webpack_require__(394);
7348
- exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.validate)('==', (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), inline_1.inline)])))), '==', false, ([, bs], {
7396
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /* State.linkers */ & ~2 /* State.mark */, (0, combinator_1.precedence)(0, (0, combinator_1.state)(2 /* State.mark */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('==')), (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), inline_1.inline)])))), '==', false, ([, bs], {
7349
7397
  buffer
7350
7398
  }) => buffer.import(bs), ([, bs], {
7351
7399
  buffer
@@ -7359,7 +7407,7 @@ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(251 /*
7359
7407
  return el.id ? new parser_1.List([new parser_1.Data(el), new parser_1.Data((0, dom_1.html)('a', {
7360
7408
  href: `#${el.id}`
7361
7409
  }))]) : new parser_1.List([new parser_1.Data(el)]);
7362
- }))))));
7410
+ })))));
7363
7411
 
7364
7412
  /***/ },
7365
7413
 
@@ -7659,11 +7707,11 @@ const inline_1 = __webpack_require__(7973);
7659
7707
  const source_1 = __webpack_require__(8745);
7660
7708
  const util_1 = __webpack_require__(4992);
7661
7709
  const dom_1 = __webpack_require__(394);
7662
- exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=\s)/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /\s%\]/y, [[/\s%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7710
+ exports.remark = (0, combinator_1.lazy)(() => (0, combinator_1.fallback)((0, combinator_1.surround)((0, source_1.str)(/\[%(?=[ \n])/y), (0, combinator_1.precedence)(3, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), /[ \n]%\]/y, [[/[ \n]%\]/y, 3]]))), (0, combinator_1.close)(source_1.text, (0, source_1.str)(`%]`)), true, ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7663
7711
  class: 'remark'
7664
7712
  }, [(0, dom_1.html)('input', {
7665
7713
  type: 'checkbox'
7666
- }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(?=\s)/y, ({
7714
+ }), (0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs))))]))]), ([as, bs]) => bs && as.import(bs)), (0, combinator_1.focus)(/\[%+(?=[ \n])/y, ({
7667
7715
  context: {
7668
7716
  source
7669
7717
  }
@@ -8555,7 +8603,6 @@ function next(source, position, delimiter) {
8555
8603
  const char = source[index];
8556
8604
  switch (char) {
8557
8605
  case '$':
8558
- case '%':
8559
8606
  case '*':
8560
8607
  case '+':
8561
8608
  case '~':
@@ -8563,8 +8610,11 @@ function next(source, position, delimiter) {
8563
8610
  case '/':
8564
8611
  index = backToWhitespace(source, position, index);
8565
8612
  break;
8613
+ case '%':
8614
+ index += index - 1 > position && source.startsWith(' %]', index - 1) ? -1 : 0;
8615
+ break;
8566
8616
  case '[':
8567
- index = source[index + 1] === '|' ? backToWhitespace(source, position, index) : index;
8617
+ index += index - 1 > position && source.startsWith(' [|', index - 1) ? -1 : 0;
8568
8618
  break;
8569
8619
  case ':':
8570
8620
  index = source.startsWith('//', index + 1) ? backToUrlHead(source, position, index) : index;
@@ -8837,6 +8887,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
8837
8887
  source,
8838
8888
  position
8839
8889
  } = context;
8890
+ if (!source.startsWith(symbol, context.position)) return;
8840
8891
  let nodes = new parser_1.List();
8841
8892
  let i = symbol.length;
8842
8893
  for (; source[context.position + i] === source[context.position];) ++i;
@@ -8942,7 +8993,7 @@ var blank;
8942
8993
  (function (blank) {
8943
8994
  blank.line = new RegExp(
8944
8995
  // TODO: 行全体をエスケープ
8945
- /^(?:[^\S\r\n])*(?!\s)(\\?[^\S\r\n]|&IHN;|<wbr ?>|\\$)+$/mg.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'gm');
8996
+ /^(\\?[^\S\r\n]|&IHN;|<wbr ?>|\\$)+$/mg.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'gm');
8946
8997
  blank.start = new RegExp(/(?:\\?[^\S\r\n]|&IHN;|<wbr ?>)+/y.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'y');
8947
8998
  })(blank || (exports.blank = blank = {}));
8948
8999
  function visualize(parser) {