securemark 0.257.1 → 0.257.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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.257.2
4
+
5
+ - Fix operator precedence.
6
+
3
7
  ## 0.257.1
4
8
 
5
9
  - Refactoring.
package/README.md CHANGED
@@ -22,6 +22,15 @@ Secure markdown renderer working on browsers for user input data.
22
22
  - Cross reference generation for annotations and references.
23
23
  - Table of contents.
24
24
 
25
+ ## Media
26
+
27
+ - Twitter
28
+ - YouTube
29
+ - PDF (.pdf)
30
+ - Video (.webm, .ogv)
31
+ - Audio (.oga, .ogg)
32
+ - Images
33
+
25
34
  ## Demos
26
35
 
27
36
  https://falsandtru.github.io/securemark/
@@ -58,14 +67,18 @@ https://falsandtru.github.io/securemark/
58
67
  - Template ({{ template }})
59
68
  - Comment ([% comment %])
60
69
 
61
- ## Media
62
-
63
- - Twitter
64
- - YouTube
65
- - PDF (.pdf)
66
- - Video (.webm, .ogv)
67
- - Audio (.oga, .ogg)
68
- - Images
70
+ ## Operator precedence
71
+
72
+ |P| Operators |
73
+ |-|-------------------|
74
+ |9| \n, \\\n |
75
+ |8| `, " |
76
+ |6| (()), [[]], ${}$ |
77
+ |5| \<tag>\</tag> |
78
+ |4| [% %] |
79
+ |3| $ |
80
+ |2| (), [], {} |
81
+ |1| *, **, ==, ++, ~~ |
69
82
 
70
83
  ## Dependencies
71
84
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.257.1 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.257.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("DOMPurify"), require("Prism"));
@@ -5423,7 +5423,7 @@ exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0,
5423
5423
  }
5424
5424
  },
5425
5425
  delimiters: global_1.undefined
5426
- }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 3], ['))', 6]])), ')')), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5426
+ }, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')), '))', false, ([, ns], rest) => [[(0, dom_1.html)('sup', {
5427
5427
  class: 'annotation'
5428
5428
  }, [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ')' ? global_1.undefined : (0, link_1.optimize)('((', ns, rest)))))));
5429
5429
 
@@ -5658,7 +5658,7 @@ const source_1 = __webpack_require__(6743);
5658
5658
 
5659
5659
  const closer = /^[-+*=~^,.;:!?]*(?=[\\"`|\[\](){}<>]|$)/;
5660
5660
  exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['http://', 'https://'], (0, combinator_1.rewrite)((0, combinator_1.open)(/^https?:\/\/(?=[\x21-\x7E])/, (0, combinator_1.focus)(/^[\x21-\x7E]+/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.unescsource, closer)])))), (0, combinator_1.convert)(url => `{ ${url} }`, (0, combinator_1.union)([link_1.textlink])))));
5661
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
5661
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.union)([(0, combinator_1.surround)('(', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')'), ')', true), (0, combinator_1.surround)('[', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']'), ']', true), (0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}'), '}', true), (0, combinator_1.surround)('"', (0, combinator_1.precedence)(8, (0, combinator_1.some)(source_1.unescsource, '"')), '"', true)]))));
5662
5662
 
5663
5663
  /***/ }),
5664
5664
 
@@ -5686,11 +5686,11 @@ const dom_1 = __webpack_require__(3252);
5686
5686
  const array_1 = __webpack_require__(8112);
5687
5687
 
5688
5688
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
5689
- exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(0, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5689
+ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(0, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, source_1.str)(index)), (0, source_1.str)(')')), (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(2, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5690
5690
  class: 'paren'
5691
- }, (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.precedence)(3, (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.precedence)(3, (0, combinator_1.some)(inline_1.inline, ')', [[')', 3]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5691
+ }, (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.precedence)(2, (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.precedence)(2, (0, combinator_1.some)(inline_1.inline, ')', [[')', 2]])), (0, source_1.str)(')'), true, ([as, bs = [], cs], rest) => [[(0, dom_1.html)('span', {
5692
5692
  class: 'paren'
5693
- }, (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)(3, (0, combinator_1.some)(inline_1.inline, ']', [[']', 3]])), (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.precedence)(3, (0, combinator_1.some)(inline_1.inline, '}', [['}', 3]])), (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.
5693
+ }, (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)(2, (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.precedence)(2, (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.
5694
5694
  (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(8, (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])])));
5695
5695
 
5696
5696
  /***/ }),
@@ -5774,7 +5774,7 @@ const dom_1 = __webpack_require__(3252);
5774
5774
 
5775
5775
  const array_1 = __webpack_require__(8112);
5776
5776
 
5777
- exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_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]))));
5777
+ exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_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]))));
5778
5778
 
5779
5779
  /***/ }),
5780
5780
 
@@ -5939,7 +5939,7 @@ const util_1 = __webpack_require__(9437);
5939
5939
 
5940
5940
  const dom_1 = __webpack_require__(3252);
5941
5941
 
5942
- exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => context.syntax?.inline?.index ?? true, (0, util_1.startTight)((0, combinator_1.context)({
5942
+ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)('[#', (0, combinator_1.guard)(context => context.syntax?.inline?.index ?? true, (0, util_1.startTight)((0, combinator_1.context)({
5943
5943
  syntax: {
5944
5944
  inline: {
5945
5945
  annotation: false,
@@ -5951,7 +5951,7 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[#', (0
5951
5951
  autolink: false
5952
5952
  }
5953
5953
  }
5954
- }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_1.trimBlankEnd)((0, combinator_1.some)((0, combinator_1.union)([signature, inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 3]])), true)))), ']', false, ([, ns], rest) => [[(0, dom_1.html)('a', (0, dom_1.defrag)(ns))], rest])), ([el]) => [(0, dom_1.define)(el, {
5954
+ }, (0, combinator_1.open)((0, source_1.stropt)(/^\|?/), (0, util_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, {
5955
5955
  id: el.id ? null : global_1.undefined,
5956
5956
  class: 'index',
5957
5957
  href: el.id ? `#${el.id}` : global_1.undefined
@@ -6152,7 +6152,7 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
6152
6152
  // All syntax surrounded by square brackets shouldn't contain line breaks.
6153
6153
 
6154
6154
 
6155
- exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 3]])), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
6155
+ exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, util_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', {
6156
6156
  class: 'invalid',
6157
6157
  'data-invalid-syntax': 'extension',
6158
6158
  'data-invalid-type': 'syntax',
@@ -6313,7 +6313,7 @@ const dom_1 = __webpack_require__(3252);
6313
6313
 
6314
6314
  const array_1 = __webpack_require__(8112);
6315
6315
 
6316
- exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_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]))));
6316
+ exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_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]))));
6317
6317
 
6318
6318
  /***/ }),
6319
6319
 
@@ -6352,7 +6352,7 @@ const optspec = {
6352
6352
  rel: ['nofollow']
6353
6353
  };
6354
6354
  Object.setPrototypeOf(optspec, null);
6355
- exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.guard)(context => context.syntax?.inline?.link ?? true, (0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.context)({
6355
+ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (0, combinator_1.bind)((0, combinator_1.guard)(context => context.syntax?.inline?.link ?? true, (0, combinator_1.fmap)((0, combinator_1.subsequence)([(0, combinator_1.context)({
6356
6356
  syntax: {
6357
6357
  inline: {
6358
6358
  link: false
@@ -6371,7 +6371,7 @@ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'
6371
6371
  autolink: false
6372
6372
  }
6373
6373
  }
6374
- }, (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3]])), ']', true, global_1.undefined, ([, ns = [], rest], next) => next[0] === ']' ? global_1.undefined : optimize('[', ns, rest))]))), // 全体の失敗が確定した時も解析し予算を浪費している
6374
+ }, (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 2]])), ']', true, global_1.undefined, ([, ns = [], rest], next) => next[0] === ']' ? global_1.undefined : optimize('[', ns, rest))]))), // 全体の失敗が確定した時も解析し予算を浪費している
6375
6375
  (0, combinator_1.dup)((0, combinator_1.surround)(/^{(?![{}])/, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), /^[^\S\n]*}/))]), ([as, bs = []]) => bs[0] === '\r' && bs.shift() ? [as, bs] : as[0] === '\r' && as.shift() ? [[], as] : [as, []])), ([content, params], rest, context) => {
6376
6376
  if (params.length === 0) return;
6377
6377
  if (content[0] === '') return [content, rest];
@@ -6382,7 +6382,7 @@ exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'
6382
6382
  if (el.classList.contains('invalid')) return [[el], rest];
6383
6383
  return [[(0, dom_1.define)(el, (0, html_1.attributes)('link', [], optspec, params))], rest];
6384
6384
  })))));
6385
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (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) => {
6385
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[', '{'], (0, combinator_1.creator)(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) => {
6386
6386
  params.shift();
6387
6387
  (0, util_1.trimNode)(content);
6388
6388
  const INSECURE_URI = params.shift();
@@ -6504,7 +6504,7 @@ const dom_1 = __webpack_require__(3252);
6504
6504
 
6505
6505
  const array_1 = __webpack_require__(8112);
6506
6506
 
6507
- exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_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]))));
6507
+ exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(1, (0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, util_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]))));
6508
6508
 
6509
6509
  /***/ }),
6510
6510
 
@@ -6525,9 +6525,8 @@ const source_1 = __webpack_require__(6743);
6525
6525
 
6526
6526
  const dom_1 = __webpack_require__(3252);
6527
6527
 
6528
- const syntax = /^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/;
6529
6528
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
6530
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creator)((0, combinator_1.precedence)(7, (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', bracket, '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, source_1.str)(syntax)])), /^\$(?![0-9A-Za-z])/)]), (source, {
6529
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)('$', (0, combinator_1.precedence)(6, bracket), '$'), (0, combinator_1.surround)(/^\$(?![\s{}])/, (0, combinator_1.precedence)(3, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.focus)(/^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/, (0, combinator_1.some)(source_1.unescsource))]))), /^\$(?![0-9A-Za-z])/)]), (source, {
6531
6530
  caches: {
6532
6531
  math: cache
6533
6532
  } = {}
@@ -6541,7 +6540,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('$', (0,
6541
6540
  'data-invalid-syntax': 'math',
6542
6541
  'data-invalid-type': 'content',
6543
6542
  'data-invalid-message': `"${source.match(forbiddenCommand)[0]}" command is forbidden`
6544
- }, source)], ''])))));
6543
+ }, source)], '']))));
6545
6544
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)('{', (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /^(?:[{}$]|\\?\n)/)])), '}', true)));
6546
6545
 
6547
6546
  /***/ }),
@@ -6582,7 +6581,7 @@ const optspec = {
6582
6581
  rel: global_1.undefined
6583
6582
  };
6584
6583
  Object.setPrototypeOf(optspec, null);
6585
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(3, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (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('')], (0, array_1.shift)(bs)[1]] : [[''], (0, array_1.shift)(as)[1]]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6584
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['![', '!{'], (0, combinator_1.creator)(10, (0, combinator_1.precedence)(2, (0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.fmap)((0, combinator_1.open)('!', (0, combinator_1.guard)(context => context.syntax?.inline?.media ?? true, (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('')], (0, array_1.shift)(bs)[1]] : [[''], (0, array_1.shift)(as)[1]]), ([[text]]) => text === '' || text.trim() !== ''), ([[text], params], rest, context) => {
6586
6585
  const INSECURE_URI = params.shift();
6587
6586
  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);
6588
6587
  let cache;
@@ -6689,7 +6688,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('[['
6689
6688
  }
6690
6689
  },
6691
6690
  delimiters: global_1.undefined
6692
- }, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)((0, source_1.stropt)(/^(?=\^)/), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]])), (0, combinator_1.some)(inline_1.inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]])])), ']')), ']]', false, ([, ns], rest) => [[(0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest)))))));
6691
+ }, (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, util_1.trimNode)((0, dom_1.defrag)(ns)))])], rest], ([, ns, rest], next) => next[0] === ']' ? global_1.undefined : (0, link_1.optimize)('[[', ns, rest)))))));
6693
6692
  const abbr = (0, combinator_1.creator)((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(util_1.regBlankStart, '')]));
6694
6693
 
6695
6694
  function attributes(ns) {
@@ -6878,7 +6877,7 @@ const dom_1 = __webpack_require__(3252);
6878
6877
 
6879
6878
  const array_1 = __webpack_require__(8112);
6880
6879
 
6881
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(3, (0, combinator_1.rewrite)((0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true), source => [[(0, dom_1.html)('span', {
6880
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.precedence)(2, (0, combinator_1.rewrite)((0, combinator_1.surround)('{{', (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}'), '}}', true), source => [[(0, dom_1.html)('span', {
6882
6881
  class: 'template'
6883
6882
  }, source.replace(/\x1B/g, ''))], '']))));
6884
6883
  const bracket = (0, combinator_1.lazy)(() => (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)]));
package/markdown.d.ts CHANGED
@@ -1,22 +1,6 @@
1
1
  import { Parser, Ctx } from './src/combinator/data/parser';
2
2
  import { Dict } from 'spica/dict';
3
3
 
4
- /*
5
-
6
- Operator precedence
7
-
8
- 9: \n, \\\n
9
- 8: `, "
10
- 7: $
11
- 6: (()), [[]]
12
- 5: <tag></tag>
13
- 4: [% %]
14
- 3: (), [], {}
15
- 2: ==, ++, ~~
16
- 1: *, **
17
-
18
- */
19
-
20
4
  declare abstract class Markdown<T> {
21
5
  private parser?: T;
22
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.257.1",
3
+ "version": "0.257.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",
@@ -21,7 +21,7 @@ export const annotation: AnnotationParser = lazy(() => creator(recursion(precede
21
21
  //link: true,
22
22
  //autolink: true,
23
23
  }}, delimiters: undefined },
24
- some(union([inline]), ')', [[/^\\?\n/, 9], [')', 3], ['))', 6]])), ')')),
24
+ some(union([inline]), ')', [[/^\\?\n/, 9], [')', 2], ['))', 6]])), ')')),
25
25
  '))',
26
26
  false,
27
27
  ([, ns], rest) => [[html('sup', { class: 'annotation' }, [html('span', trimNode(defrag(ns)))])], rest],
@@ -13,7 +13,7 @@ export const url: AutolinkParser.UrlParser = lazy(() => validate(['http://', 'ht
13
13
  url => `{ ${url} }`,
14
14
  union([textlink])))));
15
15
 
16
- const bracket: AutolinkParser.UrlParser.BracketParser = lazy(() => creator(precedence(3, union([
16
+ const bracket: AutolinkParser.UrlParser.BracketParser = lazy(() => creator(precedence(2, union([
17
17
  surround('(', some(union([bracket, unescsource]), ')'), ')', true),
18
18
  surround('[', some(union([bracket, unescsource]), ']'), ']', true),
19
19
  surround('{', some(union([bracket, unescsource]), '}'), '}', true),
@@ -39,6 +39,7 @@ describe('Unit: parser/inline/bracket', () => {
39
39
  assert.deepStrictEqual(inspect(parser('(ABBR, ABBR)')), [['(', 'ABBR, ABBR', ')'], '']);
40
40
  assert.deepStrictEqual(inspect(parser('(\\a)')), [['<span class="paren">(a)</span>'], '']);
41
41
  assert.deepStrictEqual(inspect(parser('(==)')), [['<span class="paren">(==)</span>'], '']);
42
+ assert.deepStrictEqual(inspect(parser('($)$')), [['', '(', '<span class="math" translate="no" data-src="$)$">$)$</span>'], '']);
42
43
  assert.deepStrictEqual(inspect(parser(')')), undefined);
43
44
  assert.deepStrictEqual(inspect(parser('(1,2)')), [['(', '1,2', ')'], '']);
44
45
  assert.deepStrictEqual(inspect(parser('(0-1)')), [['(', '0-1', ')'], '']);
@@ -55,6 +56,7 @@ describe('Unit: parser/inline/bracket', () => {
55
56
  assert.deepStrictEqual(inspect(parser('[a')), [['', '[', 'a'], '']);
56
57
  assert.deepStrictEqual(inspect(parser('[a]')), [['[', 'a', ']'], '']);
57
58
  assert.deepStrictEqual(inspect(parser('[==]')), [['[', '==', ']'], '']);
59
+ assert.deepStrictEqual(inspect(parser('[$]$')), [['', '[', '<span class="math" translate="no" data-src="$]$">$]$</span>'], '']);
58
60
  assert.deepStrictEqual(inspect(parser(']')), undefined);
59
61
  });
60
62
 
@@ -9,18 +9,18 @@ import { unshift, push } from 'spica/array';
9
9
  const index = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*/;
10
10
 
11
11
  export const bracket: BracketParser = lazy(() => creator(0, union([
12
- surround(str('('), precedence(3, str(index)), str(')')),
13
- surround(str('('), precedence(3, some(inline, ')', [[')', 3]])), str(')'), true,
12
+ surround(str('('), precedence(2, str(index)), str(')')),
13
+ surround(str('('), precedence(2, some(inline, ')', [[')', 2]])), str(')'), true,
14
14
  ([as, bs = [], cs], rest) => [[html('span', { class: 'paren' }, defrag(push(unshift(as, bs), cs)))], rest],
15
15
  ([as, bs = []], rest) => [unshift([''], unshift(as, bs)), rest]),
16
- surround(str('('), precedence(3, str(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), str(')')),
17
- surround(str('('), precedence(3, some(inline, ')', [[')', 3]])), str(')'), true,
16
+ surround(str('('), precedence(2, str(new RegExp(index.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => c.trimStart() && String.fromCharCode(c.charCodeAt(0) + 0xFEE0))))), str(')')),
17
+ surround(str('('), precedence(2, some(inline, ')', [[')', 2]])), str(')'), true,
18
18
  ([as, bs = [], cs], rest) => [[html('span', { class: 'paren' }, defrag(push(unshift(as, bs), cs)))], rest],
19
19
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
20
- surround(str('['), precedence(3, some(inline, ']', [[']', 3]])), str(']'), true,
20
+ surround(str('['), precedence(2, some(inline, ']', [[']', 2]])), str(']'), true,
21
21
  undefined,
22
22
  ([as, bs = []], rest) => [unshift([''], unshift(as, bs)), rest]),
23
- surround(str('{'), precedence(3, some(inline, '}', [['}', 3]])), str('}'), true,
23
+ surround(str('{'), precedence(2, some(inline, '}', [['}', 2]])), str('}'), true,
24
24
  undefined,
25
25
  ([as, bs = []], rest) => [unshift(as, bs), rest]),
26
26
  // Control media blinking in editing rather than control confusion of pairs of quote marks.
@@ -57,6 +57,7 @@ describe('Unit: parser/inline/comment', () => {
57
57
  assert.deepStrictEqual(inspect(parser('[% &amp;copy; %]')), [['<span class="comment"><input type="checkbox"><span>[% &amp;copy; %]</span></span>'], '']);
58
58
  assert.deepStrictEqual(inspect(parser('[% [ %]')), [['<span class="comment"><input type="checkbox"><span>[% [ %]</span></span>'], '']);
59
59
  assert.deepStrictEqual(inspect(parser('[% \\ a %]')), [['<span class="comment"><input type="checkbox"><span>[% a %]</span></span>'], '']);
60
+ assert.deepStrictEqual(inspect(parser('[% $-a %]$')), [['<span class="comment"><input type="checkbox"><span>[% <a class="label" data-label="$-a">$-a</a> %]</span></span>'], '$']);
60
61
  });
61
62
 
62
63
  });
@@ -6,7 +6,7 @@ import { blankWith } from '../util';
6
6
  import { html, defrag } from 'typed-dom/dom';
7
7
  import { unshift } from 'spica/array';
8
8
 
9
- export const deletion: DeletionParser = lazy(() => creator(precedence(2, surround(
9
+ export const deletion: DeletionParser = lazy(() => creator(precedence(1, surround(
10
10
  str('~~'),
11
11
  some(union([
12
12
  some(inline, blankWith('\n', '~~')),
@@ -9,7 +9,7 @@ import { html, define, defrag } from 'typed-dom/dom';
9
9
 
10
10
  import IndexParser = ExtensionParser.IndexParser;
11
11
 
12
- export const index: IndexParser = lazy(() => validate('[#', creator(precedence(3, fmap(indexee(surround(
12
+ export const index: IndexParser = lazy(() => validate('[#', creator(precedence(2, fmap(indexee(surround(
13
13
  '[#',
14
14
  guard(context => context.syntax?.inline?.index ?? true,
15
15
  startTight(
@@ -25,7 +25,7 @@ export const index: IndexParser = lazy(() => validate('[#', creator(precedence(3
25
25
  open(stropt(/^\|?/), trimBlankEnd(some(union([
26
26
  signature,
27
27
  inline,
28
- ]), ']', [[/^\\?\n/, 9], [']', 3]])), true)))),
28
+ ]), ']', [[/^\\?\n/, 9], [']', 2]])), true)))),
29
29
  ']',
30
30
  false,
31
31
  ([, ns], rest) => [[html('a', defrag(ns))], rest])),
@@ -10,9 +10,9 @@ import { unshift } from 'spica/array';
10
10
 
11
11
  // All syntax surrounded by square brackets shouldn't contain line breaks.
12
12
 
13
- export const placeholder: ExtensionParser.PlaceholderParser = lazy(() => validate(['[:', '[^'], creator(precedence(3, surround(
13
+ export const placeholder: ExtensionParser.PlaceholderParser = lazy(() => validate(['[:', '[^'], creator(precedence(2, surround(
14
14
  str(/^\[[:^]/),
15
- startTight(some(union([inline]), ']', [[/^\\?\n/, 9], [']', 3]])),
15
+ startTight(some(union([inline]), ']', [[/^\\?\n/, 9], [']', 2]])),
16
16
  str(']'), false,
17
17
  ([as, bs], rest) => [[
18
18
  html('span', {
@@ -6,7 +6,7 @@ import { blankWith } from '../util';
6
6
  import { html, defrag } from 'typed-dom/dom';
7
7
  import { unshift } from 'spica/array';
8
8
 
9
- export const insertion: InsertionParser = lazy(() => creator(precedence(2, surround(
9
+ export const insertion: InsertionParser = lazy(() => creator(precedence(1, surround(
10
10
  str('++'),
11
11
  some(union([
12
12
  some(inline, blankWith('\n', '++')),
@@ -15,7 +15,7 @@ const optspec = {
15
15
  } as const;
16
16
  Object.setPrototypeOf(optspec, null);
17
17
 
18
- export const link: LinkParser = lazy(() => validate(['[', '{'], creator(10, precedence(3, bind(
18
+ export const link: LinkParser = lazy(() => validate(['[', '{'], creator(10, precedence(2, bind(
19
19
  guard(context => context.syntax?.inline?.link ?? true,
20
20
  fmap(subsequence([
21
21
  context({ syntax: { inline: {
@@ -36,7 +36,7 @@ export const link: LinkParser = lazy(() => validate(['[', '{'], creator(10, prec
36
36
  media: false,
37
37
  autolink: false,
38
38
  }}},
39
- some(inline, ']', [[/^\\?\n/, 9], [']', 3]])),
39
+ some(inline, ']', [[/^\\?\n/, 9], [']', 2]])),
40
40
  ']',
41
41
  true,
42
42
  undefined,
@@ -69,7 +69,7 @@ export const link: LinkParser = lazy(() => validate(['[', '{'], creator(10, prec
69
69
  return [[define(el, attributes('link', [], optspec, params))], rest];
70
70
  })))));
71
71
 
72
- export const textlink: TextLinkParser = lazy(() => validate(['[', '{'], creator(10, precedence(3, bind(
72
+ export const textlink: TextLinkParser = lazy(() => validate(['[', '{'], creator(10, precedence(2, bind(
73
73
  reverse(tails([
74
74
  dup(surround('[', some(union([unescsource]), ']'), ']')),
75
75
  dup(surround(/^{(?![{}])/, inits([uri, some(option)]), /^[^\S\n]*}/)),
@@ -6,7 +6,7 @@ import { startTight, blankWith } from '../util';
6
6
  import { html, defrag } from 'typed-dom/dom';
7
7
  import { unshift } from 'spica/array';
8
8
 
9
- export const mark: MarkParser = lazy(() => creator(precedence(2, surround(
9
+ export const mark: MarkParser = lazy(() => creator(precedence(1, surround(
10
10
  str('=='),
11
11
  startTight(some(union([
12
12
  some(inline, blankWith('==')),
@@ -1,20 +1,19 @@
1
1
  import { MathParser } from '../inline';
2
- import { union, some, validate, rewrite, precedence, creator, surround, lazy } from '../../combinator';
3
- import { escsource, str } from '../source';
2
+ import { union, some, validate, focus, rewrite, precedence, creator, surround, lazy } from '../../combinator';
3
+ import { escsource, unescsource } from '../source';
4
4
  import { html } from 'typed-dom/dom';
5
5
 
6
- const syntax = /^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/;
7
6
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])/i;
8
7
 
9
- export const math: MathParser = lazy(() => validate('$', creator(precedence(7, rewrite(
8
+ export const math: MathParser = lazy(() => validate('$', creator(rewrite(
10
9
  union([
11
- surround('$', bracket, '$'),
10
+ surround('$', precedence(6, bracket), '$'),
12
11
  surround(
13
12
  /^\$(?![\s{}])/,
14
- some(union([
13
+ precedence(3, some(union([
15
14
  bracket,
16
- str(syntax),
17
- ])),
15
+ focus(/^(?:[ ([](?!\$)|\\[\\{}$]?|[!#%&')\x2A-\x5A\]^_\x61-\x7A|~])+/, some(unescsource)),
16
+ ]))),
18
17
  /^\$(?![0-9A-Za-z])/),
19
18
  ]),
20
19
  (source, { caches: { math: cache } = {} }) => [[
@@ -30,7 +29,7 @@ export const math: MathParser = lazy(() => validate('$', creator(precedence(7, r
30
29
  'data-invalid-message': `"${source.match(forbiddenCommand)![0]}" command is forbidden`,
31
30
  },
32
31
  source)
33
- ], ''])))));
32
+ ], '']))));
34
33
 
35
34
  const bracket: MathParser.BracketParser = lazy(() => creator(surround(
36
35
  '{',
@@ -17,7 +17,7 @@ const optspec = {
17
17
  } as const;
18
18
  Object.setPrototypeOf(optspec, null);
19
19
 
20
- export const media: MediaParser = lazy(() => validate(['![', '!{'], creator(10, precedence(3, bind(verify(fmap(open(
20
+ export const media: MediaParser = lazy(() => validate(['![', '!{'], creator(10, precedence(2, bind(verify(fmap(open(
21
21
  '!',
22
22
  guard(context => context.syntax?.inline?.media ?? true,
23
23
  tails([
@@ -23,8 +23,8 @@ export const reference: ReferenceParser = lazy(() => validate('[[', creator(recu
23
23
  }}, delimiters: undefined },
24
24
  subsequence([
25
25
  abbr,
26
- open(stropt(/^(?=\^)/), some(inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]])),
27
- some(inline, ']', [[/^\\?\n/, 9], [']', 3], [']]', 6]]),
26
+ open(stropt(/^(?=\^)/), some(inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]])),
27
+ some(inline, ']', [[/^\\?\n/, 9], [']', 2], [']]', 6]]),
28
28
  ])), ']')),
29
29
  ']]',
30
30
  false,
@@ -5,7 +5,7 @@ import { escsource, str } from '../source';
5
5
  import { html } from 'typed-dom/dom';
6
6
  import { unshift } from 'spica/array';
7
7
 
8
- export const template: TemplateParser = lazy(() => creator(precedence(3, rewrite(
8
+ export const template: TemplateParser = lazy(() => creator(precedence(2, rewrite(
9
9
  surround('{{', some(union([bracket, escsource]), '}'), '}}', true),
10
10
  source => [[html('span', { class: 'template' }, source.replace(/\x1B/g, ''))], '']))));
11
11
 
@@ -146,6 +146,7 @@ describe('Unit: parser/inline', () => {
146
146
  assert.deepStrictEqual(inspect(parser('((((a))')), [['', '((', '<sup class="annotation"><span>a</span></sup>'], '']);
147
147
  assert.deepStrictEqual(inspect(parser('((((a))))')), [['<sup class="annotation"><span><span class="paren">((a))</span></span></sup>'], '']);
148
148
  assert.deepStrictEqual(inspect(parser('((<bdi>))')), [['<sup class="annotation"><span><span class="invalid">&lt;bdi&gt;</span></span></sup>'], '']);
149
+ assert.deepStrictEqual(inspect(parser('((${))}$')), [['', '((', '<span class="math" translate="no" data-src="${))}$">${))}$</span>'], '']);
149
150
  assert.deepStrictEqual(inspect(parser('"((""))')), [['"', '<sup class="annotation"><span>""</span></sup>'], '']);
150
151
  assert.deepStrictEqual(inspect(parser('[[[a]]')), [['', '[', '<sup class="reference"><span>a</span></sup>'], '']);
151
152
  assert.deepStrictEqual(inspect(parser('[[[[a]]')), [['', '[[', '<sup class="reference"><span>a</span></sup>'], '']);
@@ -155,6 +156,7 @@ describe('Unit: parser/inline', () => {
155
156
  assert.deepStrictEqual(inspect(parser('[[[a]{b}]]')), [['<sup class="reference"><span><a href="b">a</a></span></sup>'], '']);
156
157
  assert.deepStrictEqual(inspect(parser('[(([a]{#}))]{#}')), [['<a href="#"><span class="paren">(<span class="paren">([a]{#})</span>)</span></a>'], '']);
157
158
  assert.deepStrictEqual(inspect(parser('[[<bdi>]]')), [['<sup class="reference"><span><span class="invalid">&lt;bdi&gt;</span></span></sup>'], '']);
159
+ assert.deepStrictEqual(inspect(parser('[[${]]}$')), [['', '[[', '<span class="math" translate="no" data-src="${]]}$">${]]}$</span>'], '']);
158
160
  assert.deepStrictEqual(inspect(parser('"[[""]]')), [['"', '<sup class="reference"><span>""</span></sup>'], '']);
159
161
  assert.deepStrictEqual(inspect(parser('[[a](b)]{c}')), [['<a href="c"><ruby>a<rp>(</rp><rt>b</rt><rp>)</rp></ruby></a>'], '']);
160
162
  assert.deepStrictEqual(inspect(parser('<http://host>')), [['<', '<a href="http://host" target="_blank">http://host</a>', '>'], '']);