securemark 0.295.4 → 0.295.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.295.6
4
+
5
+ - Refactoring.
6
+
7
+ ## 0.295.5
8
+
9
+ - Refactoring.
10
+
3
11
  ## 0.295.4
4
12
 
5
13
  - Refactoring.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.295.4 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.295.6 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"));
@@ -3439,14 +3439,15 @@ class Delimiters {
3439
3439
  return `r/${pattern.source}`;
3440
3440
  }
3441
3441
  }
3442
- static matcher(pattern) {
3442
+ static matcher(pattern, after) {
3443
3443
  switch (typeof pattern) {
3444
3444
  case 'undefined':
3445
3445
  return () => undefined;
3446
3446
  case 'string':
3447
3447
  case 'object':
3448
3448
  const match = (0, combinator_1.matcher)(pattern, false);
3449
- return input => match(input) !== undefined || undefined;
3449
+ const verify = after ? (0, combinator_1.matcher)(after, false) : undefined;
3450
+ return verify ? input => match(input) !== undefined && verify(input) !== undefined || undefined : input => match(input) !== undefined || undefined;
3450
3451
  }
3451
3452
  }
3452
3453
  registry(signature) {
@@ -3931,10 +3932,19 @@ Object.defineProperty(exports, "__esModule", ({
3931
3932
  }));
3932
3933
  exports.some = void 0;
3933
3934
  const delimiter_1 = __webpack_require__(385);
3934
- function some(parser, end, delimiters = [], limit = -1) {
3935
- if (typeof end === 'number') return some(parser, undefined, delimiters, end);
3936
- const match = delimiter_1.Delimiters.matcher(end);
3937
- const delims = delimiters.map(([delimiter, precedence]) => ({
3935
+ function some(parser, delimiter, after, delimiters, limit = -1) {
3936
+ if (typeof delimiter === 'number') {
3937
+ limit = delimiter;
3938
+ delimiter = undefined;
3939
+ } else if (Array.isArray(delimiter)) {
3940
+ delimiters = delimiter;
3941
+ delimiter = undefined;
3942
+ } else if (after === undefined || Array.isArray(after)) {
3943
+ delimiters = after;
3944
+ after = undefined;
3945
+ }
3946
+ const match = delimiter_1.Delimiters.matcher(delimiter, after);
3947
+ const delims = delimiters?.map(([delimiter, precedence]) => ({
3938
3948
  signature: delimiter_1.Delimiters.signature(delimiter),
3939
3949
  matcher: delimiter_1.Delimiters.matcher(delimiter),
3940
3950
  precedence
@@ -3949,9 +3959,7 @@ function some(parser, end, delimiters = [], limit = -1) {
3949
3959
  } = context;
3950
3960
  //assert(context.backtracks ??= {});
3951
3961
  let nodes;
3952
- if (delims.length > 0) {
3953
- context.delimiters.push(delims);
3954
- }
3962
+ delims && context.delimiters.push(delims);
3955
3963
  // whileは数倍遅い
3956
3964
  for (const len = source.length; context.position < len;) {
3957
3965
  if (match(input)) break;
@@ -3961,9 +3969,7 @@ function some(parser, end, delimiters = [], limit = -1) {
3961
3969
  nodes = nodes?.import(result) ?? result;
3962
3970
  if (limit >= 0 && context.position - position > limit) break;
3963
3971
  }
3964
- if (delims.length > 0) {
3965
- context.delimiters.pop(delims.length);
3966
- }
3972
+ delims && context.delimiters.pop(delims.length);
3967
3973
  return context.position > position ? nodes : undefined;
3968
3974
  };
3969
3975
  }
@@ -4676,8 +4682,8 @@ exports.blockquote = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, co
4676
4682
  const opener = /(?=>>+(?:$|[ \n]))/y;
4677
4683
  const indent = (0, combinator_1.block)((0, combinator_1.open)(opener, (0, combinator_1.some)(source_1.contentline, />(?:$|[ \n])/y)), false);
4678
4684
  const unindent = source => source.replace(/(?<=^|\n)>(?: |(?=>*(?:$|[ \n])))|\n$/g, '');
4679
- 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.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4680
- 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, ({
4685
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.some)((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.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
4686
+ const markdown = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(2 /* Recursion.blockquote */, (0, combinator_1.some)((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, ({
4681
4687
  context
4682
4688
  }) => {
4683
4689
  (0, combinator_1.consume)(10, context);
@@ -5497,7 +5503,7 @@ const visibility_1 = __webpack_require__(6364);
5497
5503
  const util_1 = __webpack_require__(4992);
5498
5504
  const dom_1 = __webpack_require__(394);
5499
5505
  exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/[-+*] /y, exports.ilist_)));
5500
- exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))]))])))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('ul', {
5506
+ exports.ilist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/[-+*](?:$|[ \n])/y, (0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/[-+*](?:$|[ \n])/y, (0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))), true)), (0, combinator_1.indent)((0, combinator_1.union)([ulist_1.ulist_, olist_1.olist_, exports.ilist_]))]), exports.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))]))])))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('ul', {
5501
5507
  class: 'invalid',
5502
5508
  ...(0, util_1.invalid)('list', 'syntax', 'Use "-" instead of "+" or "*"')
5503
5509
  }, (0, util_1.unwrap)(ns)))]))));
@@ -5604,7 +5610,7 @@ const openers = {
5604
5610
  };
5605
5611
  exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(new RegExp([/(?:[0-9]+)(?:-[0-9]+)*\. /y.source, /\((?:[0-9]+)\)(?:-[0-9]+)* /y.source].join('|'), 'y'), exports.olist_)));
5606
5612
  exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.match)(openers['.'], (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => idx(ms[1]), [])), (0, combinator_1.match)(openers['('], (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => idx(ms[1]), []))])));
5607
- const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (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.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
5613
+ const list = (type, form) => (0, combinator_1.fmap)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(heads[form], (0, combinator_1.subsequence)([ulist_1.checkbox, (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.indent)((0, combinator_1.union)([ulist_1.ulist_, exports.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
5608
5614
  'data-index': (0, inline_1.dataindex)(ns),
5609
5615
  'data-marker': ns.shift()?.value || undefined
5610
5616
  }, (0, dom_1.defrag)((0, util_1.unwrap)((0, ulist_1.fillFirstLine)(ns)))))])))]))), ns => new parser_1.List([new parser_1.Node(format((0, dom_1.html)('ol', (0, util_1.unwrap)(ns)), type, form))]));
@@ -5880,7 +5886,7 @@ exports.sidefence = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, com
5880
5886
  }))]))));
5881
5887
  const opener = /(?=\|\|+(?:$|[ \n]))/y;
5882
5888
  const unindent = source => source.replace(/(?<=^|\n)\|(?: |(?=\|*(?:$|[ \n])))|\n$/g, '');
5883
- 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.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5889
+ const source = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.recursion)(1 /* Recursion.block */, (0, combinator_1.some)((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.Node((0, dom_1.html)('pre', (0, dom_1.defrag)((0, util_1.unwrap)(ns))))])), true))]))), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('blockquote', (0, util_1.unwrap)(ns)))])));
5884
5890
 
5885
5891
  /***/ },
5886
5892
 
@@ -5965,7 +5971,7 @@ const visibility_1 = __webpack_require__(6364);
5965
5971
  const util_1 = __webpack_require__(4992);
5966
5972
  const dom_1 = __webpack_require__(394);
5967
5973
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)('- ', exports.ulist_)));
5968
- exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.some)((0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (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.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
5974
+ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/-(?=$|[ \n])/y, (0, combinator_1.recursion)(3 /* Recursion.listitem */, (0, combinator_1.some)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([(0, combinator_1.line)((0, combinator_1.open)(/-(?:$|[ \n])/y, (0, combinator_1.subsequence)([exports.checkbox, (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.indent)((0, combinator_1.union)([exports.ulist_, olist_1.olist_, ilist_1.ilist_]))]), ilist_1.ilistitem), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('li', {
5969
5975
  'data-index': (0, inline_1.dataindex)(ns)
5970
5976
  }, (0, dom_1.defrag)((0, util_1.unwrap)(fillFirstLine(ns)))))])))])))), ns => new parser_1.List([new parser_1.Node(format((0, dom_1.html)('ul', (0, util_1.unwrap)(ns))))]))));
5971
5977
  exports.checkbox = (0, combinator_1.focus)(/\[[xX ]\](?=$|[ \n])/y, ({
@@ -6505,7 +6511,7 @@ const combinator_1 = __webpack_require__(3484);
6505
6511
  const inline_1 = __webpack_require__(7973);
6506
6512
  const link_1 = __webpack_require__(3628);
6507
6513
  const source_1 = __webpack_require__(8745);
6508
- 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 | 8 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6514
+ 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))]), [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6509
6515
  context
6510
6516
  }) => new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6511
6517
  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 */, ({
@@ -6630,7 +6636,6 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6630
6636
  } else if (source[position] !== '{') {
6631
6637
  (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */, head);
6632
6638
  } else {
6633
- context.state ^= 8 /* State.link */;
6634
6639
  if (!(0, combinator_1.isBacktrack)(context, 1 | 64 /* Backtrack.link */) && !(0, link_1.textlink)({
6635
6640
  context
6636
6641
  })) {
@@ -6638,7 +6643,6 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6638
6643
  }
6639
6644
  context.position = position;
6640
6645
  context.range = range;
6641
- context.state ^= 8 /* State.link */;
6642
6646
  }
6643
6647
  }
6644
6648
  return as.import(bs).import(cs);
@@ -6694,11 +6698,11 @@ const inline_1 = __webpack_require__(7973);
6694
6698
  const visibility_1 = __webpack_require__(6364);
6695
6699
  const util_1 = __webpack_require__(4992);
6696
6700
  const dom_1 = __webpack_require__(394);
6697
- 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], {
6701
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('~~', (0, combinator_1.surround)('', (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], {
6698
6702
  buffer
6699
6703
  }) => buffer.import(bs), ([, bs], {
6700
6704
  buffer
6701
- }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
6705
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
6702
6706
 
6703
6707
  /***/ },
6704
6708
 
@@ -6720,7 +6724,7 @@ const source_1 = __webpack_require__(8745);
6720
6724
  const visibility_1 = __webpack_require__(6364);
6721
6725
  const util_1 = __webpack_require__(4992);
6722
6726
  const dom_1 = __webpack_require__(394);
6723
- exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (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)('*'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
6727
+ exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*(?!\*)/y), (0, combinator_1.precedence)(0, (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, '*', visibility_1.afterNonblank), strong_1.strong]))))), (0, source_1.str)('*'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
6724
6728
 
6725
6729
  /***/ },
6726
6730
 
@@ -6743,12 +6747,12 @@ const source_1 = __webpack_require__(8745);
6743
6747
  const visibility_1 = __webpack_require__(6364);
6744
6748
  const util_1 = __webpack_require__(4992);
6745
6749
  const dom_1 = __webpack_require__(394);
6746
- const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (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)])));
6747
- const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([strong_1.strong, (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)])));
6750
+ const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank), emphasis_1.emphasis])));
6751
+ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank), strong_1.strong])));
6748
6752
  // 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
6749
6753
  // 可能な限り早く閉じるよう解析しなければならない。
6750
6754
  // このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
6751
- 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) => {
6755
+ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank)]))), (0, source_1.str)(/\*{1,3}/y), false, [], ([, bs, cs], context) => {
6752
6756
  const {
6753
6757
  buffer
6754
6758
  } = context;
@@ -6855,7 +6859,7 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
6855
6859
  nodes = prepend('*'.repeat(prefix - postfix), nodes);
6856
6860
  }
6857
6861
  return nodes;
6858
- })));
6862
+ }))));
6859
6863
  function prepend(prefix, nodes) {
6860
6864
  if (typeof nodes.head?.value === 'string') {
6861
6865
  nodes.head.value = prefix + nodes.head.value;
@@ -6907,19 +6911,14 @@ const dom_1 = __webpack_require__(394);
6907
6911
  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 | 4 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
6908
6912
  'data-index': dataindex(bs)
6909
6913
  }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
6910
- if (ns.length === 1) {
6911
- const el = ns.head.value;
6912
- return new parser_1.List([new parser_1.Node((0, dom_1.define)(el, {
6913
- id: el.id ? null : undefined,
6914
- class: 'index',
6915
- href: el.id ? `#${el.id}` : undefined
6916
- }))]);
6917
- } else {
6918
- ns.pop();
6919
- return ns;
6920
- }
6914
+ const el = ns.head.value;
6915
+ return new parser_1.List([new parser_1.Node((0, dom_1.define)(el, {
6916
+ id: el.id ? null : undefined,
6917
+ class: 'index',
6918
+ href: el.id ? `#${el.id}` : undefined
6919
+ }))]);
6921
6920
  })));
6922
- 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 | 16 /* Backtrack.escapable */], ([, ns], context) => {
6921
+ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}|])/y)]), ']')), /(?=])/y, false, [3 | 16 /* Backtrack.escapable */], ([, ns], context) => {
6923
6922
  const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6924
6923
  value
6925
6924
  }) => acc + value, ''))?.slice(7);
@@ -7316,11 +7315,11 @@ const inline_1 = __webpack_require__(7973);
7316
7315
  const visibility_1 = __webpack_require__(6364);
7317
7316
  const util_1 = __webpack_require__(4992);
7318
7317
  const dom_1 = __webpack_require__(394);
7319
- 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], {
7318
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('++', (0, combinator_1.surround)('', (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], {
7320
7319
  buffer
7321
7320
  }) => buffer.import(bs), ([, bs], {
7322
7321
  buffer
7323
- }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
7322
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
7324
7323
 
7325
7324
  /***/ },
7326
7325
 
@@ -7343,11 +7342,11 @@ const dom_1 = __webpack_require__(394);
7343
7342
  // 可読性のため実際にはオブリーク体を指定する。
7344
7343
  // 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
7345
7344
  // ある程度の長さのある文に使うのが望ましい。
7346
- 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], {
7345
+ exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '///', visibility_1.afterNonblank)), '///', false, [], ([, bs], {
7347
7346
  buffer
7348
7347
  }) => buffer.import(bs), ([, bs], {
7349
7348
  buffer
7350
- }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]))));
7349
+ }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))));
7351
7350
 
7352
7351
  /***/ },
7353
7352
 
@@ -7374,13 +7373,13 @@ const optspec = {
7374
7373
  rel: ['nofollow']
7375
7374
  };
7376
7375
  Object.setPrototypeOf(optspec, null);
7377
- 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 | 4 /* Backtrack.common */ | 64 /* Backtrack.link */, 2 | 32 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7376
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]]))), ']', true, [3 | 4 /* Backtrack.common */ | 64 /* Backtrack.link */, 2 | 32 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7378
7377
  if (context.linebreak !== 0) {
7379
7378
  const head = context.position - context.range;
7380
7379
  return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
7381
7380
  }
7382
7381
  return ns.push(new parser_1.Node("\u001F" /* Command.Separator */)) && ns;
7383
- })),
7382
+ })))),
7384
7383
  // `{ `と`{`で個別にバックトラックが発生し+1nされる。
7385
7384
  // 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
7386
7385
  (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.precedence)(9, (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.Node("\u0018" /* Command.Cancel */)) && as))]), ([{
@@ -7388,6 +7387,7 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
7388
7387
  }, {
7389
7388
  value: params = undefined
7390
7389
  } = {}], context) => {
7390
+ if (context.state & 8 /* State.link */) return new parser_1.List([new parser_1.Node(context.source.slice(context.position - context.range, context.position))]);
7391
7391
  if (content.last.value === "\u001F" /* Command.Separator */) {
7392
7392
  content.pop();
7393
7393
  if (params === undefined) {
@@ -7407,7 +7407,7 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
7407
7407
  }
7408
7408
  if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
7409
7409
  return new parser_1.List([new parser_1.Node(parse(content, params, context))]);
7410
- })))));
7410
+ }));
7411
7411
  exports.medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */ | 4 /* State.media */, (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.precedence)(9, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)])), / ?}/y))]), ([{
7412
7412
  value: content
7413
7413
  }, {
@@ -7523,21 +7523,23 @@ const indexee_1 = __webpack_require__(7610);
7523
7523
  const visibility_1 = __webpack_require__(6364);
7524
7524
  const util_1 = __webpack_require__(4992);
7525
7525
  const dom_1 = __webpack_require__(394);
7526
- 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], {
7526
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0, visibility_1.tightStart)((0, combinator_1.state)(2 /* State.mark */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '==', visibility_1.afterNonblank))), '==', false, [], ([, bs], {
7527
7527
  buffer
7528
7528
  }) => buffer.import(bs), ([, bs], {
7529
7529
  buffer
7530
7530
  }) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
7531
- id
7531
+ id,
7532
+ state
7532
7533
  }) => {
7533
7534
  const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
7535
+ if (state & 251 /* State.linkers */) return new parser_1.List([new parser_1.Node(el)]);
7534
7536
  (0, dom_1.define)(el, {
7535
7537
  id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
7536
7538
  });
7537
7539
  return el.id ? new parser_1.List([new parser_1.Node(el), new parser_1.Node((0, dom_1.html)('a', {
7538
7540
  href: `#${el.id}`
7539
7541
  }))]) : new parser_1.List([new parser_1.Node(el)]);
7540
- })))));
7542
+ }))));
7541
7543
 
7542
7544
  /***/ },
7543
7545
 
@@ -7857,11 +7859,11 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
7857
7859
  value: ruby = ''
7858
7860
  } = {}]) => acc.import(ruby ? new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rp', '(')), new parser_1.Node((0, dom_1.html)('rt', ruby)), new parser_1.Node((0, dom_1.html)('rp', ')'))]) : new parser_1.List([new parser_1.Node(text), new parser_1.Node((0, dom_1.html)('rt'))])), new parser_1.List())))))]);
7859
7861
  default:
7860
- return new parser_1.List([new parser_1.Node((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)(new parser_1.List([new parser_1.Node(texts.foldr(({
7862
+ return new parser_1.List([new parser_1.Node((0, dom_1.html)('ruby', (0, dom_1.defrag)((0, util_1.unwrap)(new parser_1.List([new parser_1.Node(texts.foldl((acc, {
7861
7863
  value
7862
- }, acc) => value + ' ' + acc, '').slice(0, -1)), new parser_1.Node((0, dom_1.html)('rp', '(')), new parser_1.Node((0, dom_1.html)('rt', rubies.foldr(({
7864
+ }) => acc ? acc + ' ' + value : value, '')), new parser_1.Node((0, dom_1.html)('rp', '(')), new parser_1.Node((0, dom_1.html)('rt', rubies.foldl((acc, {
7863
7865
  value
7864
- }, acc) => value + ' ' + acc, '').trim())), new parser_1.Node((0, dom_1.html)('rp', ')'))])))))]);
7866
+ }) => acc ? acc + ' ' + value : value, '').trim())), new parser_1.Node((0, dom_1.html)('rp', ')'))])))))]);
7865
7867
  }
7866
7868
  }));
7867
7869
  const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
@@ -7954,7 +7956,7 @@ const source_1 = __webpack_require__(8745);
7954
7956
  const visibility_1 = __webpack_require__(6364);
7955
7957
  const util_1 = __webpack_require__(4992);
7956
7958
  const dom_1 = __webpack_require__(394);
7957
- exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([emphasis_1.emphasis, (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)('**'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
7959
+ exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)(/\*\*(?!\*)/y), (0, combinator_1.precedence)(0, (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, '*', visibility_1.afterNonblank), emphasis_1.emphasis]))))), (0, source_1.str)('**'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
7958
7960
 
7959
7961
  /***/ },
7960
7962
 
@@ -8309,7 +8311,7 @@ const extension_1 = __webpack_require__(6193);
8309
8311
  const source_1 = __webpack_require__(8745);
8310
8312
  exports.MAX_SEGMENT_SIZE = 100_000; // 100,000 bytes (Max value size of FDB)
8311
8313
  exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
8312
- const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptyline), input => {
8314
+ const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptyline, exports.MAX_SEGMENT_SIZE + 1), input => {
8313
8315
  const {
8314
8316
  context: {
8315
8317
  source,
@@ -8335,7 +8337,7 @@ const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptylin
8335
8337
  case '$':
8336
8338
  return (0, extension_1.segment)(input);
8337
8339
  }
8338
- }, (0, combinator_1.some)(source_1.contentline)]);
8340
+ }, (0, combinator_1.some)(source_1.contentline, exports.MAX_SEGMENT_SIZE + 1)]);
8339
8341
  function* segment(source) {
8340
8342
  if (!validate(source, exports.MAX_INPUT_SIZE)) return yield `${"\u0007" /* Command.Error */}Too large input over ${exports.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`;
8341
8343
  for (let position = 0; position < source.length;) {
@@ -8456,7 +8458,8 @@ const escsource = ({
8456
8458
  }) => {
8457
8459
  const {
8458
8460
  source,
8459
- position
8461
+ position,
8462
+ state
8460
8463
  } = context;
8461
8464
  if (position === source.length) return;
8462
8465
  const char = source[position];
@@ -8486,7 +8489,7 @@ const escsource = ({
8486
8489
  return new parser_1.List([new parser_1.Node((0, dom_1.html)('br'))]);
8487
8490
  default:
8488
8491
  if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
8489
- let i = (0, text_1.next)(source, position, delimiter);
8492
+ let i = (0, text_1.next)(source, position, state, delimiter);
8490
8493
  i -= position;
8491
8494
  (0, combinator_1.consume)(i - 1, context);
8492
8495
  context.position += i - 1;
@@ -8618,7 +8621,8 @@ const text = input => {
8618
8621
  } = input;
8619
8622
  const {
8620
8623
  source,
8621
- position
8624
+ position,
8625
+ state
8622
8626
  } = context;
8623
8627
  if (position === source.length) return;
8624
8628
  const char = source[position];
@@ -8647,7 +8651,7 @@ const text = input => {
8647
8651
  if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
8648
8652
  exports.nonWhitespace.lastIndex = position + 1;
8649
8653
  const s = canSkip(source, position);
8650
- let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position);
8654
+ let i = s ? exports.nonWhitespace.test(source) ? exports.nonWhitespace.lastIndex - 1 : source.length : next(source, position, state);
8651
8655
  const lineend = false || s && i === source.length || s && source[i] === '\n';
8652
8656
  i -= position;
8653
8657
  i = lineend ? i : i - +s || 1;
@@ -8678,14 +8682,14 @@ function isWhitespace(char, linebreak) {
8678
8682
  return false;
8679
8683
  }
8680
8684
  }
8681
- function next(source, position, delimiter) {
8685
+ function next(source, position, state, delimiter) {
8682
8686
  let index;
8683
8687
  if (delimiter) {
8684
8688
  delimiter.lastIndex = position + 1;
8685
8689
  delimiter.test(source);
8686
8690
  index = delimiter.lastIndex;
8687
8691
  } else {
8688
- index = seek(source, position);
8692
+ index = seek(source, position, state);
8689
8693
  }
8690
8694
  if (index === 0) return source.length;
8691
8695
  const char = source[index];
@@ -8708,7 +8712,7 @@ function next(source, position, delimiter) {
8708
8712
  index = source.startsWith('//', index + 1) ? backToUrlHead(source, position, index) : index;
8709
8713
  break;
8710
8714
  case '@':
8711
- index = backToEmailHead(source, position, index);
8715
+ index = ~state & 1 /* State.autolink */ ? backToEmailHead(source, position, index) : index;
8712
8716
  break;
8713
8717
  }
8714
8718
  return index;
@@ -8803,15 +8807,13 @@ exports.isAlphanumeric = isAlphanumeric;
8803
8807
  // this[c.charCodeAt(0)] = undefined);
8804
8808
  // }
8805
8809
  //};
8806
- function seek(source, position) {
8810
+ function seek(source, position, state) {
8807
8811
  for (let i = position + 1; i < source.length; ++i) {
8808
8812
  const fst = source[i];
8809
8813
  //if (fst.charCodeAt(0) in dict) return i;
8810
8814
  switch (fst) {
8811
8815
  case '\\':
8812
8816
  case '!':
8813
- case '@':
8814
- case '#':
8815
8817
  case '$':
8816
8818
  case '"':
8817
8819
  case '`':
@@ -8834,6 +8836,10 @@ function seek(source, position) {
8834
8836
  case '\r':
8835
8837
  case '\n':
8836
8838
  return i;
8839
+ case '@':
8840
+ case '#':
8841
+ if (~state & 1 /* State.autolink */) return i;
8842
+ continue;
8837
8843
  case '+':
8838
8844
  case '~':
8839
8845
  case '=':
@@ -8903,7 +8909,8 @@ const unescsource = ({
8903
8909
  }) => {
8904
8910
  const {
8905
8911
  source,
8906
- position
8912
+ position,
8913
+ state
8907
8914
  } = context;
8908
8915
  if (position === source.length) return;
8909
8916
  const char = source[position];
@@ -8922,7 +8929,7 @@ const unescsource = ({
8922
8929
  default:
8923
8930
  if (context.sequential) return new parser_1.List([new parser_1.Node(char)]);
8924
8931
  text_1.nonWhitespace.lastIndex = position + 1;
8925
- let i = (0, text_1.canSkip)(source, position) ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, exports.delimiter);
8932
+ let i = (0, text_1.canSkip)(source, position) ? text_1.nonWhitespace.test(source) ? text_1.nonWhitespace.lastIndex - 1 : source.length : (0, text_1.next)(source, position, state, exports.delimiter);
8926
8933
  i -= position;
8927
8934
  (0, combinator_1.consume)(i - 1, context);
8928
8935
  context.position += i - 1;
@@ -9074,7 +9081,7 @@ exports.stringify = stringify;
9074
9081
  Object.defineProperty(exports, "__esModule", ({
9075
9082
  value: true
9076
9083
  }));
9077
- exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isTightNodeStart = exports.isLooseNodeStart = exports.tightStart = exports.blankWith = exports.visualize = void 0;
9084
+ exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlankStart = exports.trimBlank = exports.isTightNodeStart = exports.isLooseNodeStart = exports.tightStart = exports.blankWith = exports.afterNonblank = exports.visualize = void 0;
9078
9085
  const parser_1 = __webpack_require__(605);
9079
9086
  const combinator_1 = __webpack_require__(3484);
9080
9087
  const htmlentity_1 = __webpack_require__(470);
@@ -9088,14 +9095,17 @@ function visualize(parser) {
9088
9095
  return (0, combinator_1.convert)(source => source.replace(blank.line, `$1${"\u001B" /* Command.Escape */}$2`), parser);
9089
9096
  }
9090
9097
  exports.visualize = visualize;
9098
+ exports.afterNonblank = nonblankWith('');
9091
9099
  function blankWith(starts, delimiter) {
9092
- if (delimiter === undefined) return blankWith('', starts);
9093
- return new RegExp(String.raw`(?:(?=${starts})(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr ?>)${
9100
+ return new RegExp([
9094
9101
  // 空行除去
9095
9102
  // 完全な空行はエスケープ済みなので再帰的バックトラックにはならない。
9096
- starts && '+'})?${typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source}`, 'y');
9103
+ String.raw`(?:${starts}(?:\\?\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr ?>)*)?`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
9097
9104
  }
9098
9105
  exports.blankWith = blankWith;
9106
+ function nonblankWith(delimiter) {
9107
+ return new RegExp([String.raw`(?<!\s|&(?:${normalize_1.invisibleHTMLEntityNames.join('|')});|<wbr ?>)`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
9108
+ }
9099
9109
  function tightStart(parser, except) {
9100
9110
  return input => isTightStart(input, except) ? parser(input) : undefined;
9101
9111
  }
package/markdown.d.ts CHANGED
@@ -714,7 +714,7 @@ export namespace MarkdownParser {
714
714
  // [#index]
715
715
  // [#index|signature]
716
716
  Inline<'extension/index'>,
717
- Parser<string | HTMLElement, Context, [
717
+ Parser<HTMLAnchorElement, Context, [
718
718
  InlineParser,
719
719
  IndexParser.SignatureParser,
720
720
  ]> {
@@ -767,7 +767,7 @@ export namespace MarkdownParser {
767
767
  // { uri }
768
768
  // [abc]{uri nofollow}
769
769
  Inline<'link'>,
770
- Parser<HTMLAnchorElement | HTMLSpanElement, Context, [
770
+ Parser<HTMLAnchorElement | HTMLSpanElement | string, Context, [
771
771
  LinkParser.MediaLinkParser,
772
772
  LinkParser.TextLinkParser,
773
773
  ]> {
@@ -775,7 +775,7 @@ export namespace MarkdownParser {
775
775
  export namespace LinkParser {
776
776
  export interface TextLinkParser extends
777
777
  Inline<'link/textlink'>,
778
- Parser<HTMLAnchorElement | HTMLSpanElement, Context, [
778
+ Parser<HTMLAnchorElement | HTMLSpanElement | string, Context, [
779
779
  Parser<List<Node<string | HTMLElement>>, Context, [
780
780
  InlineParser,
781
781
  ]>,
@@ -959,7 +959,6 @@ export namespace MarkdownParser {
959
959
  Inline<'mark'>,
960
960
  Parser<HTMLElement | string, Context, [
961
961
  InlineParser,
962
- InlineParser,
963
962
  ]> {
964
963
  }
965
964
  export interface EmStrongParser extends
@@ -967,25 +966,22 @@ export namespace MarkdownParser {
967
966
  Inline<'emstrong'>,
968
967
  Parser<HTMLElement | string, Context, [
969
968
  InlineParser,
970
- InlineParser,
971
969
  ]> {
972
970
  }
973
971
  export interface StrongParser extends
974
972
  // **abc**
975
973
  Inline<'strong'>,
976
974
  Parser<HTMLElement | string, Context, [
977
- EmphasisParser,
978
- InlineParser,
979
975
  InlineParser,
976
+ EmphasisParser,
980
977
  ]> {
981
978
  }
982
979
  export interface EmphasisParser extends
983
980
  // *abc*
984
981
  Inline<'emphasis'>,
985
982
  Parser<HTMLElement | string, Context, [
986
- StrongParser,
987
- InlineParser,
988
983
  InlineParser,
984
+ StrongParser,
989
985
  ]> {
990
986
  }
991
987
  export interface ItalicParser extends
@@ -993,7 +989,6 @@ export namespace MarkdownParser {
993
989
  Inline<'italic'>,
994
990
  Parser<HTMLElement | string, Context, [
995
991
  InlineParser,
996
- InlineParser,
997
992
  ]> {
998
993
  }
999
994
  export interface MathParser extends
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.295.4",
3
+ "version": "0.295.6",
4
4
  "description": "Secure markdown renderer working on browsers for user input data.",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/falsandtru/securemark",
@@ -27,14 +27,17 @@ export class Delimiters {
27
27
  return `r/${pattern.source}`;
28
28
  }
29
29
  }
30
- public static matcher(pattern: string | RegExp | undefined): (input: Input<Context>) => true | undefined {
30
+ public static matcher(pattern: string | RegExp | undefined, after?: string | RegExp): (input: Input<Context>) => true | undefined {
31
31
  switch (typeof pattern) {
32
32
  case 'undefined':
33
33
  return () => undefined;
34
34
  case 'string':
35
35
  case 'object':
36
36
  const match = matcher(pattern, false);
37
- return input => match(input) !== undefined || undefined;
37
+ const verify = after ? matcher(after, false) : undefined;
38
+ return verify
39
+ ? input => match(input) !== undefined && verify(input) !== undefined || undefined
40
+ : input => match(input) !== undefined || undefined;
38
41
  }
39
42
  }
40
43
  private readonly tree: Record<number, Delimiter[]> = {};