securemark 0.294.9 → 0.294.11

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 (44) hide show
  1. package/.eslintrc.json +0 -5
  2. package/CHANGELOG.md +8 -0
  3. package/dist/index.js +138 -122
  4. package/markdown.d.ts +1 -1
  5. package/package.json +1 -1
  6. package/src/combinator/control/manipulation/convert.ts +9 -19
  7. package/src/combinator/control/manipulation/scope.ts +23 -7
  8. package/src/parser/api/body.test.ts +1 -1
  9. package/src/parser/api/header.test.ts +2 -2
  10. package/src/parser/api/normalize.test.ts +2 -0
  11. package/src/parser/api/normalize.ts +1 -1
  12. package/src/parser/block/blockquote.ts +4 -4
  13. package/src/parser/block/extension/fig.ts +2 -3
  14. package/src/parser/block/extension/figure.ts +1 -1
  15. package/src/parser/block/extension/table.ts +2 -2
  16. package/src/parser/block/heading.ts +3 -3
  17. package/src/parser/block/paragraph.test.ts +1 -1
  18. package/src/parser/block/reply/quote.ts +2 -4
  19. package/src/parser/block/sidefence.ts +2 -2
  20. package/src/parser/block/table.ts +4 -4
  21. package/src/parser/block/ulist.ts +3 -3
  22. package/src/parser/context.ts +9 -6
  23. package/src/parser/header.test.ts +2 -2
  24. package/src/parser/header.ts +5 -5
  25. package/src/parser/inline/annotation.ts +1 -1
  26. package/src/parser/inline/autolink/account.ts +7 -4
  27. package/src/parser/inline/autolink/anchor.ts +1 -1
  28. package/src/parser/inline/autolink/email.ts +1 -1
  29. package/src/parser/inline/autolink/hashnum.ts +1 -1
  30. package/src/parser/inline/autolink/hashtag.ts +1 -1
  31. package/src/parser/inline/autolink/url.ts +11 -11
  32. package/src/parser/inline/bracket.ts +11 -8
  33. package/src/parser/inline/extension/index.ts +3 -3
  34. package/src/parser/inline/extension/label.ts +1 -1
  35. package/src/parser/inline/extension/placeholder.ts +1 -1
  36. package/src/parser/inline/htmlentity.ts +1 -1
  37. package/src/parser/inline/link.ts +11 -13
  38. package/src/parser/inline/math.ts +2 -2
  39. package/src/parser/inline/media.ts +15 -17
  40. package/src/parser/inline/reference.ts +3 -3
  41. package/src/parser/inline/ruby.ts +3 -3
  42. package/src/parser/inline/shortmedia.ts +3 -5
  43. package/src/parser/inline/template.ts +6 -10
  44. package/src/parser/visibility.ts +8 -26
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.294.9 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.294.11 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"));
@@ -2722,7 +2722,7 @@ Object.defineProperty(exports, "__esModule", ({
2722
2722
  }));
2723
2723
  exports.convert = void 0;
2724
2724
  const parser_1 = __webpack_require__(605);
2725
- function convert(conv, parser, continuous, empty = false) {
2725
+ function convert(conv, parser, empty = false) {
2726
2726
  return (0, parser_1.failsafe)(input => {
2727
2727
  const {
2728
2728
  context
@@ -2738,20 +2738,13 @@ function convert(conv, parser, continuous, empty = false) {
2738
2738
  context.position = source.length;
2739
2739
  return new parser_1.List();
2740
2740
  }
2741
- if (continuous) {
2742
- context.position += source.length - position - src.length;
2743
- const result = parser(input);
2744
- context.source = source;
2745
- return result;
2746
- } else {
2747
- const {
2748
- offset,
2749
- backtracks
2750
- } = context;
2751
- const result = parser((0, parser_1.subinput)(src, context));
2752
- context.position = context.source.length;
2753
- return result;
2754
- }
2741
+ const {
2742
+ offset,
2743
+ backtracks
2744
+ } = context;
2745
+ const result = parser((0, parser_1.subinput)(src, context));
2746
+ context.position = context.source.length;
2747
+ return result;
2755
2748
  });
2756
2749
  }
2757
2750
  exports.convert = convert;
@@ -3022,11 +3015,12 @@ Object.defineProperty(exports, "__esModule", ({
3022
3015
  exports.rewrite = exports.focus = void 0;
3023
3016
  const parser_1 = __webpack_require__(605);
3024
3017
  const combinator_1 = __webpack_require__(3484);
3025
- function focus(scope, parser) {
3018
+ function focus(scope, parser, slice = true) {
3026
3019
  const match = (0, combinator_1.matcher)(scope, false);
3027
- return (0, parser_1.failsafe)(({
3028
- context
3029
- }) => {
3020
+ return (0, parser_1.failsafe)(arg => {
3021
+ const {
3022
+ context
3023
+ } = arg;
3030
3024
  const {
3031
3025
  source,
3032
3026
  position
@@ -3036,7 +3030,12 @@ function focus(scope, parser) {
3036
3030
  context
3037
3031
  })?.head?.value ?? '';
3038
3032
  if (src === '') return;
3039
- context.range = src.length;
3033
+ const range = context.range = src.length;
3034
+ if (!slice) {
3035
+ const result = parser(arg);
3036
+ context.position += result && context.position === position ? range : 0;
3037
+ return result;
3038
+ }
3040
3039
  context.offset ??= 0;
3041
3040
  context.offset += position;
3042
3041
  const result = parser((0, parser_1.input)(src, context));
@@ -3048,10 +3047,11 @@ function focus(scope, parser) {
3048
3047
  });
3049
3048
  }
3050
3049
  exports.focus = focus;
3051
- function rewrite(scope, parser) {
3052
- return (0, parser_1.failsafe)(({
3053
- context
3054
- }) => {
3050
+ function rewrite(scope, parser, slice = true) {
3051
+ return (0, parser_1.failsafe)(arg => {
3052
+ const {
3053
+ context
3054
+ } = arg;
3055
3055
  const {
3056
3056
  source,
3057
3057
  position
@@ -3061,6 +3061,13 @@ function rewrite(scope, parser) {
3061
3061
  context
3062
3062
  });
3063
3063
  if (res1 === undefined || context.position < position) return;
3064
+ const range = context.range = context.position - position;
3065
+ if (!slice) {
3066
+ context.position = position;
3067
+ const res2 = parser(arg);
3068
+ context.position += res2 && context.position === position ? range : 0;
3069
+ return res2;
3070
+ }
3064
3071
  const src = source.slice(position, context.position);
3065
3072
  context.offset ??= 0;
3066
3073
  context.offset += position;
@@ -4395,7 +4402,7 @@ function normalize(source) {
4395
4402
  }
4396
4403
  exports.normalize = normalize;
4397
4404
  function format(source) {
4398
- return source.replace(/\r\n?/g, '\n');
4405
+ return source.replace(/\r\n?|[\u2028\u2029]/g, '\n');
4399
4406
  }
4400
4407
  const invalid = new RegExp([/(?![\t\r\n])[\x00-\x1F\x7F]/g.source, /(?!\u200D)[\u2006\u200B-\u200F\u202A-\u202F\u2060\uFEFF]/g.source
4401
4408
  // 後読みが重い
@@ -4658,8 +4665,8 @@ exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, co
4658
4665
  const opener = /(?=>>+(?:$|[ \n]))/y;
4659
4666
  const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y)), false);
4660
4667
  const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
4661
- 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)))])));
4662
- 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.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
4668
+ 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, 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))))])), true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4669
+ 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, true)), (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.contentline, opener), (0, combinator_1.convert)(unindent, ({
4663
4670
  context
4664
4671
  }) => {
4665
4672
  (0, combinator_1.consume)(10, context);
@@ -4677,7 +4684,7 @@ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combina
4677
4684
  }, context);
4678
4685
  context.position = source.length;
4679
4686
  return new parser_1.List([new parser_1.Data((0, dom_1.html)('section', [document, (0, dom_1.html)('h2', 'References'), references]))]);
4680
- }, false, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4687
+ }, true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4681
4688
 
4682
4689
  /***/ },
4683
4690
 
@@ -4926,7 +4933,7 @@ const inline_1 = __webpack_require__(7973);
4926
4933
  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)])]));
4927
4934
  exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
4928
4935
  // Bug: TypeScript
4929
- const fence = (/^[^\n]*\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
4936
+ const fence = (/^[^\n]*\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/gm) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
4930
4937
  const {
4931
4938
  position
4932
4939
  } = context;
@@ -4935,7 +4942,7 @@ exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
4935
4942
  });
4936
4943
  context.position = position;
4937
4944
  return result ? `${fence}figure ${source.replace(/^(.+\n.+\n)([\S\s]+?)\n?$/, '$1\n$2')}\n${fence}` : `${fence}figure ${source}\n\n${fence}`;
4938
- }, (0, combinator_1.union)([figure_1.figure]), false), ([{
4945
+ }, (0, combinator_1.union)([figure_1.figure])), ([{
4939
4946
  value: el
4940
4947
  }]) => el.tagName === 'FIGURE')));
4941
4948
  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)]);
@@ -5001,7 +5008,7 @@ const dom_1 = __webpack_require__(394);
5001
5008
  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)([
5002
5009
  // All parsers which can include closing terms.
5003
5010
  (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)));
5004
- 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 => {
5011
+ 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))))])])), nodes => {
5005
5012
  const [label, param, content, ...caption] = (0, util_1.unwrap)(nodes);
5006
5013
  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', {
5007
5014
  class: 'figindex'
@@ -5209,7 +5216,7 @@ const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.uni
5209
5216
  const delimiter = /[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|[#:](?:(?!:\D|0)\d*:(?!0)\d*)?(?:!+[+]?)?(?=[ \n])/y;
5210
5217
  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);
5211
5218
  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);
5212
- 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)])));
5219
+ 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)), (0, combinator_1.convert)(source => `: ${source}`, data)])));
5213
5220
  function attributes(source) {
5214
5221
  let [, rowspan = undefined, colspan = undefined, highlight = undefined, extension = undefined] = source.match(/^[#:](?:(\d+)?:(\d+)?)?(?:(!+)([+]?))?$/) ?? [];
5215
5222
  rowspan === '1' ? rowspan = undefined : undefined;
@@ -5434,16 +5441,17 @@ exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(
5434
5441
  context
5435
5442
  } = input;
5436
5443
  const {
5437
- source
5444
+ source,
5445
+ range = 0
5438
5446
  } = context;
5439
5447
  const acc = new parser_1.List();
5440
- for (; context.position < source.length;) {
5448
+ for (const len = context.position + range; context.position < len;) {
5441
5449
  const line = (0, combinator_1.firstline)(source, context.position);
5442
5450
  acc.push(new parser_1.Data(line));
5443
5451
  context.position += line.length;
5444
5452
  }
5445
5453
  return acc;
5446
- }));
5454
+ }, false));
5447
5455
  exports.heading = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment,
5448
5456
  // その他の表示制御は各所のCSSで行う。
5449
5457
  (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) => {
@@ -5826,11 +5834,9 @@ const source_1 = __webpack_require__(8745);
5826
5834
  const util_1 = __webpack_require__(4992);
5827
5835
  const dom_1 = __webpack_require__(394);
5828
5836
  exports.syntax = />+ /y;
5829
- 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)(
5830
- // TODO: インデント数を渡してインデント数前の行頭確認を行う実装に置き換える
5831
- source => source.replace(/(?<=^>+ )/mg, '\r'), (0, combinator_1.some)((0, combinator_1.union)([
5837
+ 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)(source => source.replace(/(?<=^>+ )/gm, '\r'), (0, combinator_1.some)((0, combinator_1.union)([
5832
5838
  // quote補助関数が残した数式をパースする。
5833
- math_1.math, autolink_1.autolink, source_1.unescsource])), false)), (ns, {
5839
+ math_1.math, autolink_1.autolink, source_1.unescsource])))), (ns, {
5834
5840
  source,
5835
5841
  position
5836
5842
  }) => new parser_1.List([new parser_1.Data(source[position - 1] === '\n' ? ns.pop().value : (0, dom_1.html)('br')), new parser_1.Data((0, dom_1.html)('span', {
@@ -5863,7 +5869,7 @@ exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, com
5863
5869
  }))]))));
5864
5870
  const opener = /(?=\|\|+(?:$|[ \n]))/y;
5865
5871
  const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \n])))|\n$/g, '');
5866
- 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)))])));
5872
+ 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, 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))))])), true))]))), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5867
5873
 
5868
5874
  /***/ },
5869
5875
 
@@ -5897,13 +5903,17 @@ const row = (parser, optional) => (0, combinator_1.fallback)((0, combinator_1.fm
5897
5903
  }, [(0, dom_1.html)('td', source.replace('\n', ''))]))])));
5898
5904
  const align = (0, combinator_1.fmap)((0, combinator_1.open)('|', (0, combinator_1.union)([(0, combinator_1.focus)(/:-+:?/y, ({
5899
5905
  context: {
5900
- source
5906
+ source,
5907
+ position,
5908
+ range = 0
5901
5909
  }
5902
- }) => new parser_1.List([new parser_1.Data(source.at(-1) === ':' ? 'center' : 'start')])), (0, combinator_1.focus)(/-+:?/y, ({
5910
+ }) => new parser_1.List([new parser_1.Data(source[position + range - 1] === ':' ? 'center' : 'start')]), false), (0, combinator_1.focus)(/-+:?/y, ({
5903
5911
  context: {
5904
- source
5912
+ source,
5913
+ position,
5914
+ range = 0
5905
5915
  }
5906
- }) => 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))))]));
5916
+ }) => new parser_1.List([new parser_1.Data(source[position + range - 1] === ':' ? 'end' : '')]), false)])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('td', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))]));
5907
5917
  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);
5908
5918
  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))))]));
5909
5919
  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))))]));
@@ -5949,11 +5959,12 @@ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combin
5949
5959
  }, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.Data(format((0, dom_1.html)('ul', (0, util_1.unwrap)(ns))))]))));
5950
5960
  exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
5951
5961
  context: {
5952
- source
5962
+ source,
5963
+ position
5953
5964
  }
5954
5965
  }) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
5955
5966
  class: 'checkbox'
5956
- }, source[1].trimStart() ? '☑' : '☐'))]));
5967
+ }, source[position + 1].trimStart() ? '☑' : '☐'))]), false);
5957
5968
  function fillFirstLine(nodes) {
5958
5969
  const node = nodes.head?.value;
5959
5970
  if (typeof node !== 'object') return nodes;
@@ -5990,13 +6001,13 @@ const source_1 = __webpack_require__(8745);
5990
6001
  const util_1 = __webpack_require__(4992);
5991
6002
  const normalize_1 = __webpack_require__(4490);
5992
6003
  const dom_1 = __webpack_require__(394);
5993
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
6004
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
5994
6005
  context
5995
- }) => 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', {
6006
+ }) => context.header ?? true, (0, combinator_1.focus)(/(---+) *\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1 *(?:$|\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (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', {
5996
6007
  class: 'header'
5997
6008
  }, [(0, dom_1.html)('details', {
5998
6009
  open: ''
5999
- }, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Data((0, dom_1.html)('summary', 'Header'))) && ns)))]))])), false))), ({
6010
+ }, (0, dom_1.defrag)((0, util_1.unwrap)(ns.unshift(new parser_1.Data((0, dom_1.html)('summary', 'Header'))) && ns)))]))]))))), ({
6000
6011
  context
6001
6012
  }) => {
6002
6013
  const {
@@ -6009,7 +6020,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *
6009
6020
  translate: 'no',
6010
6021
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
6011
6022
  }, (0, normalize_1.normalize)(source.slice(position))))]);
6012
- }])), (0, combinator_1.clear)((0, source_1.str)(/ *\r?\n/y))])));
6023
+ }])), (0, combinator_1.clear)((0, source_1.str)(/ *\n/y))])));
6013
6024
  const field = (0, combinator_1.line)(({
6014
6025
  context: {
6015
6026
  source,
@@ -6191,7 +6202,7 @@ const inline_1 = __webpack_require__(7973);
6191
6202
  const visibility_1 = __webpack_require__(6364);
6192
6203
  const util_1 = __webpack_require__(4992);
6193
6204
  const dom_1 = __webpack_require__(394);
6194
- exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
6205
+ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, [1 | 0 /* Backtrack.common */, 3 | 64 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
6195
6206
  class: 'annotation'
6196
6207
  }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined)));
6197
6208
 
@@ -6274,9 +6285,9 @@ const source_1 = __webpack_require__(8745);
6274
6285
  const dom_1 = __webpack_require__(394);
6275
6286
  // https://example/@user must be a user page or a redirect page going there.
6276
6287
  // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
6277
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/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.surround)('#', (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))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
6288
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), false, [3 | 4 /* Backtrack.unescapable */]), (0, combinator_1.some)((0, combinator_1.surround)('#', (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))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
6278
6289
  value
6279
- }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 0 /* Backtrack.autolink */])), '', false, [], ([[{
6290
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 4 /* Backtrack.unescapable */])), '', false, [], ([[{
6280
6291
  value: host
6281
6292
  }, {
6282
6293
  value: account
@@ -6295,7 +6306,9 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
6295
6306
  }, {
6296
6307
  value: account
6297
6308
  }]], context) => {
6298
- if (context.source[context.position] === '#') return;
6309
+ if (context.source[context.position] === '#') {
6310
+ return void (0, combinator_1.setBacktrack)(context, [2 | 4 /* Backtrack.unescapable */], context.position - context.range);
6311
+ }
6299
6312
  return new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`@${host}${account}`)]), new parser_1.List([new parser_1.Data(host ? `https://${host}@${account}` : `/@${account}`)]), context), {
6300
6313
  class: 'account'
6301
6314
  }))]);
@@ -6325,7 +6338,7 @@ const dom_1 = __webpack_require__(394);
6325
6338
  // cid: YYYY-MMDD-HHMM-SSmmm
6326
6339
  // 内部表現はUnixTimeに統一する(時系列順)
6327
6340
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
6328
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 0 /* Backtrack.autolink */], ([, [{
6341
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6329
6342
  value
6330
6343
  }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`>>${value}`)]), new parser_1.List([new parser_1.Data(`?at=${value}`)]), context), {
6331
6344
  class: 'anchor'
@@ -6350,7 +6363,7 @@ const dom_1 = __webpack_require__(394);
6350
6363
  // https://html.spec.whatwg.org/multipage/input.html
6351
6364
  exports.email = (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z][_.+-]?|[@#])(?=[0-9a-z])/yi, (0, combinator_1.verify)((0, source_1.str)(/[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,63}@[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}(?![.-]?[0-9a-z@#]|>>|:\S)/yi), ([{
6352
6365
  value
6353
- }]) => value.length <= 254), '', false, [3 | 0 /* Backtrack.autolink */], ([, [{
6366
+ }]) => value.length <= 254), '', false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6354
6367
  value
6355
6368
  }]]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6356
6369
  class: 'email',
@@ -6375,7 +6388,7 @@ const link_1 = __webpack_require__(3628);
6375
6388
  const hashtag_1 = __webpack_require__(5764);
6376
6389
  const source_1 = __webpack_require__(8745);
6377
6390
  const dom_1 = __webpack_require__(394);
6378
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), '', false, [1 | 0 /* Backtrack.autolink */], ([, [{
6391
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), '', false, [1 | 4 /* Backtrack.unescapable */], ([, [{
6379
6392
  value
6380
6393
  }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(value)]), context), {
6381
6394
  class: 'hashnum',
@@ -6404,7 +6417,7 @@ const dom_1 = __webpack_require__(394);
6404
6417
  exports.emoji = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\u200D/u;
6405
6418
  exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, exports.emoji.source), '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))+/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu')), ([{
6406
6419
  value
6407
- }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 0 /* Backtrack.autolink */], ([, [{
6420
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6408
6421
  value
6409
6422
  }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(`/hashtags/${value}`)]), context), {
6410
6423
  class: 'hashtag'
@@ -6427,7 +6440,7 @@ const combinator_1 = __webpack_require__(3484);
6427
6440
  const inline_1 = __webpack_require__(7973);
6428
6441
  const link_1 = __webpack_require__(3628);
6429
6442
  const source_1 = __webpack_require__(8745);
6430
- exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6443
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 4 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6431
6444
  context
6432
6445
  }) => new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6433
6446
  exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
@@ -6435,13 +6448,14 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
6435
6448
  }) => {
6436
6449
  const {
6437
6450
  source,
6438
- position
6451
+ position,
6452
+ range = 0
6439
6453
  } = context;
6440
- context.position -= source[0] === '!' ? 1 : 0;
6441
- context.position += source.length;
6442
- return new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(source.slice(position))]), context))]);
6443
- })), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])])));
6444
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List())]));
6454
+ context.position -= position > 0 && source[position - 1] === '!' ? 1 : 0;
6455
+ context.position += range;
6456
+ return new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(source.slice(position, context.position))]), context))]);
6457
+ })), (0, source_1.str)(/[^:]+/y)])]), false));
6458
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List())]));
6445
6459
 
6446
6460
  /***/ },
6447
6461
 
@@ -6488,7 +6502,7 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6488
6502
  return d1(input);
6489
6503
  }
6490
6504
  }]));
6491
- const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 64 /* Backtrack.bracket */], ([as, bs = new parser_1.List(), cs], {
6505
+ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 0 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], {
6492
6506
  source,
6493
6507
  position,
6494
6508
  range = 0
@@ -6498,7 +6512,7 @@ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6498
6512
  class: 'paren'
6499
6513
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6500
6514
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6501
- const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 64 /* Backtrack.bracket */], ([as, bs = [], cs], {
6515
+ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 0 /* Backtrack.common */], ([as, bs = [], cs], {
6502
6516
  source,
6503
6517
  position,
6504
6518
  range = 0
@@ -6508,7 +6522,7 @@ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6508
6522
  class: 'paren'
6509
6523
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6510
6524
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6511
- const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 64 /* Backtrack.bracket */], ([as, bs = new parser_1.List(), cs], context) => {
6525
+ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 0 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], context) => {
6512
6526
  if (context.state & 8 /* State.link */) {
6513
6527
  const {
6514
6528
  source,
@@ -6516,16 +6530,18 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6516
6530
  range = 0
6517
6531
  } = context;
6518
6532
  const head = position - range;
6519
- if (context.linebreak !== 0 || source[position] !== '{') {
6520
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
6533
+ if (context.linebreak !== 0) {
6534
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
6535
+ } else if (source[position] !== '{') {
6536
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
6521
6537
  } else {
6522
6538
  context.state ^= 8 /* State.link */;
6523
- const result = !(0, combinator_1.isBacktrack)(context, [1 | 16 /* Backtrack.link */]) ? (0, link_1.textlink)({
6539
+ const result = !(0, combinator_1.isBacktrack)(context, [1 | 32 /* Backtrack.link */]) ? (0, link_1.textlink)({
6524
6540
  context
6525
6541
  }) : undefined;
6526
6542
  context.position = position;
6527
6543
  if (!result) {
6528
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
6544
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
6529
6545
  }
6530
6546
  context.state ^= 8 /* State.link */;
6531
6547
  context.range = range;
@@ -6533,12 +6549,12 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6533
6549
  }
6534
6550
  return as.import(bs).import(cs);
6535
6551
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6536
- const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6537
- const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6538
- const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6552
+ const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6553
+ const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6554
+ const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6539
6555
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6540
6556
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6541
- (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6557
+ (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6542
6558
 
6543
6559
  /***/ },
6544
6560
 
@@ -6794,7 +6810,7 @@ const source_1 = __webpack_require__(8745);
6794
6810
  const visibility_1 = __webpack_require__(6364);
6795
6811
  const util_1 = __webpack_require__(4992);
6796
6812
  const dom_1 = __webpack_require__(394);
6797
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 64 /* Backtrack.bracket */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6813
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 0 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6798
6814
  'data-index': dataindex(bs)
6799
6815
  }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
6800
6816
  if (ns.length === 1) {
@@ -6809,7 +6825,7 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /*
6809
6825
  return ns;
6810
6826
  }
6811
6827
  })));
6812
- exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}])/y)]), ']'), /(?=])/y, false, [3 | 64 /* Backtrack.bracket */], ([, ns], context) => {
6828
+ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}|])/y)]), ']'), /(?=])/y, false, [3 | 8 /* Backtrack.escapable */], ([, ns], context) => {
6813
6829
  const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6814
6830
  value
6815
6831
  }) => acc + value, ''))?.slice(7);
@@ -7014,7 +7030,7 @@ const source_1 = __webpack_require__(8745);
7014
7030
  const dom_1 = __webpack_require__(394);
7015
7031
  const body = (0, source_1.str)(/\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/y);
7016
7032
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
7017
- exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, [1 | 64 /* Backtrack.bracket */, 1]), body]), ([{
7033
+ exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, [1 | 0 /* Backtrack.common */]), body]), ([{
7018
7034
  value
7019
7035
  }]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
7020
7036
  class: 'label',
@@ -7061,7 +7077,7 @@ const dom_1 = __webpack_require__(394);
7061
7077
  // All syntax surrounded by square brackets shouldn't contain line breaks.
7062
7078
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
7063
7079
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
7064
- (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 64 /* Backtrack.bracket */], (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7080
+ (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 0 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7065
7081
  class: 'invalid',
7066
7082
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
7067
7083
  }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
@@ -7175,7 +7191,7 @@ const combinator_1 = __webpack_require__(3484);
7175
7191
  const source_1 = __webpack_require__(8745);
7176
7192
  const util_1 = __webpack_require__(4992);
7177
7193
  const dom_1 = __webpack_require__(394);
7178
- exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 64 /* Backtrack.bracket */], ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]));
7194
+ exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 4 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]));
7179
7195
  exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
7180
7196
  value
7181
7197
  }]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Data(value) : new parser_1.Data((0, dom_1.html)('span', {
@@ -7264,15 +7280,16 @@ const optspec = {
7264
7280
  rel: ['nofollow']
7265
7281
  };
7266
7282
  Object.setPrototypeOf(optspec, null);
7267
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns : undefined)),
7283
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 0 /* Backtrack.common */, 3 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7284
+ if (context.linebreak !== 0) {
7285
+ const head = context.position - context.range;
7286
+ return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
7287
+ }
7288
+ return ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns;
7289
+ })),
7268
7290
  // `{ `と`{`で個別にバックトラックが発生し+1nされる。
7269
7291
  // 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
7270
- (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, [3 | 16 /* Backtrack.link */], undefined, ([as, bs], context) => {
7271
- if (!bs) return;
7272
- const head = context.position - context.range;
7273
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7274
- return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7275
- }))]), ([{
7292
+ (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as))]), ([{
7276
7293
  value: content
7277
7294
  }, {
7278
7295
  value: params = undefined
@@ -7281,7 +7298,7 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
7281
7298
  content.pop();
7282
7299
  if (params === undefined) {
7283
7300
  const head = context.position - context.range;
7284
- return void (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7301
+ return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7285
7302
  }
7286
7303
  } else {
7287
7304
  params = content;
@@ -7446,7 +7463,7 @@ const source_1 = __webpack_require__(8745);
7446
7463
  const util_1 = __webpack_require__(4992);
7447
7464
  const dom_1 = __webpack_require__(394);
7448
7465
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
7449
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, [3 | 64 /* Backtrack.bracket */])]), ({
7466
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 8 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, [3 | 8 /* Backtrack.escapable */])]), ({
7450
7467
  context: {
7451
7468
  source,
7452
7469
  caches: {
@@ -7492,12 +7509,13 @@ const optspec = {
7492
7509
  rel: undefined
7493
7510
  };
7494
7511
  Object.setPrototypeOf(optspec, null);
7495
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, [3 | 4 /* Backtrack.escbracket */], ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns : undefined)), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [3 | 16 /* Backtrack.link */], undefined, ([as, bs], context) => {
7496
- if (!bs) return;
7497
- const head = context.position - context.range;
7498
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7499
- return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7500
- }))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data(nodes.head.value.foldl((acc, {
7512
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, [3 | 8 /* Backtrack.escapable */, 2 | 16 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7513
+ if (context.linebreak !== 0) {
7514
+ const head = context.position - context.range;
7515
+ return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
7516
+ }
7517
+ return ns;
7518
+ })), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data(nodes.head.value.foldl((acc, {
7501
7519
  value
7502
7520
  }) => acc + value, ''))])), nodes.delete(nodes.last)])), ([{
7503
7521
  value: [{
@@ -7543,7 +7561,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7543
7561
  target: '_blank'
7544
7562
  }, [el]))]);
7545
7563
  }))));
7546
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List())])));
7564
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List())])));
7547
7565
  const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, [], ([[{
7548
7566
  value: a
7549
7567
  }], [{
@@ -7597,7 +7615,7 @@ const source_1 = __webpack_require__(8745);
7597
7615
  const visibility_1 = __webpack_require__(6364);
7598
7616
  const util_1 = __webpack_require__(4992);
7599
7617
  const dom_1 = __webpack_require__(394);
7600
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */], ([, ns], context) => {
7618
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [1 | 0 /* Backtrack.common */, 3 | 64 /* Backtrack.doublebracket */], ([, ns], context) => {
7601
7619
  const {
7602
7620
  position,
7603
7621
  range = 0,
@@ -7607,7 +7625,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7607
7625
  return new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]);
7608
7626
  } else {
7609
7627
  const head = position - range;
7610
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
7628
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head, 2);
7611
7629
  }
7612
7630
  }, ([as, bs], context) => {
7613
7631
  if (!bs) return;
@@ -7620,9 +7638,9 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7620
7638
  } = context;
7621
7639
  const head = position - range;
7622
7640
  if (source[position] !== ']') {
7623
- (0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.bracket */], head, 2);
7641
+ (0, combinator_1.setBacktrack)(context, [2 | 0 /* Backtrack.common */], head, 2);
7624
7642
  } else if (linebreak !== 0) {
7625
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
7643
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head, 2);
7626
7644
  } else {
7627
7645
  if (state & 128 /* State.annotation */) {
7628
7646
  bs.push(new parser_1.Data(source[position]));
@@ -7630,23 +7648,23 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7630
7648
  context.position += 1;
7631
7649
  let result;
7632
7650
  if (source[context.position] !== '{') {
7633
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7651
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head + 1);
7634
7652
  result = new parser_1.List();
7635
7653
  } else {
7636
- result = !(0, combinator_1.isBacktrack)(context, [1 | 16 /* Backtrack.link */]) ? (0, link_1.textlink)({
7654
+ result = !(0, combinator_1.isBacktrack)(context, [1 | 32 /* Backtrack.link */]) ? (0, link_1.textlink)({
7637
7655
  context
7638
7656
  }) : undefined;
7639
7657
  context.range = range;
7640
7658
  if (!result) {
7641
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7659
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head + 1);
7642
7660
  result = new parser_1.List();
7643
7661
  }
7644
7662
  }
7645
7663
  if (context.position === source.length) {
7646
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7664
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7647
7665
  } else {
7648
7666
  const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, [], ([, cs = new parser_1.List(), ds]) => cs.import(ds), ([, cs = new parser_1.List()]) => {
7649
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7667
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7650
7668
  return cs;
7651
7669
  })({
7652
7670
  context
@@ -7744,17 +7762,17 @@ const source_1 = __webpack_require__(8745);
7744
7762
  const visibility_1 = __webpack_require__(6364);
7745
7763
  const util_1 = __webpack_require__(4992);
7746
7764
  const dom_1 = __webpack_require__(394);
7747
- exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */], ([, ns]) => {
7765
+ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, [1 | 0 /* Backtrack.common */, 3 | 16 /* Backtrack.ruby */], ([, ns]) => {
7748
7766
  ns && ns.last?.value === '' && ns.pop();
7749
7767
  return (0, visibility_1.isTightNodeStart)(ns) ? ns : undefined;
7750
- })), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */]))]), ([{
7768
+ })), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, [1 | 0 /* Backtrack.common */, 3 | 16 /* Backtrack.ruby */]))]), ([{
7751
7769
  value: texts
7752
7770
  }, {
7753
7771
  value: rubies = undefined
7754
7772
  } = {}], context) => {
7755
7773
  if (rubies === undefined) {
7756
7774
  const head = context.position - context.range;
7757
- return void (0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.ruby */], head);
7775
+ return void (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.ruby */], head);
7758
7776
  }
7759
7777
  switch (true) {
7760
7778
  case texts.length >= rubies.length:
@@ -7777,7 +7795,7 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
7777
7795
  }, acc) => value + ' ' + acc, '').trim())), new parser_1.Data((0, dom_1.html)('rp', ')'))])))))]);
7778
7796
  }
7779
7797
  }));
7780
- const delimiter = /[$"`\[\](){}<>()[]{}]|\\?\n/y;
7798
+ const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
7781
7799
  const text = input => {
7782
7800
  const {
7783
7801
  context
@@ -7844,8 +7862,8 @@ exports.lineshortmedia = exports.shortmedia = void 0;
7844
7862
  const combinator_1 = __webpack_require__(3484);
7845
7863
  const url_1 = __webpack_require__(2129);
7846
7864
  const media_1 = __webpack_require__(7478);
7847
- exports.shortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.rewrite)((0, combinator_1.open)('!', url_1.url), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]), false)));
7848
- exports.lineshortmedia = (0, combinator_1.focus)(/(?<=^|[\r\n])!https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/y, (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]), false));
7865
+ exports.shortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.rewrite)((0, combinator_1.open)('!', url_1.url), (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
7866
+ exports.lineshortmedia = (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.focus)(/(?<=^|[\r\n])!https?:\/\/\S+(?=[^\S\n]*(?:$|\n))/y, (0, combinator_1.convert)(source => `!{ ${source.slice(1)} }`, (0, combinator_1.union)([media_1.media]))));
7849
7867
 
7850
7868
  /***/ },
7851
7869
 
@@ -7886,13 +7904,13 @@ const combinator_1 = __webpack_require__(3484);
7886
7904
  const source_1 = __webpack_require__(8745);
7887
7905
  const util_1 = __webpack_require__(4992);
7888
7906
  const dom_1 = __webpack_require__(394);
7889
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7907
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (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', {
7890
7908
  class: 'template'
7891
7909
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7892
7910
  class: 'invalid',
7893
7911
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7894
7912
  }, context.source.slice(context.position - context.range, context.position)))])));
7895
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.escbracket */], ([as, bs = new parser_1.List(), cs], context) => context.linebreak === 0 ? as.import(bs).import(cs) : (context.position -= 1, as.import(bs)), ([as, bs]) => bs && as.import(bs))]));
7913
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.escapable */], undefined, ([as, bs]) => bs && as.import(bs))]));
7896
7914
 
7897
7915
  /***/ },
7898
7916
 
@@ -8986,20 +9004,18 @@ exports.stringify = stringify;
8986
9004
  Object.defineProperty(exports, "__esModule", ({
8987
9005
  value: true
8988
9006
  }));
8989
- exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isTightNodeStart = exports.isLooseNodeStart = exports.tightStart = exports.blankWith = exports.visualize = exports.blank = void 0;
9007
+ exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isTightNodeStart = exports.isLooseNodeStart = exports.tightStart = exports.blankWith = exports.visualize = void 0;
8990
9008
  const parser_1 = __webpack_require__(605);
8991
9009
  const combinator_1 = __webpack_require__(3484);
8992
9010
  const htmlentity_1 = __webpack_require__(470);
8993
9011
  const normalize_1 = __webpack_require__(4490);
8994
9012
  var blank;
8995
9013
  (function (blank) {
8996
- blank.line = new RegExp(
8997
- // TODO: 行全体をエスケープ
8998
- /^(\\?[^\S\r\n]|&IHN;|<wbr ?>|\\$)+$/mg.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'gm');
8999
- blank.start = new RegExp(/(?:\\?[^\S\r\n]|&IHN;|<wbr ?>)+/y.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'y');
9000
- })(blank || (exports.blank = blank = {}));
9014
+ blank.line = new RegExp(/((?:^|\n)[^\S\n]*(?=\S))((?:[^\S\n]|\\(?=$|\s)|&IHN;|<wbr ?>)+(?=$|\n))/g.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'g');
9015
+ blank.start = new RegExp(/(?:[^\S\n]|\\(?=$|\s)|&IHN;|<wbr ?>)+/y.source.replace('IHN', `(?:${normalize_1.invisibleHTMLEntityNames.join('|')})`), 'y');
9016
+ })(blank || (blank = {}));
9001
9017
  function visualize(parser) {
9002
- return (0, combinator_1.convert)(source => source.replace(blank.line, `${"\u001B" /* Command.Escape */}$1`), parser, false);
9018
+ return (0, combinator_1.convert)(source => source.replace(blank.line, `$1${"\u001B" /* Command.Escape */}$2`), parser);
9003
9019
  }
9004
9020
  exports.visualize = visualize;
9005
9021
  function blankWith(starts, delimiter) {