securemark 0.259.0 → 0.259.1

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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.259.1
4
+
5
+ - Refactoring.
6
+
3
7
  ## 0.259.0
4
8
 
5
9
  - Extend cite syntax to accept URL.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.259.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.259.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory(require("DOMPurify"), require("Prism"));
@@ -2855,36 +2855,34 @@ function apply(parser, source, context, changes, values) {
2855
2855
  return result;
2856
2856
  }
2857
2857
 
2858
- function syntax(syntax, precedence, cost, parser) {
2859
- return creation(cost, (source, context) => {
2858
+ function syntax(syntax, prec, cost, state, parser) {
2859
+ return creation(cost, precedence(prec, (source, context) => {
2860
2860
  if (source === '') return;
2861
2861
  const memo = context.memo ??= new memo_1.Memo();
2862
2862
  context.memorable ??= ~0;
2863
- const p = context.precedence;
2864
- context.precedence = precedence;
2865
2863
  const position = source.length;
2866
- const state = context.state ?? 0;
2867
- const cache = syntax && memo.get(position, syntax, state);
2864
+ const st0 = context.state ?? 0;
2865
+ const st1 = context.state = st0 | state;
2866
+ const cache = syntax && memo.get(position, syntax, st1);
2868
2867
  const result = cache ? cache.length === 0 ? global_1.undefined : [cache[0], source.slice(cache[1])] : parser(source, context);
2869
2868
 
2870
- if (syntax && state & context.memorable) {
2871
- cache ?? memo.set(position, syntax, state, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
2869
+ if (syntax && st0 & context.memorable) {
2870
+ cache ?? memo.set(position, syntax, st1, (0, parser_1.eval)(result), source.length - (0, parser_1.exec)(result, '').length);
2872
2871
  }
2873
2872
 
2874
- if (result && !state && memo.length >= position) {
2875
- memo.clear(position);
2873
+ if (result && !st0 && memo.length >= position + 2) {
2874
+ memo.clear(position + 2);
2876
2875
  }
2877
2876
 
2878
- context.precedence = p;
2877
+ context.state = st0;
2879
2878
  return result;
2880
- });
2879
+ }));
2881
2880
  }
2882
2881
 
2883
2882
  exports.syntax = syntax;
2884
2883
 
2885
2884
  function creation(cost, parser) {
2886
2885
  if (typeof cost === 'function') return creation(1, cost);
2887
- if (cost === 0) return parser;
2888
2886
  return (source, context) => {
2889
2887
  const {
2890
2888
  resources = {
@@ -3459,8 +3457,6 @@ const header_1 = __webpack_require__(5702);
3459
3457
 
3460
3458
  const block_1 = __webpack_require__(4032);
3461
3459
 
3462
- const context_1 = __webpack_require__(6484);
3463
-
3464
3460
  const normalize_1 = __webpack_require__(185);
3465
3461
 
3466
3462
  const header_2 = __webpack_require__(7790);
@@ -3476,7 +3472,9 @@ const array_1 = __webpack_require__(8112);
3476
3472
  function bind(target, settings) {
3477
3473
  let context = { ...settings,
3478
3474
  host: settings.host ?? new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
3479
- memorable: context_1.backtrackable
3475
+ memorable: 118
3476
+ /* State.backtrackable */
3477
+
3480
3478
  };
3481
3479
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3482
3480
  const blocks = [];
@@ -3810,8 +3808,6 @@ const header_1 = __webpack_require__(5702);
3810
3808
 
3811
3809
  const block_1 = __webpack_require__(4032);
3812
3810
 
3813
- const context_1 = __webpack_require__(6484);
3814
-
3815
3811
  const normalize_1 = __webpack_require__(185);
3816
3812
 
3817
3813
  const header_2 = __webpack_require__(7790);
@@ -3836,7 +3832,9 @@ function parse(source, opts = {}, context) {
3836
3832
  ...(context?.resources && {
3837
3833
  resources: context.resources
3838
3834
  }),
3839
- memorable: context_1.backtrackable
3835
+ memorable: 118
3836
+ /* State.backtrackable */
3837
+
3840
3838
  };
3841
3839
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
3842
3840
  const node = (0, dom_1.frag)();
@@ -5511,30 +5509,6 @@ function format(el) {
5511
5509
 
5512
5510
  /***/ }),
5513
5511
 
5514
- /***/ 6484:
5515
- /***/ ((__unused_webpack_module, exports) => {
5516
-
5517
- "use strict";
5518
-
5519
-
5520
- Object.defineProperty(exports, "__esModule", ({
5521
- value: true
5522
- }));
5523
- exports.backtrackable = void 0;
5524
- exports.backtrackable = 0 | 64
5525
- /* State.annotation */
5526
- | 32
5527
- /* State.reference */
5528
- | 16
5529
- /* State.index */
5530
- | 4
5531
- /* State.link */
5532
- | 2
5533
- /* State.media */
5534
- ;
5535
-
5536
- /***/ }),
5537
-
5538
5512
  /***/ 5702:
5539
5513
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
5540
5514
 
@@ -5705,15 +5679,15 @@ const dom_1 = __webpack_require__(3252);
5705
5679
 
5706
5680
  exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('((', (0, combinator_1.constraint)(64
5707
5681
  /* State.annotation */
5708
- , false, (0, combinator_1.state)(64
5682
+ , false, (0, combinator_1.syntax)(32
5683
+ /* Syntax.annotation */
5684
+ , 6, 1, 64
5709
5685
  /* State.annotation */
5710
5686
  | 2
5711
5687
  /* State.media */
5712
- , (0, combinator_1.syntax)(32
5713
- /* Syntax.annotation */
5714
- , 6, 1, (0, visibility_1.startLoose)((0, combinator_1.context)({
5688
+ , (0, visibility_1.startLoose)((0, combinator_1.context)({
5715
5689
  delimiters: global_1.undefined
5716
- }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5690
+ }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')'))), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5717
5691
  class: 'annotation'
5718
5692
  }, [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
5719
5693
 
@@ -5754,7 +5728,9 @@ exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-
5754
5728
  /* State.autolink */
5755
5729
  , false, (0, combinator_1.syntax)(2
5756
5730
  /* Syntax.autolink */
5757
- , 1, 1, (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5731
+ , 1, 1, 0
5732
+ /* State.none */
5733
+ , (0, combinator_1.some)((0, combinator_1.union)([url_1.url, email_1.email, // Escape unmatched email-like strings.
5758
5734
  (0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*(?:@(?:[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)*/), channel_1.channel, account_1.account, // Escape unmatched account-like strings.
5759
5735
  (0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), // Escape invalid leading characters.
5760
5736
  (0, source_1.str)(new RegExp(/^(?:[^\p{C}\p{S}\p{P}\s]|emoji|['_])(?=#)/u.source.replace('emoji', hashtag_1.emoji), 'u')), hashtag_1.hashtag, hashnum_1.hashnum, // Escape unmatched hashtag-like strings.
@@ -5982,24 +5958,38 @@ const array_1 = __webpack_require__(8112);
5982
5958
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5983
5959
  exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(0
5984
5960
  /* Syntax.none */
5985
- , 2, 1, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
5961
+ , 2, 1, 0
5962
+ /* State.none */
5963
+ , (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
5986
5964
  /* Syntax.bracket */
5987
- , 2, 1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5965
+ , 2, 1, 0
5966
+ /* State.none */
5967
+ , (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5988
5968
  class: 'paren'
5989
5969
  }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(0
5990
5970
  /* Syntax.none */
5991
- , 2, 1, (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
5971
+ , 2, 1, 0
5972
+ /* State.none */
5973
+ , (0, source_1.str)(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.syntax)(128
5992
5974
  /* Syntax.bracket */
5993
- , 2, 1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5975
+ , 2, 1, 0
5976
+ /* State.none */
5977
+ , (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5994
5978
  class: 'paren'
5995
5979
  }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.syntax)(128
5996
5980
  /* Syntax.bracket */
5997
- , 2, 1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.syntax)(128
5981
+ , 2, 1, 0
5982
+ /* State.none */
5983
+ , (0, combinator_1.some)(inline_1.inline, ']', [[']', 2]])), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)([''], (0, array_1.unshift)(as, bs)), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.syntax)(128
5998
5984
  /* Syntax.bracket */
5999
- , 2, 1, (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
5985
+ , 2, 1, 0
5986
+ /* State.none */
5987
+ , (0, combinator_1.some)(inline_1.inline, '}', [['}', 2]])), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), // Control media blinking in editing rather than control confusion of pairs of quote marks.
6000
5988
  (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.syntax)(1
6001
5989
  /* Syntax.quote */
6002
- , 8, 1, (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
5990
+ , 8, 1, 0
5991
+ /* State.none */
5992
+ , (0, combinator_1.some)(inline_1.inline, '"', [['"', 8]])), (0, source_1.str)('"'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest])]));
6003
5993
 
6004
5994
  /***/ }),
6005
5995
 
@@ -6053,7 +6043,9 @@ const array_1 = __webpack_require__(8112);
6053
6043
 
6054
6044
  exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[%', (0, combinator_1.syntax)(0
6055
6045
  /* Syntax.none */
6056
- , 4, 1, (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
6046
+ , 4, 1, 0
6047
+ /* State.none */
6048
+ , (0, combinator_1.match)(/^\[(%+)\s/, (0, memoize_1.memoize)(([, fence]) => (0, combinator_1.surround)((0, combinator_1.open)((0, source_1.str)(`[${fence}`), (0, combinator_1.some)(source_1.text, new RegExp(String.raw`^\s+${fence}\]|^\S`)), true), (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), new RegExp(String.raw`^\s+${fence}\]`), [[new RegExp(String.raw`^\s+${fence}\]`), 4]]), (0, combinator_1.close)((0, combinator_1.some)(source_1.text, /^\S/), (0, source_1.str)(`${fence}]`)), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
6057
6049
  class: 'comment'
6058
6050
  }, [(0, dom_1.html)('input', {
6059
6051
  type: 'checkbox'
@@ -6086,7 +6078,9 @@ const array_1 = __webpack_require__(8112);
6086
6078
 
6087
6079
  exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.syntax)(0
6088
6080
  /* Syntax.none */
6089
- , 1, 1, (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)]))), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6081
+ , 1, 1, 0
6082
+ /* State.none */
6083
+ , (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)]))), (0, source_1.str)('~~'), false, ([, bs], rest) => [[(0, dom_1.html)('del', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6090
6084
 
6091
6085
  /***/ }),
6092
6086
 
@@ -6119,7 +6113,9 @@ const array_1 = __webpack_require__(8112);
6119
6113
 
6120
6114
  exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*'), (0, combinator_1.syntax)(0
6121
6115
  /* Syntax.none */
6122
- , 1, 1, (0, visibility_1.startTight)((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, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*')), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6116
+ , 1, 1, 0
6117
+ /* State.none */
6118
+ , (0, visibility_1.startTight)((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, '*'), (0, combinator_1.union)([emstrong_1.emstrong, strong_1.strong, exports.emphasis]))])), '*')), (0, source_1.str)('*'), false, ([, bs], rest) => [[(0, dom_1.html)('em', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6123
6119
 
6124
6120
  /***/ }),
6125
6121
 
@@ -6154,7 +6150,9 @@ const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combin
6154
6150
  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, '*'), (0, combinator_1.union)([exports.emstrong, strong_1.strong, emphasis_1.emphasis]))])));
6155
6151
  exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('***'), (0, combinator_1.syntax)(0
6156
6152
  /* Syntax.none */
6157
- , 1, 1, (0, visibility_1.startTight)((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}/), false, ([, bs, cs], rest, context) => {
6153
+ , 1, 1, 0
6154
+ /* State.none */
6155
+ , (0, visibility_1.startTight)((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}/), false, ([, bs, cs], rest, context) => {
6158
6156
  switch (cs[0]) {
6159
6157
  case '***':
6160
6158
  return [[(0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))])], rest];
@@ -6257,23 +6255,11 @@ const dom_1 = __webpack_require__(3252);
6257
6255
 
6258
6256
  exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.constraint)(16
6259
6257
  /* State.index */
6260
- , false, (0, combinator_1.state)(64
6261
- /* State.annotation */
6262
- | 32
6263
- /* State.reference */
6264
- | 16
6265
- /* State.index */
6266
- | 8
6267
- /* State.label */
6268
- | 4
6269
- /* State.link */
6270
- | 2
6271
- /* State.media */
6272
- | 1
6273
- /* State.autolink */
6274
- , (0, combinator_1.syntax)(1024
6258
+ , false, (0, combinator_1.syntax)(1024
6275
6259
  /* Syntax.index */
6276
- , 2, 1, (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true))))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
6260
+ , 2, 1, 127
6261
+ /* State.linkable */
6262
+ , (0, visibility_1.startTight)((0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, visibility_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
6277
6263
  id: el.id ? null : global_1.undefined,
6278
6264
  class: 'index',
6279
6265
  href: el.id ? `#${el.id}` : global_1.undefined
@@ -6476,7 +6462,9 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6476
6462
 
6477
6463
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, combinator_1.syntax)(0
6478
6464
  /* Syntax.none */
6479
- , 2, 1, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]))), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6465
+ , 2, 1, 0
6466
+ /* State.none */
6467
+ , (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]))), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6480
6468
  class: 'invalid',
6481
6469
  'data-invalid-syntax': 'extension',
6482
6470
  'data-invalid-type': 'syntax',
@@ -6524,7 +6512,9 @@ global_1.Object.setPrototypeOf(attrspecs, null);
6524
6512
  global_1.Object.values(attrspecs).forEach(o => global_1.Object.setPrototypeOf(o, null));
6525
6513
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/i, (0, combinator_1.syntax)(0
6526
6514
  /* Syntax.none */
6527
- , 5, 1, (0, combinator_1.union)([(0, combinator_1.focus)(/^<wbr[^\S\n]*>/i, () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.surround)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6515
+ , 5, 1, 0
6516
+ /* State.none */
6517
+ , (0, combinator_1.union)([(0, combinator_1.focus)(/^<wbr[^\S\n]*>/i, () => [[(0, dom_1.html)('wbr')], '']), (0, combinator_1.surround)( // https://html.spec.whatwg.org/multipage/syntax.html#void-elements
6528
6518
  (0, source_1.str)(/^<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[^\S\n]|>)/i), (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), (0, source_1.str)(/^[^\S\n]*>/), true, ([as, bs = [], cs], rest) => [[elem(as[0].slice(1), (0, array_1.push)((0, array_1.unshift)(as, bs), cs), [], [])], rest]), (0, combinator_1.match)(new RegExp(String.raw`^<(${TAGS.join('|')})(?=[^\S\n]|>)`), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)((0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`), [[(0, visibility_1.blankWith)('\n', `</${tag}>`), 5]]), true))]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => TAGS.indexOf(tag), [])), (0, combinator_1.match)(/^<([a-z]+)(?=[^\S\n]|>)/i, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^[^\S\n]*>/), true), (0, combinator_1.subsequence)([(0, combinator_1.focus)(/^[^\S\n]*\n/, (0, combinator_1.some)(inline_1.inline)), (0, combinator_1.some)(inline_1.inline, `</${tag}>`, [[`</${tag}>`, 5]])]), (0, source_1.str)(`</${tag}>`), true, ([as, bs = [], cs], rest) => [[elem(tag, as, bs, cs)], rest], ([as, bs = []], rest) => [[elem(tag, as, bs, [])], rest]), ([, tag]) => tag, new cache_1.Cache(10000)))])))));
6529
6519
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/i)]); // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
6530
6520
  // [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
@@ -6641,7 +6631,9 @@ const array_1 = __webpack_require__(8112);
6641
6631
 
6642
6632
  exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.syntax)(0
6643
6633
  /* Syntax.none */
6644
- , 1, 1, (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)]))), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6634
+ , 1, 1, 0
6635
+ /* State.none */
6636
+ , (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)]))), (0, source_1.str)('++'), false, ([, bs], rest) => [[(0, dom_1.html)('ins', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6645
6637
 
6646
6638
  /***/ }),
6647
6639
 
@@ -6685,23 +6677,11 @@ Object.setPrototypeOf(optspec, null);
6685
6677
  exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.union)([medialink, textlink])));
6686
6678
  const textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
6687
6679
  /* State.link */
6688
- , false, (0, combinator_1.state)(4
6689
- /* State.link */
6690
- | 2
6691
- /* State.media */
6692
- | 64
6693
- /* State.annotation */
6694
- | 32
6695
- /* State.reference */
6696
- | 16
6697
- /* State.index */
6698
- | 8
6699
- /* State.label */
6700
- | 1
6701
- /* State.autolink */
6702
- , (0, combinator_1.syntax)(256
6680
+ , false, (0, combinator_1.syntax)(256
6703
6681
  /* Syntax.link */
6704
- , 2, 10, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => {
6682
+ , 2, 10, 127
6683
+ /* State.linkable */
6684
+ , (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => {
6705
6685
  if (content.length !== 0 && (0, visibility_1.trimNode)(content).length === 0) return;
6706
6686
 
6707
6687
  for (let source = (0, util_1.stringify)(content); source;) {
@@ -6713,26 +6693,18 @@ const textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
6713
6693
  }
6714
6694
 
6715
6695
  return parse(content, params, rest, context);
6716
- })))));
6696
+ }))));
6717
6697
  const medialink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4
6718
6698
  /* State.link */
6719
6699
  | 2
6720
6700
  /* State.media */
6721
- , false, (0, combinator_1.state)(4
6722
- /* State.link */
6723
- | 64
6724
- /* State.annotation */
6725
- | 32
6726
- /* State.reference */
6727
- | 16
6728
- /* State.index */
6729
- | 8
6730
- /* State.label */
6731
- | 1
6732
- /* State.autolink */
6733
- , (0, combinator_1.syntax)(256
6701
+ , false, (0, combinator_1.syntax)(256
6734
6702
  /* Syntax.link */
6735
- , 2, 10, (0, combinator_1.bind)((0, combinator_1.reverse)((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)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => parse(content, params, rest, context))))));
6703
+ , 2, 10, 127
6704
+ /* State.linkable */
6705
+ ^ 2
6706
+ /* State.media */
6707
+ , (0, combinator_1.bind)((0, combinator_1.reverse)((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)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => parse(content, params, rest, context)))));
6736
6708
  exports.unsafelink = (0, combinator_1.lazy)(() => (0, combinator_1.creation)(10, (0, combinator_1.precedence)(2, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([source_1.unescsource]), ']'), ']')), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))])), ([params, content = []], rest, context) => parse(content, params, rest, context)))));
6737
6709
  exports.uri = (0, combinator_1.union)([(0, combinator_1.open)(/^[^\S\n]+/, (0, source_1.str)(/^\S+/)), (0, source_1.str)(/^[^\s{}]+/)]);
6738
6710
  exports.option = (0, combinator_1.union)([(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]), (0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/), (0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\s{}]+/), opt => [` \\${opt.slice(1)}`])]);
@@ -6845,7 +6817,9 @@ const array_1 = __webpack_require__(8112);
6845
6817
 
6846
6818
  exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('=='), (0, combinator_1.syntax)(0
6847
6819
  /* Syntax.none */
6848
- , 1, 1, (0, visibility_1.startTight)((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, '='), exports.mark)])))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6820
+ , 1, 1, 0
6821
+ /* State.none */
6822
+ , (0, visibility_1.startTight)((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, '='), exports.mark)])))), (0, source_1.str)('=='), false, ([, bs], rest) => [[(0, dom_1.html)('mark', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
6849
6823
 
6850
6824
  /***/ }),
6851
6825
 
@@ -6926,7 +6900,9 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '
6926
6900
  /* State.media */
6927
6901
  , false, (0, combinator_1.syntax)(64
6928
6902
  /* Syntax.media */
6929
- , 2, 10, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6903
+ , 2, 10, 0
6904
+ /* State.none */
6905
+ , (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [[/^\\?\n/, 9]]), ']', true)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6930
6906
  const INSECURE_URI = params.shift();
6931
6907
  const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? global_1.location, context.url ?? context.host ?? global_1.location), context.host?.href || global_1.location.href);
6932
6908
  let cache;
@@ -7024,17 +7000,17 @@ const dom_1 = __webpack_require__(3252);
7024
7000
 
7025
7001
  exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('[[', (0, combinator_1.constraint)(32
7026
7002
  /* State.reference */
7027
- , false, (0, combinator_1.state)(64
7003
+ , false, (0, combinator_1.syntax)(4096
7004
+ /* Syntax.reference */
7005
+ , 6, 1, 64
7028
7006
  /* State.annotation */
7029
7007
  | 32
7030
7008
  /* State.reference */
7031
7009
  | 2
7032
7010
  /* State.media */
7033
- , (0, combinator_1.syntax)(4096
7034
- /* Syntax.reference */
7035
- , 6, 1, (0, visibility_1.startLoose)((0, combinator_1.context)({
7011
+ , (0, visibility_1.startLoose)((0, combinator_1.context)({
7036
7012
  delimiters: global_1.undefined
7037
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']')))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
7013
+ }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])])), ']'))), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, visibility_1.trimNode)((0, dom_1.defrag)(ns)))])], rest]));
7038
7014
  const abbr = (0, combinator_1.creation)((0, combinator_1.bind)((0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?![0-9]+\s?[|\]])[0-9A-Za-z]+(?:(?:-|(?=\W)(?!'\d)'?(?!\.\d)\.?(?!,\S),? ?)[0-9A-Za-z]+)*(?:-|'?\.?,? ?)?/)]), /^\|?(?=]])|^\|[^\S\n]*/), ([source], rest) => [[(0, dom_1.html)('abbr', source)], rest.replace(visibility_1.regBlankStart, '')]));
7039
7015
 
7040
7016
  function attributes(ns) {
@@ -7082,7 +7058,9 @@ const array_1 = __webpack_require__(8112);
7082
7058
 
7083
7059
  exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[', (0, combinator_1.syntax)(0
7084
7060
  /* Syntax.none */
7085
- , 2, 1, (0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')')]), ([texts]) => (0, visibility_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
7061
+ , 2, 1, 0
7062
+ /* State.none */
7063
+ , (0, combinator_1.fmap)((0, combinator_1.verify)((0, combinator_1.sequence)([(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'), (0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')')]), ([texts]) => (0, visibility_1.isStartTightNodes)(texts)), ([texts, rubies]) => {
7086
7064
  texts[texts.length - 1] === '' && texts.pop();
7087
7065
 
7088
7066
  switch (true) {
@@ -7204,7 +7182,9 @@ const array_1 = __webpack_require__(8112);
7204
7182
 
7205
7183
  exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**'), (0, combinator_1.syntax)(0
7206
7184
  /* Syntax.none */
7207
- , 1, 1, (0, visibility_1.startTight)((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, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*')), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
7185
+ , 1, 1, 0
7186
+ /* State.none */
7187
+ , (0, visibility_1.startTight)((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, '*'), (0, combinator_1.union)([emstrong_1.emstrong, exports.strong]))])), '*')), (0, source_1.str)('**'), false, ([, bs], rest) => [[(0, dom_1.html)('strong', (0, dom_1.defrag)(bs))], rest], ([as, bs], rest) => [(0, array_1.unshift)(as, bs), rest]));
7208
7188
 
7209
7189
  /***/ }),
7210
7190
 
@@ -7231,7 +7211,9 @@ const array_1 = __webpack_require__(8112);
7231
7211
 
7232
7212
  exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.syntax)(0
7233
7213
  /* Syntax.none */
7234
- , 2, 1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
7214
+ , 2, 1, 0
7215
+ /* State.none */
7216
+ , (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
7235
7217
  class: 'template'
7236
7218
  }, `{{${ns.join('').replace(/\x1B/g, '')}}}`)], rest]));
7237
7219
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creation)((0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')'), (0, source_1.str)(')'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']'), (0, source_1.str)(']'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), (0, source_1.str)('}'), true, global_1.undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.escsource, /^"|^\\?\n/)), (0, source_1.str)('"'), true)])));
@@ -8009,7 +7991,9 @@ exports.nonAlphanumeric = /[^0-9A-Za-z]|\S[#>]|$/;
8009
7991
  const repeat = (0, str_1.str)(/^(.)\1*/);
8010
7992
  exports.text = (0, combinator_1.syntax)(0
8011
7993
  /* Syntax.none */
8012
- , 1, 1, (source, context) => {
7994
+ , 1, 1, 0
7995
+ /* State.none */
7996
+ , (source, context) => {
8013
7997
  if (source === '') return;
8014
7998
  const i = source.search(exports.delimiter);
8015
7999
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.259.0",
3
+ "version": "0.259.1",
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",
@@ -56,41 +56,39 @@ function apply<T>(parser: Parser<T>, source: string, context: Ctx, changes: [str
56
56
  return result;
57
57
  }
58
58
 
59
- export function syntax<P extends Parser<unknown>>(syntax: number, precedence: number, cost: number, parser: P): P;
60
- export function syntax<T>(syntax: number, precedence: number, cost: number, parser?: Parser<T>): Parser<T> {
61
- return creation(cost, (source, context) => {
59
+ export function syntax<P extends Parser<unknown>>(syntax: number, precedence: number, cost: number, state: number, parser: P): P;
60
+ export function syntax<T>(syntax: number, prec: number, cost: number, state: number, parser?: Parser<T>): Parser<T> {
61
+ return creation(cost, precedence(prec, (source, context) => {
62
62
  if (source === '') return;
63
63
  const memo = context.memo ??= new Memo();
64
64
  context.memorable ??= ~0;
65
- const p = context.precedence;
66
- context.precedence = precedence;
67
65
  const position = source.length;
68
- const state = context.state ?? 0;
69
- const cache = syntax && memo.get(position, syntax, state);
66
+ const st0 = context.state ?? 0;
67
+ const st1 = context.state = st0 | state;
68
+ const cache = syntax && memo.get(position, syntax, st1);
70
69
  const result: Result<T> = cache
71
70
  ? cache.length === 0
72
71
  ? undefined
73
72
  : [cache[0], source.slice(cache[1])]
74
73
  : parser!(source, context);
75
- if (syntax && state & context.memorable!) {
76
- cache ?? memo.set(position, syntax, state, eval(result), source.length - exec(result, '').length);
77
- assert.deepStrictEqual(cache && cache, cache && memo.get(position, syntax, state));
74
+ if (syntax && st0 & context.memorable!) {
75
+ cache ?? memo.set(position, syntax, st1, eval(result), source.length - exec(result, '').length);
76
+ assert.deepStrictEqual(cache && cache, cache && memo.get(position, syntax, st1));
78
77
  }
79
- if (result && !state && memo.length! >= position) {
80
- assert(!(state & context.memorable!));
81
- memo.clear(position);
78
+ if (result && !st0 && memo.length! >= position + 2) {
79
+ assert(!(st0 & context.memorable!));
80
+ memo.clear(position + 2);
82
81
  }
83
- context.precedence = p;
82
+ context.state = st0;
84
83
  return result;
85
- });
84
+ }));
86
85
  }
87
86
 
88
87
  export function creation<P extends Parser<unknown>>(parser: P): P;
89
88
  export function creation<P extends Parser<unknown>>(cost: number, parser: P): P;
90
89
  export function creation(cost: number | Parser<unknown>, parser?: Parser<unknown>): Parser<unknown> {
91
90
  if (typeof cost === 'function') return creation(1, cost);
92
- if (cost === 0) return parser!;
93
- assert(cost >= 0);
91
+ assert(cost > 0);
94
92
  return (source, context) => {
95
93
  const { resources = { clock: 1, recursion: 1 } } = context;
96
94
  if (resources.clock <= 0) throw new Error('Too many creations');
@@ -107,6 +105,7 @@ export function creation(cost: number | Parser<unknown>, parser?: Parser<unknown
107
105
 
108
106
  export function precedence<P extends Parser<unknown>>(precedence: number, parser: P): P;
109
107
  export function precedence<T>(precedence: number, parser: Parser<T>): Parser<T> {
108
+ assert(precedence > 0);
110
109
  return (source, context) => {
111
110
  const p = context.precedence;
112
111
  context.precedence = precedence;
@@ -5,7 +5,7 @@ import { eval } from '../../combinator/data/parser';
5
5
  import { segment, validate, MAX_INPUT_SIZE } from '../segment';
6
6
  import { header } from '../header';
7
7
  import { block } from '../block';
8
- import { backtrackable } from '../context';
8
+ import { State } from '../context';
9
9
  import { normalize } from './normalize';
10
10
  import { headers } from './header';
11
11
  import { figure } from '../processor/figure';
@@ -24,7 +24,7 @@ export function bind(target: DocumentFragment | HTMLElement | ShadowRoot, settin
24
24
  let context: MarkdownParser.Context = {
25
25
  ...settings,
26
26
  host: settings.host ?? new ReadonlyURL(location.pathname, location.origin),
27
- memorable: backtrackable,
27
+ memorable: State.backtrackable,
28
28
  };
29
29
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
30
30
  assert(!settings.id);
@@ -5,7 +5,7 @@ import { eval } from '../../combinator/data/parser';
5
5
  import { segment, validate, MAX_SEGMENT_SIZE } from '../segment';
6
6
  import { header } from '../header';
7
7
  import { block } from '../block';
8
- import { backtrackable } from '../context';
8
+ import { State } from '../context';
9
9
  import { normalize } from './normalize';
10
10
  import { headers } from './header';
11
11
  import { figure } from '../processor/figure';
@@ -30,7 +30,7 @@ export function parse(source: string, opts: Options = {}, context?: MarkdownPars
30
30
  ...context?.resources && {
31
31
  resources: context.resources,
32
32
  },
33
- memorable: backtrackable,
33
+ memorable: State.backtrackable,
34
34
  };
35
35
  if (context.host?.origin === 'null') throw new Error(`Invalid host: ${context.host.href}`);
36
36
  const node = frag();
@@ -23,10 +23,19 @@ export const enum State {
23
23
  link = 1 << 2,
24
24
  media = 1 << 1,
25
25
  autolink = 1 << 0,
26
+ none = 0,
27
+ linkable = 0
28
+ | State.annotation
29
+ | State.reference
30
+ | State.index
31
+ | State.label
32
+ | State.link
33
+ | State.media
34
+ | State.autolink,
35
+ backtrackable = 0
36
+ | State.annotation
37
+ | State.reference
38
+ | State.index
39
+ | State.link
40
+ | State.media,
26
41
  }
27
- export const backtrackable = 0
28
- | State.annotation
29
- | State.reference
30
- | State.index
31
- | State.link
32
- | State.media;
@@ -1,6 +1,6 @@
1
1
  import { undefined } from 'spica/global';
2
2
  import { AnnotationParser } from '../inline';
3
- import { union, some, context, syntax, constraint, state, surround, lazy } from '../../combinator';
3
+ import { union, some, context, syntax, constraint, surround, lazy } from '../../combinator';
4
4
  import { inline } from '../inline';
5
5
  import { Syntax, State } from '../context';
6
6
  import { startLoose, trimNode } from '../visibility';
@@ -9,11 +9,10 @@ import { html, defrag } from 'typed-dom/dom';
9
9
  export const annotation: AnnotationParser = lazy(() => surround(
10
10
  '((',
11
11
  constraint(State.annotation, false,
12
- state(State.annotation | State.media,
13
- syntax(Syntax.annotation, 6, 1,
12
+ syntax(Syntax.annotation, 6, 1, State.annotation | State.media,
14
13
  startLoose(
15
14
  context({ delimiters: undefined },
16
- some(union([inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')))),
15
+ some(union([inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')'))),
17
16
  '))',
18
17
  false,
19
18
  ([, ns], rest) => [[html('sup', { class: 'annotation' }, [html('span', trimNode(defrag(ns)))])], rest]));
@@ -14,7 +14,7 @@ import { stringify } from '../util';
14
14
  export const autolink: AutolinkParser = fmap(
15
15
  validate(/^(?:[@#>0-9A-Za-z]|\S[#>])/,
16
16
  constraint(State.autolink, false,
17
- syntax(Syntax.autolink, 1, 1,
17
+ syntax(Syntax.autolink, 1, 1, State.none,
18
18
  some(union([
19
19
  url,
20
20
  email,
@@ -3,29 +3,29 @@ import { BracketParser } from '../inline';
3
3
  import { union, some, syntax, surround, lazy } from '../../combinator';
4
4
  import { inline } from '../inline';
5
5
  import { str } from '../source';
6
- import { Syntax } from '../context';
6
+ import { Syntax, State } from '../context';
7
7
  import { html, defrag } from 'typed-dom/dom';
8
8
  import { unshift, push } from 'spica/array';
9
9
 
10
10
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
11
11
 
12
12
  export const bracket: BracketParser = lazy(() => union([
13
- surround(str('('), syntax(Syntax.none, 2, 1, str(index)), str(')')),
14
- surround(str('('), syntax(Syntax.bracket, 2, 1, some(inline, ')', [[')', 2]])), str(')'), true,
13
+ surround(str('('), syntax(Syntax.none, 2, 1, State.none, str(index)), str(')')),
14
+ surround(str('('), syntax(Syntax.bracket, 2, 1, State.none, some(inline, ')', [[')', 2]])), str(')'), true,
15
15
  ([as, bs = [], cs], rest) => [[html('span', { class: 'paren' }, defrag(push(unshift(as, bs), cs)))], rest],
16
16
  ([as, bs = []], rest) => [unshift([''], unshift(as, bs)), rest]),
17
- surround(str('('), syntax(Syntax.none, 2, 1, str(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), str(')')),
18
- surround(str('('), syntax(Syntax.bracket, 2, 1, some(inline, ')', [[')', 2]])), str(')'), true,
17
+ surround(str('('), syntax(Syntax.none, 2, 1, State.none, str(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), str(')')),
18
+ surround(str('('), syntax(Syntax.bracket, 2, 1, State.none, some(inline, ')', [[')', 2]])), str(')'), true,
19
19
  ([as, bs = [], cs], rest) => [[html('span', { class: 'paren' }, defrag(push(unshift(as, bs), cs)))], rest],
20
20
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
21
- surround(str('['), syntax(Syntax.bracket, 2, 1, some(inline, ']', [[']', 2]])), str(']'), true,
21
+ surround(str('['), syntax(Syntax.bracket, 2, 1, State.none, some(inline, ']', [[']', 2]])), str(']'), true,
22
22
  undefined,
23
23
  ([as, bs = []], rest) => [unshift([''], unshift(as, bs)), rest]),
24
- surround(str('{'), syntax(Syntax.bracket, 2, 1, some(inline, '}', [['}', 2]])), str('}'), true,
24
+ surround(str('{'), syntax(Syntax.bracket, 2, 1, State.none, some(inline, '}', [['}', 2]])), str('}'), true,
25
25
  undefined,
26
26
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
27
27
  // Control media blinking in editing rather than control confusion of pairs of quote marks.
28
- surround(str('"'), syntax(Syntax.quote, 8, 1, some(inline, '"', [['"', 8]])), str('"'), true,
28
+ surround(str('"'), syntax(Syntax.quote, 8, 1, State.none, some(inline, '"', [['"', 8]])), str('"'), true,
29
29
  undefined,
30
30
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
31
31
  ]));
@@ -2,12 +2,12 @@ import { CommentParser } from '../inline';
2
2
  import { union, some, syntax, validate, surround, open, close, match, lazy } from '../../combinator';
3
3
  import { inline } from '../inline';
4
4
  import { text, str } from '../source';
5
- import { Syntax } from '../context';
5
+ import { Syntax, State } from '../context';
6
6
  import { html, defrag } from 'typed-dom/dom';
7
7
  import { memoize } from 'spica/memoize';
8
8
  import { unshift, push } from 'spica/array';
9
9
 
10
- export const comment: CommentParser = lazy(() => validate('[%', syntax(Syntax.none, 4, 1, match(
10
+ export const comment: CommentParser = lazy(() => validate('[%', syntax(Syntax.none, 4, 1, State.none, match(
11
11
  /^\[(%+)\s/,
12
12
  memoize(
13
13
  ([, fence]) =>
@@ -2,14 +2,14 @@ import { DeletionParser } from '../inline';
2
2
  import { union, some, syntax, surround, open, lazy } from '../../combinator';
3
3
  import { inline } from '../inline';
4
4
  import { str } from '../source';
5
- import { Syntax } from '../context';
5
+ import { Syntax, State } from '../context';
6
6
  import { blankWith } from '../visibility';
7
7
  import { html, defrag } from 'typed-dom/dom';
8
8
  import { unshift } from 'spica/array';
9
9
 
10
10
  export const deletion: DeletionParser = lazy(() => surround(
11
11
  str('~~'),
12
- syntax(Syntax.none, 1, 1,
12
+ syntax(Syntax.none, 1, 1, State.none,
13
13
  some(union([
14
14
  some(inline, blankWith('\n', '~~')),
15
15
  open('\n', some(inline, '~'), true),
@@ -4,14 +4,14 @@ import { inline } from '../inline';
4
4
  import { emstrong } from './emstrong';
5
5
  import { strong } from './strong';
6
6
  import { str } from '../source';
7
- import { Syntax } from '../context';
7
+ import { Syntax, State } from '../context';
8
8
  import { startTight, blankWith } from '../visibility';
9
9
  import { html, defrag } from 'typed-dom/dom';
10
10
  import { unshift } from 'spica/array';
11
11
 
12
12
  export const emphasis: EmphasisParser = lazy(() => surround(
13
13
  str('*'),
14
- syntax(Syntax.none, 1, 1,
14
+ syntax(Syntax.none, 1, 1, State.none,
15
15
  startTight(some(union([
16
16
  strong,
17
17
  some(inline, blankWith('*')),
@@ -5,7 +5,7 @@ import { inline } from '../inline';
5
5
  import { strong } from './strong';
6
6
  import { emphasis } from './emphasis';
7
7
  import { str } from '../source';
8
- import { Syntax } from '../context';
8
+ import { Syntax, State } from '../context';
9
9
  import { startTight, blankWith } from '../visibility';
10
10
  import { html, defrag } from 'typed-dom/dom';
11
11
  import { unshift } from 'spica/array';
@@ -29,7 +29,7 @@ const subemphasis: IntermediateParser<EmphasisParser> = lazy(() => some(union([
29
29
 
30
30
  export const emstrong: EmStrongParser = lazy(() => surround(
31
31
  str('***'),
32
- syntax(Syntax.none, 1, 1,
32
+ syntax(Syntax.none, 1, 1, State.none,
33
33
  startTight(some(union([
34
34
  some(inline, blankWith('*')),
35
35
  open(some(inline, '*'), inline),
@@ -1,6 +1,6 @@
1
1
  import { undefined } from 'spica/global';
2
2
  import { ExtensionParser } from '../../inline';
3
- import { union, some, syntax, creation, precedence, constraint, state, validate, surround, open, lazy, fmap } from '../../../combinator';
3
+ import { union, some, syntax, creation, precedence, constraint, validate, surround, open, lazy, fmap } from '../../../combinator';
4
4
  import { inline } from '../../inline';
5
5
  import { indexee, identity } from './indexee';
6
6
  import { txt, str, stropt } from '../../source';
@@ -13,13 +13,12 @@ import IndexParser = ExtensionParser.IndexParser;
13
13
  export const index: IndexParser = lazy(() => validate('[#', fmap(indexee(surround(
14
14
  '[#',
15
15
  constraint(State.index, false,
16
- state(State.annotation | State.reference | State.index | State.label | State.link | State.media | State.autolink,
17
- syntax(Syntax.index, 2, 1,
16
+ syntax(Syntax.index, 2, 1, State.linkable,
18
17
  startTight(
19
18
  open(stropt(/^\|?/), trimBlankEnd(some(union([
20
19
  signature,
21
20
  inline,
22
- ]), ']', [[/^\\?\n/, 9], [']', 2]])), true))))),
21
+ ]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))),
23
22
  ']',
24
23
  false,
25
24
  ([, ns], rest) => [[html('a', defrag(ns))], rest])),
@@ -2,7 +2,7 @@ import { ExtensionParser } from '../../inline';
2
2
  import { union, some, syntax, validate, surround, lazy } from '../../../combinator';
3
3
  import { inline } from '../../inline';
4
4
  import { str } from '../../source';
5
- import { Syntax } from '../../context';
5
+ import { Syntax, State } from '../../context';
6
6
  import { startTight } from '../../visibility';
7
7
  import { html, defrag } from 'typed-dom/dom';
8
8
  import { unshift } from 'spica/array';
@@ -13,7 +13,7 @@ import { unshift } from 'spica/array';
13
13
 
14
14
  export const placeholder: ExtensionParser.PlaceholderParser = lazy(() => validate(['[:', '[^'], surround(
15
15
  str(/^\[[:^]/),
16
- syntax(Syntax.none, 2, 1,
16
+ syntax(Syntax.none, 2, 1, State.none,
17
17
  startTight(some(union([inline]), ']', [[/^\\?\n/, 9], [']', 2]]))),
18
18
  str(']'), false,
19
19
  ([as, bs], rest) => [[
@@ -3,7 +3,7 @@ import { HTMLParser } from '../inline';
3
3
  import { union, subsequence, some, syntax, validate, focus, surround, open, match, lazy } from '../../combinator';
4
4
  import { inline } from '../inline';
5
5
  import { str } from '../source';
6
- import { Syntax } from '../context';
6
+ import { Syntax, State } from '../context';
7
7
  import { isStartLooseNodes, blankWith } from '../visibility';
8
8
  import { html as h, defrag } from 'typed-dom/dom';
9
9
  import { memoize } from 'spica/memoize';
@@ -19,7 +19,7 @@ const attrspecs = {
19
19
  Object.setPrototypeOf(attrspecs, null);
20
20
  Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
21
21
 
22
- export const html: HTMLParser = lazy(() => validate('<', validate(/^<[a-z]+(?=[^\S\n]|>)/i, syntax(Syntax.none, 5, 1, union([
22
+ export const html: HTMLParser = lazy(() => validate('<', validate(/^<[a-z]+(?=[^\S\n]|>)/i, syntax(Syntax.none, 5, 1, State.none, union([
23
23
  focus(
24
24
  /^<wbr[^\S\n]*>/i,
25
25
  () => [[h('wbr')], '']),
@@ -2,14 +2,14 @@ import { InsertionParser } from '../inline';
2
2
  import { union, some, syntax, surround, open, lazy } from '../../combinator';
3
3
  import { inline } from '../inline';
4
4
  import { str } from '../source';
5
- import { Syntax } from '../context';
5
+ import { Syntax, State } from '../context';
6
6
  import { blankWith } from '../visibility';
7
7
  import { html, defrag } from 'typed-dom/dom';
8
8
  import { unshift } from 'spica/array';
9
9
 
10
10
  export const insertion: InsertionParser = lazy(() => surround(
11
11
  str('++'),
12
- syntax(Syntax.none, 1, 1,
12
+ syntax(Syntax.none, 1, 1, State.none,
13
13
  some(union([
14
14
  some(inline, blankWith('\n', '++')),
15
15
  open('\n', some(inline, '+'), true),
@@ -25,8 +25,7 @@ export const link: LinkParser = lazy(() => validate(['[', '{'], union([
25
25
 
26
26
  const textlink: LinkParser.TextLinkParser = lazy(() =>
27
27
  constraint(State.link, false,
28
- state(State.link | State.media | State.annotation | State.reference | State.index | State.label | State.autolink,
29
- syntax(Syntax.link, 2, 10,
28
+ syntax(Syntax.link, 2, 10, State.linkable,
30
29
  bind(reverse(tails([
31
30
  dup(surround(
32
31
  '[',
@@ -44,12 +43,11 @@ const textlink: LinkParser.TextLinkParser = lazy(() =>
44
43
  source = exec(result!);
45
44
  }
46
45
  return parse(content, params, rest, context);
47
- })))));
46
+ }))));
48
47
 
49
48
  const medialink: LinkParser.MediaLinkParser = lazy(() =>
50
49
  constraint(State.link | State.media, false,
51
- state(State.link | State.annotation | State.reference | State.index | State.label | State.autolink,
52
- syntax(Syntax.link, 2, 10,
50
+ syntax(Syntax.link, 2, 10, State.linkable ^ State.media,
53
51
  bind(reverse(sequence([
54
52
  dup(surround(
55
53
  '[',
@@ -58,7 +56,7 @@ const medialink: LinkParser.MediaLinkParser = lazy(() =>
58
56
  dup(surround(/^{(?![{}])/, inits([uri, some(option)]), /^[^\S\n]*}/)),
59
57
  ])),
60
58
  ([params, content = []]: [string[], (HTMLElement | string)[]], rest, context) =>
61
- parse(content, params, rest, context))))));
59
+ parse(content, params, rest, context)))));
62
60
 
63
61
  export const unsafelink: LinkParser.UnsafeLinkParser = lazy(() =>
64
62
  creation(10, precedence(2,
@@ -3,13 +3,13 @@ import { union, some, syntax, surround, open, lazy } from '../../combinator';
3
3
  import { inline } from '../inline';
4
4
  import { str } from '../source';
5
5
  import { startTight, blankWith } from '../visibility';
6
- import { Syntax } from '../context';
6
+ import { Syntax, State } from '../context';
7
7
  import { html, defrag } from 'typed-dom/dom';
8
8
  import { unshift } from 'spica/array';
9
9
 
10
10
  export const mark: MarkParser = lazy(() => surround(
11
11
  str('=='),
12
- syntax(Syntax.none, 1, 1,
12
+ syntax(Syntax.none, 1, 1, State.none,
13
13
  startTight(some(union([
14
14
  some(inline, blankWith('==')),
15
15
  open(some(inline, '='), mark),
@@ -21,7 +21,7 @@ Object.setPrototypeOf(optspec, null);
21
21
  export const media: MediaParser = lazy(() => validate(['![', '!{'], open(
22
22
  '!',
23
23
  constraint(State.media, false,
24
- syntax(Syntax.media, 2, 10,
24
+ syntax(Syntax.media, 2, 10, State.none,
25
25
  bind(verify(fmap(tails([
26
26
  dup(surround(
27
27
  '[',
@@ -1,6 +1,6 @@
1
1
  import { undefined } from 'spica/global';
2
2
  import { ReferenceParser } from '../inline';
3
- import { union, subsequence, some, context, syntax, creation, constraint, state, surround, open, lazy, bind } from '../../combinator';
3
+ import { union, subsequence, some, context, syntax, creation, constraint, surround, open, lazy, bind } from '../../combinator';
4
4
  import { inline } from '../inline';
5
5
  import { str, stropt } from '../source';
6
6
  import { Syntax, State } from '../context';
@@ -11,15 +11,14 @@ import { html, defrag } from 'typed-dom/dom';
11
11
  export const reference: ReferenceParser = lazy(() => surround(
12
12
  '[[',
13
13
  constraint(State.reference, false,
14
- state(State.annotation | State.reference | State.media,
15
- syntax(Syntax.reference, 6, 1,
14
+ syntax(Syntax.reference, 6, 1, State.annotation | State.reference | State.media,
16
15
  startLoose(
17
16
  context({ delimiters: undefined },
18
17
  subsequence([
19
18
  abbr,
20
19
  open(stropt(/^(?=\^)/), some(inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])),
21
20
  some(inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]]),
22
- ])), ']')))),
21
+ ])), ']'))),
23
22
  ']]',
24
23
  false,
25
24
  ([, ns], rest) => [[html('sup', attributes(ns), [html('span', trimNode(defrag(ns)))])], rest]));
@@ -4,12 +4,12 @@ import { eval, exec } from '../../combinator/data/parser';
4
4
  import { sequence, syntax, creation, validate, verify, focus, surround, lazy, fmap } from '../../combinator';
5
5
  import { unsafehtmlentity } from './htmlentity';
6
6
  import { text as txt } from '../source';
7
- import { Syntax } from '../context';
7
+ import { Syntax, State } from '../context';
8
8
  import { isStartTightNodes } from '../visibility';
9
9
  import { html, defrag } from 'typed-dom/dom';
10
10
  import { unshift, push } from 'spica/array';
11
11
 
12
- export const ruby: RubyParser = lazy(() => validate('[', syntax(Syntax.none, 2, 1, fmap(verify(
12
+ export const ruby: RubyParser = lazy(() => validate('[', syntax(Syntax.none, 2, 1, State.none, fmap(verify(
13
13
  sequence([
14
14
  surround('[', focus(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=]\()/, text), ']'),
15
15
  surround('(', focus(/^(?:\\[^\n]|[^\\[\](){}"\n])+(?=\))/, text), ')'),
@@ -3,14 +3,14 @@ import { union, some, syntax, surround, open, lazy } from '../../combinator';
3
3
  import { inline } from '../inline';
4
4
  import { emstrong } from './emstrong';
5
5
  import { str } from '../source';
6
- import { Syntax } from '../context';
6
+ import { Syntax, State } from '../context';
7
7
  import { startTight, blankWith } from '../visibility';
8
8
  import { html, defrag } from 'typed-dom/dom';
9
9
  import { unshift } from 'spica/array';
10
10
 
11
11
  export const strong: StrongParser = lazy(() => surround(
12
12
  str('**'),
13
- syntax(Syntax.none, 1, 1,
13
+ syntax(Syntax.none, 1, 1, State.none,
14
14
  startTight(some(union([
15
15
  some(inline, blankWith('**')),
16
16
  open(some(inline, '*'), union([
@@ -2,12 +2,12 @@ import { undefined } from 'spica/global';
2
2
  import { TemplateParser } from '../inline';
3
3
  import { union, some, syntax, creation, precedence, surround, lazy } from '../../combinator';
4
4
  import { escsource, str } from '../source';
5
- import { Syntax } from '../context';
5
+ import { Syntax, State } from '../context';
6
6
  import { html } from 'typed-dom/dom';
7
7
  import { unshift } from 'spica/array';
8
8
 
9
9
  export const template: TemplateParser = lazy(() => surround(
10
- '{{', syntax(Syntax.none, 2, 1, some(union([bracket, escsource]), '}')), '}}', true,
10
+ '{{', syntax(Syntax.none, 2, 1, State.none, some(union([bracket, escsource]), '}')), '}}', true,
11
11
  ([, ns = []], rest) => [[html('span', { class: 'template' }, `{{${ns.join('').replace(/\x1B/g, '')}}}`)], rest]));
12
12
 
13
13
  const bracket: TemplateParser.BracketParser = lazy(() => creation(union([
@@ -2,7 +2,7 @@ import { undefined } from 'spica/global';
2
2
  import { TextParser, TxtParser, LinebreakParser } from '../source';
3
3
  import { union, syntax, focus } from '../../combinator';
4
4
  import { str } from './str';
5
- import { Syntax } from '../context';
5
+ import { Syntax, State } from '../context';
6
6
  import { html } from 'typed-dom/dom';
7
7
 
8
8
  export const delimiter = /[\s\x00-\x7F]|\S[#>]|[()、。!?][^\S\n]*(?=\\\n)/;
@@ -10,7 +10,7 @@ export const nonWhitespace = /[\S\n]|$/;
10
10
  export const nonAlphanumeric = /[^0-9A-Za-z]|\S[#>]|$/;
11
11
  const repeat = str(/^(.)\1*/);
12
12
 
13
- export const text: TextParser = syntax(Syntax.none, 1, 1, (source, context) => {
13
+ export const text: TextParser = syntax(Syntax.none, 1, 1, State.none, (source, context) => {
14
14
  if (source === '') return;
15
15
  const i = source.search(delimiter);
16
16
  switch (i) {