securemark 0.289.0 → 0.289.2

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.289.2
4
+
5
+ - Refactoring.
6
+
7
+ ## 0.289.1
8
+
9
+ - Refactoring.
10
+
3
11
  ## 0.289.0
4
12
 
5
13
  - Improve bracket parser.
package/README.md CHANGED
@@ -69,7 +69,7 @@ Secure markdown renderer working on browsers for user input data.
69
69
  |-|------------------------------|
70
70
  |9| \n |
71
71
  |6| ` |
72
- |5| ${}$ |
72
+ |5| \${}$ |
73
73
  |4| [% %] |
74
74
  |3| \<tag>\</tag> |
75
75
  |2| $, " |
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.289.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.289.2 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"));
@@ -3160,7 +3160,7 @@ exports.clear = exports.close = exports.open = exports.surround = void 0;
3160
3160
  const parser_1 = __webpack_require__(605);
3161
3161
  const fmap_1 = __webpack_require__(2705);
3162
3162
  const array_1 = __webpack_require__(6876);
3163
- function surround(opener, parser, closer, optional = false, f, g, backtracks = [], bstate = 0) {
3163
+ function surround(opener, parser, closer, optional = false, f, g, backtracks = [], backtrackstate = 0) {
3164
3164
  switch (typeof opener) {
3165
3165
  case 'string':
3166
3166
  case 'object':
@@ -3171,6 +3171,7 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3171
3171
  case 'object':
3172
3172
  closer = match(closer);
3173
3173
  }
3174
+ const statesize = 2;
3174
3175
  return ({
3175
3176
  source,
3176
3177
  context
@@ -3199,21 +3200,20 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3199
3200
  if (source[i] !== source[0]) break;
3200
3201
  const pos = source.length + offset - i - 1;
3201
3202
  if (!(pos in backtracks)) continue;
3202
- // bracket only
3203
- const shift = backtrack >>> 2 === state >>> 2 ? state & 3 : 0;
3204
- if (backtracks[pos] & 1 << (backtrack >>> 2) + shift) return void revert(context, linebreak);
3203
+ const shift = backtrack >>> statesize & state >>> statesize ? state & (1 << statesize) - 1 : 0;
3204
+ if (backtracks[pos] & 1 << size(backtrack >>> statesize) + shift) return void revert(context, linebreak);
3205
3205
  }
3206
3206
  }
3207
3207
  }
3208
3208
  const {
3209
- backtrack: state = 0
3209
+ backtrack = 0
3210
3210
  } = context;
3211
- context.backtrack = state | bstate;
3211
+ context.backtrack = backtrack | backtrackstate;
3212
3212
  const res2 = mr_ !== '' ? parser({
3213
3213
  source: mr_,
3214
3214
  context
3215
3215
  }) : undefined;
3216
- context.backtrack = state;
3216
+ context.backtrack = backtrack;
3217
3217
  const rm = (0, parser_1.eval)(res2);
3218
3218
  const r_ = (0, parser_1.exec)(res2, mr_);
3219
3219
  if (!rm && !optional) return void revert(context, linebreak);
@@ -3231,9 +3231,8 @@ function surround(opener, parser, closer, optional = false, f, g, backtracks = [
3231
3231
  backtrack: state = 0,
3232
3232
  offset = 0
3233
3233
  } = context;
3234
- // bracket only
3235
- const shift = backtrack >>> 2 === state >>> 2 ? state & 3 : 0;
3236
- backtracks[source.length + offset - 1] |= 1 << (backtrack >>> 2) + shift;
3234
+ const shift = backtrack >>> statesize & state >>> statesize ? state & (1 << statesize) - 1 : 0;
3235
+ backtracks[source.length + offset - 1] |= 1 << size(backtrack >>> statesize) + shift;
3237
3236
  }
3238
3237
  }
3239
3238
  context.recent = [lmr_.slice(0, lmr_.length - mr_.length), mr_.slice(0, mr_.length - r_.length), r_.slice(0, r_.length - rest.length)];
@@ -3262,6 +3261,15 @@ function match(pattern) {
3262
3261
  };
3263
3262
  }
3264
3263
  }
3264
+ function size(bits) {
3265
+ if (bits === 0) return 0;
3266
+ let p = 0;
3267
+ for (let s = 32 / 2; s > 0; s >>>= 1) {
3268
+ if (bits >>> p + s === 0) continue;
3269
+ p += s;
3270
+ }
3271
+ return p + 1;
3272
+ }
3265
3273
  function revert(context, linebreak) {
3266
3274
  context.linebreak = linebreak;
3267
3275
  }
@@ -5889,7 +5897,7 @@ const visibility_1 = __webpack_require__(6364);
5889
5897
  const dom_1 = __webpack_require__(394);
5890
5898
  exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, false, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 4 /* State.media */, (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [['\n', 9], [')', 1]])))), '))', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', {
5891
5899
  class: 'annotation'
5892
- }, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, [3 | 16 /* Backtrack.linedoublebracket */, 1 | 12 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)));
5900
+ }, [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, undefined, [3 | 32 /* Backtrack.linedoublebracket */, 1 | 16 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)));
5893
5901
 
5894
5902
  /***/ },
5895
5903
 
@@ -6121,17 +6129,17 @@ const array_1 = __webpack_require__(6876);
6121
6129
  const dom_1 = __webpack_require__(394);
6122
6130
  const indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
6123
6131
  const indexF = new RegExp(indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)));
6124
- exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest, {
6132
+ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest, {
6125
6133
  recent = []
6126
6134
  }) => [indexA.test(recent[1]) ? recent : [(0, dom_1.html)('span', {
6127
6135
  class: 'paren'
6128
- }, (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], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest, {
6136
+ }, (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], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest, {
6129
6137
  recent = []
6130
6138
  }) => [indexF.test(recent[1]) ? recent : [(0, dom_1.html)('span', {
6131
6139
  class: 'paren'
6132
- }, (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.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]),
6133
- // 改行禁止はバックトラックなしでは内側の構文を破壊するため安易に行えない。
6134
- (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, '"', [['"', 2, false]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], rest, {
6140
+ }, (0, dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)))], rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, undefined, ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest]),
6141
+ // 同一行内でしか閉じない以外括弧と同じ挙動
6142
+ (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '"', [['"', 2, false]]))), (0, source_1.str)('"'), true, ([as, bs = [], cs], rest, {
6135
6143
  linebreak = 0
6136
6144
  }) => linebreak > rest.length ? [(0, array_1.unshift)(as, bs), cs[0] + rest] : [(0, array_1.push)((0, array_1.unshift)(as, bs), cs), rest], ([as, bs = []], rest) => [(0, array_1.unshift)(as, bs), rest], [2 | 8 /* Backtrack.bracket */])]));
6137
6145
 
@@ -6313,7 +6321,7 @@ const array_1 = __webpack_require__(6876);
6313
6321
  const dom_1 = __webpack_require__(394);
6314
6322
  exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, false, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [['\n', 9], [']', 1]])))), ']', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('a', {
6315
6323
  'data-index': dataindex(ns)
6316
- }, (0, dom_1.defrag)(ns))], rest] : undefined, undefined, [3 | 12 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)), ([el]) => [(0, dom_1.define)(el, {
6324
+ }, (0, dom_1.defrag)(ns))], rest] : undefined, undefined, [3 | 16 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)), ([el]) => [(0, dom_1.define)(el, {
6317
6325
  id: el.id ? null : undefined,
6318
6326
  class: 'index',
6319
6327
  href: el.id ? `#${el.id}` : undefined
@@ -6518,7 +6526,7 @@ const source_1 = __webpack_require__(8745);
6518
6526
  const dom_1 = __webpack_require__(394);
6519
6527
  const body = (0, source_1.str)(/^\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/);
6520
6528
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
6521
- exports.label = (0, combinator_1.constraint)(16 /* State.label */, false, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 12 /* Backtrack.linebracket */, 1]), body]), ([text]) => [(0, dom_1.html)('a', {
6529
+ exports.label = (0, combinator_1.constraint)(16 /* State.label */, false, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, undefined, undefined, [1 | 16 /* Backtrack.linebracket */, 1]), body]), ([text]) => [(0, dom_1.html)('a', {
6522
6530
  class: 'label',
6523
6531
  'data-label': text.slice(text[1] === '-' ? 0 : 1).toLowerCase()
6524
6532
  }, text)]));
@@ -6734,7 +6742,7 @@ const optspec = {
6734
6742
  rel: ['nofollow']
6735
6743
  };
6736
6744
  Object.setPrototypeOf(optspec, null);
6737
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, false, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [['\n', 9], [']', 1]])), ']', true, undefined, undefined, [1 | 12 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 24 /* Backtrack.link */]))])), ([params, content = []], rest, context) => {
6745
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, false, (0, combinator_1.creation)(10, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */ | 4 /* State.media */, (0, combinator_1.bind)((0, combinator_1.reverse)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [['\n', 9], [']', 1]])), ']', true, undefined, undefined, [1 | 16 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 128 /* Backtrack.link */]))])), ([params, content = []], rest, context) => {
6738
6746
  if (content.length !== 0 && (0, visibility_1.trimBlankNodeEnd)(content).length === 0) return;
6739
6747
  return [[parse((0, dom_1.defrag)(content), params, context)], rest];
6740
6748
  }))))));
@@ -6917,7 +6925,7 @@ const optspec = {
6917
6925
  rel: undefined
6918
6926
  };
6919
6927
  Object.setPrototypeOf(optspec, null);
6920
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (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.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [['\n', 9]])), ']', true, undefined, undefined, [3 | 4 /* Backtrack.lineescbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 24 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6928
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, false, (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creation)(10, (0, combinator_1.open)('!', (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.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']', [['\n', 9]])), ']', true, undefined, undefined, [3 | 4 /* Backtrack.lineescbracket */])), (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), /^[^\S\n]*}/, false, undefined, undefined, [3 | 128 /* Backtrack.link */]))]), ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6921
6929
  const INSECURE_URI = params.shift();
6922
6930
  const url = new url_1.ReadonlyURL((0, link_1.resolve)(INSECURE_URI, context.host ?? location, context.url ?? context.host ?? location), context.host?.href || location.href);
6923
6931
  let cache;
@@ -6997,7 +7005,7 @@ const array_1 = __webpack_require__(6876);
6997
7005
  const util_1 = __webpack_require__(4992);
6998
7006
  exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, false, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */ | 4 /* State.media */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [['\n', 9], [']', 1]]))]))), ']]', false, ([, ns], rest) => (0, visibility_1.trimBlankNodeEnd)(ns).length > 0 ? [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)(ns))])], rest] : undefined, ([as, bs], rest, {
6999
7007
  state = 0
7000
- }) => state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs), rest] : undefined, [3 | 16 /* Backtrack.linedoublebracket */, 1 | 12 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)));
7008
+ }) => state & 128 /* State.annotation */ ? [(0, array_1.unshift)(as, bs), rest] : undefined, [3 | 32 /* Backtrack.linedoublebracket */, 1 | 16 /* Backtrack.linebracket */], 8 /* Backtrack.bracket */ | 1 /* BacktrackState.nobreak */)));
7001
7009
  // Chicago-Style
7002
7010
  const abbr = (0, combinator_1.surround)('^', (0, combinator_1.union)([(0, source_1.str)(/^(?=[A-Z])(?:[0-9A-Za-z]'?|(?:[-.:]|\.?\??,? ?)(?!['\-.:?, ]))+/)]), /^\|?(?=]])|^\|[^\S\n]*/, true, ([, ns], rest) => ns ? [['\n', ns[0].trimEnd()], rest.replace(visibility_1.blank.start, '')] : [[''], `^${rest}`], ([,, rest]) => [[''], `^${rest}`]);
7003
7011
  function attributes(ns) {
@@ -7073,13 +7081,13 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinato
7073
7081
  }), [undefined])[0];
7074
7082
  ns && ns.at(-1) === '' && ns.pop();
7075
7083
  return ns && (0, visibility_1.isTightNodeStart)(ns) ? [ns, rest] : undefined;
7076
- }, undefined, [3 | 20 /* Backtrack.ruby */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}<>"\n])+/u), ')', false, ([, [source]], rest, context) => {
7084
+ }, undefined, [3 | 64 /* Backtrack.ruby */])), (0, combinator_1.dup)((0, combinator_1.surround)('(', (0, source_1.str)(/^(?:\\[^\n]|[^\\[\](){}<>"\n])+/u), ')', false, ([, [source]], rest, context) => {
7077
7085
  const ns = (0, parser_1.eval)(text({
7078
7086
  source,
7079
7087
  context
7080
7088
  }), [undefined])[0];
7081
7089
  return ns && [ns, rest];
7082
- }, undefined, [3 | 20 /* Backtrack.ruby */]))]), ([texts, rubies]) => {
7090
+ }, undefined, [3 | 64 /* Backtrack.ruby */]))]), ([texts, rubies]) => {
7083
7091
  switch (true) {
7084
7092
  case rubies.length <= texts.length:
7085
7093
  return [(0, dom_1.html)('ruby', attributes(texts, rubies), (0, dom_1.defrag)(texts.reduce((acc, _, i) => (0, array_1.push)(acc, (0, array_1.unshift)([texts[i]], i < rubies.length && rubies[i] ? [(0, dom_1.html)('rp', '('), (0, dom_1.html)('rt', rubies[i]), (0, dom_1.html)('rp', ')')] : [(0, dom_1.html)('rt')])), [])))];
@@ -7201,7 +7209,7 @@ const source_1 = __webpack_require__(8745);
7201
7209
  const dom_1 = __webpack_require__(394);
7202
7210
  exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)('{{', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}', [['\n', 9]])), '}}', true, ([, ns = []], rest) => [[(0, dom_1.html)('span', {
7203
7211
  class: 'template'
7204
- }, `{{${ns.join('')}}}`)], rest], undefined, [3 | 16 /* Backtrack.linedoublebracket */, 1 | 4 /* Backtrack.lineescbracket */]));
7212
+ }, `{{${ns.join('')}}}`)], rest], undefined, [3 | 32 /* Backtrack.linedoublebracket */, 1 | 4 /* Backtrack.lineescbracket */]));
7205
7213
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, '"'))), (0, source_1.str)('"'), true, undefined, () => [[], ''], [3 | 4 /* Backtrack.lineescbracket */])]));
7206
7214
 
7207
7215
  /***/ },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.289.0",
3
+ "version": "0.289.2",
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",
@@ -8,7 +8,7 @@ export function surround<P extends Parser<unknown>, S = string>(
8
8
  f?: (rss: [S[], SubTree<P>[], S[]], rest: string, context: Context<P>) => Result<Tree<P>, Context<P>, SubParsers<P>>,
9
9
  g?: (rss: [S[], SubTree<P>[], string], rest: string, context: Context<P>) => Result<Tree<P>, Context<P>, SubParsers<P>>,
10
10
  backtracks?: readonly number[],
11
- bstate?: number,
11
+ backtrackstate?: number,
12
12
  ): P;
13
13
  export function surround<P extends Parser<unknown>, S = string>(
14
14
  opener: string | RegExp | Parser<S, Context<P>>, parser: IntermediateParser<P>, closer: string | RegExp | Parser<S, Context<P>>,
@@ -16,7 +16,7 @@ export function surround<P extends Parser<unknown>, S = string>(
16
16
  f?: (rss: [S[], SubTree<P>[] | undefined, S[]], rest: string, context: Context<P>) => Result<Tree<P>, Context<P>, SubParsers<P>>,
17
17
  g?: (rss: [S[], SubTree<P>[] | undefined, string], rest: string, context: Context<P>) => Result<Tree<P>, Context<P>, SubParsers<P>>,
18
18
  backtracks?: readonly number[],
19
- bstate?: number,
19
+ backtrackstate?: number,
20
20
  ): P;
21
21
  export function surround<P extends Parser<unknown>, S = string>(
22
22
  opener: string | RegExp | Parser<S, Context<P>>, parser: P, closer: string | RegExp | Parser<S, Context<P>>,
@@ -24,7 +24,7 @@ export function surround<P extends Parser<unknown>, S = string>(
24
24
  f?: (rss: [S[], Tree<P>[], S[]], rest: string, context: Context<P>) => Result<Tree<P>, Context<P>, SubParsers<P>>,
25
25
  g?: (rss: [S[], Tree<P>[], string], rest: string, context: Context<P>) => Result<Tree<P>, Context<P>, SubParsers<P>>,
26
26
  backtracks?: readonly number[],
27
- bstate?: number,
27
+ backtrackstate?: number,
28
28
  ): P;
29
29
  export function surround<P extends Parser<unknown>, S = string>(
30
30
  opener: string | RegExp | Parser<S, Context<P>>, parser: P, closer: string | RegExp | Parser<S, Context<P>>,
@@ -32,7 +32,7 @@ export function surround<P extends Parser<unknown>, S = string>(
32
32
  f?: (rss: [S[], Tree<P>[] | undefined, S[]], rest: string, context: Context<P>) => Result<Tree<P>, Context<P>, SubParsers<P>>,
33
33
  g?: (rss: [S[], Tree<P>[] | undefined, string], rest: string, context: Context<P>) => Result<Tree<P>, Context<P>, SubParsers<P>>,
34
34
  backtracks?: readonly number[],
35
- bstate?: number,
35
+ backtrackstate?: number,
36
36
  ): P;
37
37
  export function surround<T>(
38
38
  opener: string | RegExp | Parser<T>, parser: Parser<T>, closer: string | RegExp | Parser<T>,
@@ -40,7 +40,7 @@ export function surround<T>(
40
40
  f?: (rss: [T[], T[], T[]], rest: string, context: Ctx) => Result<T>,
41
41
  g?: (rss: [T[], T[], string], rest: string, context: Ctx) => Result<T>,
42
42
  backtracks: readonly number[] = [],
43
- bstate: number = 0,
43
+ backtrackstate: number = 0,
44
44
  ): Parser<T> {
45
45
  switch (typeof opener) {
46
46
  case 'string':
@@ -52,6 +52,7 @@ export function surround<T>(
52
52
  case 'object':
53
53
  closer = match(closer);
54
54
  }
55
+ const statesize = 2;
55
56
  return ({ source, context }) => {
56
57
  const lmr_ = source;
57
58
  if (lmr_ === '') return;
@@ -69,17 +70,16 @@ export function surround<T>(
69
70
  if (source[i] !== source[0]) break;
70
71
  const pos = source.length + offset - i - 1;
71
72
  if (!(pos in backtracks)) continue;
72
- // bracket only
73
- const shift = backtrack >>> 2 === state >>> 2 ? state & 3 : 0;
74
- if (backtracks[pos] & 1 << (backtrack >>> 2) + shift) return void revert(context, linebreak);
73
+ const shift = backtrack >>> statesize & state >>> statesize ? state & (1 << statesize) - 1 : 0;
74
+ if (backtracks[pos] & 1 << size(backtrack >>> statesize) + shift) return void revert(context, linebreak);
75
75
  }
76
76
  }
77
77
  }
78
- const { backtrack: state = 0 } = context;
79
- context.backtrack = state | bstate;
78
+ const { backtrack = 0 } = context;
79
+ context.backtrack = backtrack | backtrackstate;
80
80
  const res2 = mr_ !== '' ? parser({ source: mr_, context }) : undefined;
81
81
  assert(check(mr_, res2));
82
- context.backtrack = state;
82
+ context.backtrack = backtrack;
83
83
  const rm = eval(res2);
84
84
  const r_ = exec(res2, mr_);
85
85
  if (!rm && !optional) return void revert(context, linebreak);
@@ -91,9 +91,8 @@ export function surround<T>(
91
91
  for (const backtrack of backtracks) {
92
92
  if (backtrack & 2 && rr === undefined) {
93
93
  const { backtracks = {}, backtrack: state = 0, offset = 0 } = context;
94
- // bracket only
95
- const shift = backtrack >>> 2 === state >>> 2 ? state & 3 : 0;
96
- backtracks[source.length + offset - 1] |= 1 << (backtrack >>> 2) + shift;
94
+ const shift = backtrack >>> statesize & state >>> statesize ? state & (1 << statesize) - 1 : 0;
95
+ backtracks[source.length + offset - 1] |= 1 << size(backtrack >>> statesize) + shift;
97
96
  }
98
97
  }
99
98
  context.recent = [
@@ -131,7 +130,20 @@ function match(pattern: string | RegExp): (input: Input) => [never[], string] |
131
130
  };
132
131
  }
133
132
  }
134
-
133
+ function size(bits: number): number {
134
+ if (bits === 0) return 0;
135
+ let p = 0;
136
+ for (let s = 32 / 2; s > 0; s >>>= 1) {
137
+ if (bits >>> p + s === 0) continue;
138
+ p += s;
139
+ }
140
+ return p + 1;
141
+ }
142
+ assert(size(0 << 0) === 0);
143
+ assert(size(1 << 0) === 1);
144
+ assert(size(1 << 1) === 2);
145
+ assert(size(1 << 30) === 31);
146
+ assert(size(1 << 31) === 32);
135
147
  function revert(context: Ctx, linebreak: number | undefined): void {
136
148
  context.linebreak = linebreak;
137
149
  }
@@ -28,11 +28,11 @@ export const enum Recursion {
28
28
  }
29
29
 
30
30
  export const enum Backtrack {
31
- link = 6 << 2,
32
- ruby = 5 << 2,
33
- linedoublebracket = 4 << 2,
34
- linebracket = 3 << 2,
35
- bracket = 2 << 2,
31
+ link = 1 << 7,
32
+ ruby = 1 << 6,
33
+ linedoublebracket = 1 << 5,
34
+ linebracket = 1 << 4,
35
+ bracket = 1 << 3,
36
36
  lineescbracket = 1 << 2,
37
37
  lineunescbracket = 0 << 2,
38
38
  }
@@ -41,7 +41,6 @@ export const enum Backtrack {
41
41
  export const enum BacktrackState {
42
42
  nobreak = 1,
43
43
  }
44
- assert(Backtrack.linebracket === Backtrack.bracket + (BacktrackState.nobreak << 2));
45
44
 
46
45
  export const enum Command {
47
46
  Error = '\x07',
@@ -15,4 +15,6 @@ export const annotation: AnnotationParser = lazy(() => constraint(State.annotati
15
15
  trimBlankNodeEnd(ns).length > 0
16
16
  ? [[html('sup', { class: 'annotation' }, [html('span', defrag(ns))])], rest]
17
17
  : undefined,
18
- undefined, [3 | Backtrack.linedoublebracket, 1 | Backtrack.linebracket], Backtrack.bracket | BacktrackState.nobreak)));
18
+ undefined,
19
+ [3 | Backtrack.linedoublebracket, 1 | Backtrack.linebracket],
20
+ Backtrack.bracket | BacktrackState.nobreak)));
@@ -11,15 +11,24 @@ const indexF = new RegExp(indexA.source.replace(', ', '[,、]')
11
11
  .replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0)! + 0xFEE0)));
12
12
 
13
13
  export const bracket: BracketParser = lazy(() => union([
14
- surround(str('('), recursion(Recursion.bracket, precedence(1, some(inline, ')', [[')', 1]]))), str(')'), true,
14
+ surround(
15
+ str('('),
16
+ precedence(1, recursion(Recursion.bracket, some(inline, ')', [[')', 1]]))),
17
+ str(')'),
18
+ true,
15
19
  ([as, bs = [], cs], rest, { recent = [] }) => [
16
20
  indexA.test(recent[1])
17
21
  ? recent
18
22
  : [html('span', { class: 'paren' }, defrag(push(unshift(as, bs), cs)))],
19
23
  rest
20
24
  ],
21
- ([as, bs = []], rest) => [unshift(as, bs), rest], [2 | Backtrack.bracket]),
22
- surround(str('('), recursion(Recursion.bracket, precedence(1, some(inline, ')', [[')', 1]]))), str(')'), true,
25
+ ([as, bs = []], rest) => [unshift(as, bs), rest],
26
+ [2 | Backtrack.bracket]),
27
+ surround(
28
+ str('('),
29
+ precedence(1, recursion(Recursion.bracket, some(inline, ')', [[')', 1]]))),
30
+ str(')'),
31
+ true,
23
32
  ([as, bs = [], cs], rest, { recent = [] }) => [
24
33
  indexF.test(recent[1])
25
34
  ? recent
@@ -27,23 +36,46 @@ export const bracket: BracketParser = lazy(() => union([
27
36
  rest
28
37
  ],
29
38
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
30
- surround(str('['), recursion(Recursion.bracket, precedence(1, some(inline, ']', [[']', 1]]))), str(']'), true,
39
+ surround(
40
+ str('['),
41
+ precedence(1, recursion(Recursion.bracket, some(inline, ']', [[']', 1]]))),
42
+ str(']'),
43
+ true,
31
44
  undefined,
32
- ([as, bs = []], rest) => [unshift(as, bs), rest], [2 | Backtrack.bracket]),
33
- surround(str('['), recursion(Recursion.bracket, precedence(1, some(inline, ']', [[']', 1]]))), str(']'), true,
45
+ ([as, bs = []], rest) => [unshift(as, bs), rest],
46
+ [2 | Backtrack.bracket]),
47
+ surround(
48
+ str('['),
49
+ precedence(1, recursion(Recursion.bracket, some(inline, ']', [[']', 1]]))),
50
+ str(']'),
51
+ true,
34
52
  undefined,
35
53
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
36
- surround(str('{'), recursion(Recursion.bracket, precedence(1, some(inline, '}', [['}', 1]]))), str('}'), true,
54
+ surround(
55
+ str('{'),
56
+ precedence(1, recursion(Recursion.bracket, some(inline, '}', [['}', 1]]))),
57
+ str('}'),
58
+ true,
37
59
  undefined,
38
- ([as, bs = []], rest) => [unshift(as, bs), rest], [2 | Backtrack.bracket]),
39
- surround(str('{'), recursion(Recursion.bracket, precedence(1, some(inline, '}', [['}', 1]]))), str('}'), true,
60
+ ([as, bs = []], rest) => [unshift(as, bs), rest],
61
+ [2 | Backtrack.bracket]),
62
+ surround(
63
+ str('{'),
64
+ precedence(1, recursion(Recursion.bracket, some(inline, '}', [['}', 1]]))),
65
+ str('}'),
66
+ true,
40
67
  undefined,
41
68
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
42
- // 改行禁止はバックトラックなしでは内側の構文を破壊するため安易に行えない。
43
- surround(str('"'), recursion(Recursion.bracket, precedence(2, some(inline, '"', [['"', 2, false]]))), str('"'), true,
69
+ // 同一行内でしか閉じない以外括弧と同じ挙動
70
+ surround(
71
+ str('"'),
72
+ precedence(2, recursion(Recursion.bracket, some(inline, '"', [['"', 2, false]]))),
73
+ str('"'),
74
+ true,
44
75
  ([as, bs = [], cs], rest, { linebreak = 0 }) =>
45
76
  linebreak > rest.length
46
77
  ? [unshift(as, bs), cs[0] + rest]
47
78
  : [push(unshift(as, bs), cs), rest],
48
- ([as, bs = []], rest) => [unshift(as, bs), rest], [2 | Backtrack.bracket]),
79
+ ([as, bs = []], rest) => [unshift(as, bs), rest],
80
+ [2 | Backtrack.bracket]),
49
81
  ]));
@@ -26,7 +26,9 @@ export const index: IndexParser = lazy(() => constraint(State.index, false, fmap
26
26
  trimBlankNodeEnd(ns).length > 0
27
27
  ? [[html('a', { 'data-index': dataindex(ns) }, defrag(ns))], rest]
28
28
  : undefined,
29
- undefined, [3 | Backtrack.linebracket], Backtrack.bracket | BacktrackState.nobreak)),
29
+ undefined,
30
+ [3 | Backtrack.linebracket],
31
+ Backtrack.bracket | BacktrackState.nobreak)),
30
32
  ([el]: [HTMLAnchorElement]) => [
31
33
  define(el,
32
34
  {
@@ -23,4 +23,5 @@ export const placeholder: ExtensionParser.PlaceholderParser = lazy(() => surroun
23
23
  ...invalid('extension', 'syntax', `Invalid start symbol or linebreak`),
24
24
  }, defrag(bs)),
25
25
  ], rest],
26
- ([as, bs], rest) => [unshift(as, bs), rest], [3 | Backtrack.bracket]));
26
+ ([as, bs], rest) => [unshift(as, bs), rest],
27
+ [3 | Backtrack.bracket]));
@@ -22,12 +22,15 @@ export const textlink: LinkParser.TextLinkParser = lazy(() => constraint(State.l
22
22
  '[',
23
23
  trimBlankStart(some(union([inline]), ']', [['\n', 9], [']', 1]])),
24
24
  ']',
25
- true, undefined, undefined, [1 | Backtrack.linebracket], Backtrack.bracket | BacktrackState.nobreak)),
25
+ true, undefined, undefined,
26
+ [1 | Backtrack.linebracket],
27
+ Backtrack.bracket | BacktrackState.nobreak)),
26
28
  dup(surround(
27
29
  /^{(?![{}])/,
28
30
  inits([uri, some(option)]),
29
31
  /^[^\S\n]*}/,
30
- false, undefined, undefined, [3 | Backtrack.link])),
32
+ false, undefined, undefined,
33
+ [3 | Backtrack.link])),
31
34
  ])),
32
35
  ([params, content = []]: [string[], (HTMLElement | string)[]], rest, context) => {
33
36
  assert(!html('div', content).querySelector('a, .media, .annotation, .reference'));
@@ -29,12 +29,14 @@ export const media: MediaParser = lazy(() => constraint(State.media, false, vali
29
29
  txt,
30
30
  ]), ']', [['\n', 9]])),
31
31
  ']',
32
- true, undefined, undefined, [3 | Backtrack.lineescbracket])),
32
+ true, undefined, undefined,
33
+ [3 | Backtrack.lineescbracket])),
33
34
  dup(surround(
34
35
  /^{(?![{}])/,
35
36
  inits([uri, some(option)]),
36
37
  /^[^\S\n]*}/,
37
- false, undefined, undefined, [3 | Backtrack.link])),
38
+ false, undefined, undefined,
39
+ [3 | Backtrack.link])),
38
40
  ]),
39
41
  ([as, bs]) => bs ? [[as.join('').trim() || as.join('')], bs] : [[''], as]),
40
42
  ([[text]]) => text === '' || text.trim() !== ''),
@@ -25,7 +25,8 @@ export const reference: ReferenceParser = lazy(() => constraint(State.reference,
25
25
  state & State.annotation
26
26
  ? [unshift(as, bs), rest]
27
27
  : undefined,
28
- [3 | Backtrack.linedoublebracket, 1 | Backtrack.linebracket], Backtrack.bracket | BacktrackState.nobreak)));
28
+ [3 | Backtrack.linedoublebracket, 1 | Backtrack.linebracket],
29
+ Backtrack.bracket | BacktrackState.nobreak)));
29
30
 
30
31
  // Chicago-Style
31
32
  const abbr: ReferenceParser.AbbrParser = surround(
@@ -19,7 +19,8 @@ export const ruby: RubyParser = lazy(() => fmap(
19
19
  ns && ns.at(-1) === '' && ns.pop();
20
20
  return ns && isTightNodeStart(ns) ? [ns, rest] : undefined;
21
21
  },
22
- undefined, [3 | Backtrack.ruby])),
22
+ undefined,
23
+ [3 | Backtrack.ruby])),
23
24
  dup(surround(
24
25
  '(', str(/^(?:\\[^\n]|[^\\[\](){}<>"\n])+/u), ')',
25
26
  false,
@@ -27,7 +28,8 @@ export const ruby: RubyParser = lazy(() => fmap(
27
28
  const ns = eval(text({ source, context }), [undefined])[0];
28
29
  return ns && [ns, rest];
29
30
  },
30
- undefined, [3 | Backtrack.ruby])),
31
+ undefined,
32
+ [3 | Backtrack.ruby])),
31
33
  ]),
32
34
  ([texts, rubies]) => {
33
35
  switch (true) {
@@ -11,7 +11,8 @@ export const template: TemplateParser = lazy(() => surround(
11
11
  '}}',
12
12
  true,
13
13
  ([, ns = []], rest) => [[html('span', { class: 'template' }, `{{${ns.join('')}}}`)], rest],
14
- undefined, [3 | Backtrack.linedoublebracket, 1 | Backtrack.lineescbracket]));
14
+ undefined,
15
+ [3 | Backtrack.linedoublebracket, 1 | Backtrack.lineescbracket]));
15
16
 
16
17
  const bracket: TemplateParser.BracketParser = lazy(() => union([
17
18
  surround(str('('), recursion(Recursion.terminal, some(union([bracket, escsource]), ')')), str(')'), true,
@@ -84,7 +84,7 @@ describe('Unit: parser/inline', () => {
84
84
  assert.deepStrictEqual(inspect(parser('"*a\nb*')), [['"', '<em>a<br>b</em>'], '']);
85
85
  assert.deepStrictEqual(inspect(parser('"*a\n""b*')), [['"', '<em>a<br>""b</em>'], '']);
86
86
  assert.deepStrictEqual(inspect(parser('"a\n"*b"c*')), [['"', 'a', '<br>', '"', '*', 'b', '"', 'c', '*'], '']);
87
- assert.deepStrictEqual(inspect(parser('"*a\n**b**"("c*')), [['"', '<em>a<br><strong>b</strong>"("c</em>'], '']);
87
+ assert.deepStrictEqual(inspect(parser('"*a**b\nc**"("*')), [['"', '<em>a<strong>b<br>c</strong>"("</em>'], '']);
88
88
  assert.deepStrictEqual(inspect(parser('<bdi>a"\nb</bdi>')), [['<bdi>a"<br>b</bdi>'], '']);
89
89
  assert.deepStrictEqual(inspect(parser('"<bdi>"a\n""b</bdi>"')), [['"', '<bdi>"a<br>""b</bdi>', '"'], '']);
90
90
  assert.deepStrictEqual(inspect(parser('<bdi>*<bdi>a</bdi>*</bdi>')), [['<bdi><em><bdi>a</bdi></em></bdi>'], '']);