securemark 0.232.2 → 0.233.0

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.233.0
4
+
5
+ - Refine comment parser.
6
+
3
7
  ## 0.232.2
4
8
 
5
9
  - Refactoring.
@@ -1,4 +1,4 @@
1
- /*! securemark v0.232.2 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.233.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
2
2
  require = function () {
3
3
  function r(e, n, t) {
4
4
  function o(i, f) {
@@ -4861,7 +4861,7 @@ require = function () {
4861
4861
  'data-invalid-description': 'Missing the title at the first line.'
4862
4862
  }, `${ opener }${ body }${ closer }`)];
4863
4863
  return [(0, typed_dom_1.html)('aside', {
4864
- id: (0, indexee_1.identity)(heading),
4864
+ id: (0, indexee_1.identity)((0, indexee_1.text)(heading)),
4865
4865
  class: 'aside'
4866
4866
  }, [
4867
4867
  document,
@@ -5307,9 +5307,9 @@ require = function () {
5307
5307
  let [, rowspan = global_1.undefined, colspan = global_1.undefined, highlight = global_1.undefined] = (_a = source.match(/^.(?:(\d+)?:(\d+)?)?(!+)?$/)) !== null && _a !== void 0 ? _a : [];
5308
5308
  rowspan === '1' ? rowspan = global_1.undefined : global_1.undefined;
5309
5309
  colspan === '1' ? colspan = global_1.undefined : global_1.undefined;
5310
- rowspan && (rowspan = (0, alias_1.max)(0, (0, alias_1.min)(+rowspan, 65534)) + '');
5311
- colspan && (colspan = (0, alias_1.max)(0, (0, alias_1.min)(+colspan, 1000)) + '');
5312
- highlight && (highlight = highlight.length > 0 ? highlight.length + '' : global_1.undefined);
5310
+ rowspan && (rowspan = `${ (0, alias_1.max)(0, (0, alias_1.min)(+rowspan, 65534)) }`);
5311
+ colspan && (colspan = `${ (0, alias_1.max)(0, (0, alias_1.min)(+colspan, 1000)) }`);
5312
+ highlight && (highlight = highlight.length > 0 ? `${ highlight.length }` : global_1.undefined);
5313
5313
  const valid = !highlight || source[0] === '#' && +highlight <= 1 || source[0] === ':' && +highlight <= 6;
5314
5314
  return {
5315
5315
  class: valid ? highlight && 'highlight' : 'invalid',
@@ -5851,7 +5851,7 @@ require = function () {
5851
5851
  (0, combinator_1.validate)(new RegExp(`${ anchor_1.syntax.source }[^\S\n]*(?:$|\n)`), anchor_1.anchor)
5852
5852
  ]))), ([el, quotes = '']) => [
5853
5853
  (0, typed_dom_1.html)('span', { class: 'cite' }, (0, typed_dom_1.defrag)([
5854
- quotes + '>',
5854
+ `${ quotes }>`,
5855
5855
  (0, typed_dom_1.define)(el, { 'data-depth': `${ quotes.length + 1 }` }, el.innerText.slice(1))
5856
5856
  ])),
5857
5857
  (0, typed_dom_1.html)('br')
@@ -6146,11 +6146,11 @@ require = function () {
6146
6146
  const annotation_1 = _dereq_('./inline/annotation');
6147
6147
  const reference_1 = _dereq_('./inline/reference');
6148
6148
  const template_1 = _dereq_('./inline/template');
6149
+ const comment_1 = _dereq_('./inline/comment');
6149
6150
  const extension_1 = _dereq_('./inline/extension');
6150
6151
  const ruby_1 = _dereq_('./inline/ruby');
6151
6152
  const link_1 = _dereq_('./inline/link');
6152
6153
  const html_1 = _dereq_('./inline/html');
6153
- const comment_1 = _dereq_('./inline/comment');
6154
6154
  const insertion_1 = _dereq_('./inline/insertion');
6155
6155
  const deletion_1 = _dereq_('./inline/deletion');
6156
6156
  const mark_1 = _dereq_('./inline/mark');
@@ -6170,12 +6170,12 @@ require = function () {
6170
6170
  annotation_1.annotation,
6171
6171
  reference_1.reference,
6172
6172
  template_1.template,
6173
+ comment_1.comment,
6173
6174
  extension_1.extension,
6174
6175
  ruby_1.ruby,
6175
6176
  link_1.link,
6176
6177
  media_1.media,
6177
6178
  html_1.html,
6178
- comment_1.comment,
6179
6179
  insertion_1.insertion,
6180
6180
  deletion_1.deletion,
6181
6181
  mark_1.mark,
@@ -6606,52 +6606,28 @@ require = function () {
6606
6606
  'use strict';
6607
6607
  Object.defineProperty(exports, '__esModule', { value: true });
6608
6608
  exports.comment = void 0;
6609
- const combinator_1 = _dereq_('../../combinator');
6610
6609
  const parser_1 = _dereq_('../../combinator/data/parser');
6611
- const htmlentity_1 = _dereq_('./htmlentity');
6610
+ const combinator_1 = _dereq_('../../combinator');
6611
+ const inline_1 = _dereq_('../inline');
6612
6612
  const source_1 = _dereq_('../source');
6613
6613
  const typed_dom_1 = _dereq_('typed-dom');
6614
- exports.comment = (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.match)(/^\[(#+)(?!\S|\s+\1\]|\s*\[\1(?:$|\s))((?:\s+\S+)+?)(?:\s+(\1\])|\s*(?=\[\1(?:$|\s)))/, ([whole, , body, closer]) => (rest, context) => {
6615
- [whole, body] = `${ whole }\0${ body.trimStart() }`.replace(/\x1B/g, '').split('\0', 2);
6616
- if (!closer)
6617
- return [
6618
- [(0, typed_dom_1.html)('sup', {
6619
- class: 'comment invalid',
6620
- 'data-invalid-syntax': 'comment',
6621
- 'data-invalid-type': 'content',
6622
- 'data-invalid-description': 'Comment syntax using the same level cannot start in another comment syntax.'
6623
- }, whole)],
6624
- rest
6625
- ];
6626
- const title = (0, parser_1.eval)((0, combinator_1.some)(text)(body, context), []).join('').trim();
6627
- if (title.includes('\0'))
6628
- return [
6629
- [(0, typed_dom_1.html)('sup', {
6630
- class: 'comment invalid',
6631
- 'data-invalid-syntax': 'comment',
6632
- 'data-invalid-type': 'content',
6633
- 'data-invalid-description': `Invalid HTML entitiy "${ title.match(/\0&[0-9A-Za-z]+;/)[0].slice(1) }".`
6634
- }, whole)],
6635
- rest
6636
- ];
6637
- return [
6638
- [(0, typed_dom_1.html)('sup', {
6639
- class: 'comment',
6640
- title
6641
- })],
6642
- rest
6643
- ];
6644
- })));
6645
- const text = (0, combinator_1.union)([
6646
- htmlentity_1.unsafehtmlentity,
6647
- source_1.unescsource
6648
- ]);
6614
+ const memoize_1 = _dereq_('spica/memoize');
6615
+ const array_1 = _dereq_('spica/array');
6616
+ exports.comment = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.match)(/^(?=\[(#+)\s)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^\s+${ fence }\]`)) => (0, combinator_1.surround)((0, source_1.str)(/^\[(\S+)\s+(?!\1\])/), (0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, closer)]), (0, source_1.str)(closer), true, ([, bs = []], rest) => [
6617
+ [(0, typed_dom_1.html)('span', { class: 'comment' }, (0, typed_dom_1.defrag)((0, array_1.push)((0, array_1.unshift)([`[${ fence } `], bs), [` ${ fence }]`])))],
6618
+ rest
6619
+ ], ([as, bs = []], rest, context) => [
6620
+ (0, array_1.unshift)((0, array_1.pop)((0, parser_1.eval)((0, combinator_1.some)(source_1.text)(`${ as[0] }!`, context)))[0], bs),
6621
+ rest
6622
+ ]), ([, fence]) => fence)))));
6649
6623
  },
6650
6624
  {
6651
6625
  '../../combinator': 27,
6652
6626
  '../../combinator/data/parser': 47,
6627
+ '../inline': 88,
6653
6628
  '../source': 128,
6654
- './htmlentity': 112,
6629
+ 'spica/array': 6,
6630
+ 'spica/memoize': 18,
6655
6631
  'typed-dom': 26
6656
6632
  }
6657
6633
  ],
@@ -6890,7 +6866,7 @@ require = function () {
6890
6866
  source_1.txt
6891
6867
  ]), ']', /^\\?\n/))), ns => [(0, typed_dom_1.html)('span', {
6892
6868
  class: 'indexer',
6893
- 'data-index': (0, indexee_1.identify)((0, array_1.join)(ns).trim()).slice(6)
6869
+ 'data-index': (0, indexee_1.identity)((0, array_1.join)(ns)).slice(6)
6894
6870
  })])));
6895
6871
  const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.union)([
6896
6872
  (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([
@@ -6923,45 +6899,50 @@ require = function () {
6923
6899
  function (_dereq_, module, exports) {
6924
6900
  'use strict';
6925
6901
  Object.defineProperty(exports, '__esModule', { value: true });
6926
- exports.identify = exports.text = exports.identity = exports.indexee = void 0;
6902
+ exports.text = exports.identity = exports.indexee = void 0;
6927
6903
  const global_1 = _dereq_('spica/global');
6928
6904
  const combinator_1 = _dereq_('../../../combinator');
6929
6905
  const typed_dom_1 = _dereq_('typed-dom');
6930
6906
  function indexee(parser) {
6931
- return (0, combinator_1.fmap)(parser, ([el], _, {id}) => [(0, typed_dom_1.define)(el, { id: id !== '' && identity(el) || global_1.undefined })]);
6907
+ return (0, combinator_1.fmap)(parser, ([el], _, {id}) => [(0, typed_dom_1.define)(el, { id: id !== '' && identity(text(el)) || global_1.undefined })]);
6932
6908
  }
6933
6909
  exports.indexee = indexee;
6934
- function identity(source) {
6935
- return identify(text(source).trim());
6910
+ function identity(index) {
6911
+ return `index:${ index.trim().replace(/\s+/g, '_').slice(0, 101).replace(/^(.{97}).{4}$/, '$1...') }`;
6936
6912
  }
6937
6913
  exports.identity = identity;
6938
6914
  function text(source) {
6915
+ var _a;
6939
6916
  const indexer = source.querySelector('.indexer');
6940
6917
  if (indexer)
6941
6918
  return indexer.getAttribute('data-index');
6942
6919
  const target = source.cloneNode(true);
6943
- for (let es = target.querySelectorAll('code[data-src], .math[data-src], rt, rp, .reference'), i = 0, len = es.length; i < len; ++i) {
6920
+ for (let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference'), i = 0, len = es.length; i < len; ++i) {
6944
6921
  const el = es[i];
6945
6922
  switch (el.tagName) {
6923
+ case 'CODE':
6924
+ (0, typed_dom_1.define)(el, el.getAttribute('data-src'));
6925
+ continue;
6946
6926
  case 'RT':
6947
6927
  case 'RP':
6948
6928
  el.remove();
6949
6929
  continue;
6950
- case 'SUP':
6951
- el.firstChild.remove();
6952
- continue;
6953
- default:
6930
+ }
6931
+ switch (el.className) {
6932
+ case 'math':
6954
6933
  (0, typed_dom_1.define)(el, el.getAttribute('data-src'));
6955
6934
  continue;
6935
+ case 'comment':
6936
+ el.remove();
6937
+ continue;
6938
+ case 'reference':
6939
+ el.firstChild.remove();
6940
+ continue;
6956
6941
  }
6957
6942
  }
6958
6943
  return target.textContent;
6959
6944
  }
6960
6945
  exports.text = text;
6961
- function identify(index) {
6962
- return index ? `index:${ index.replace(/\s+/g, '_').slice(0, 101).replace(/^(.{97}).{4}$/, '$1...') }` : '';
6963
- }
6964
- exports.identify = identify;
6965
6946
  },
6966
6947
  {
6967
6948
  '../../../combinator': 27,
@@ -7699,7 +7680,7 @@ require = function () {
7699
7680
  class: 'reference',
7700
7681
  'data-abbr': (0, util_1.stringify)([ns.shift()]).trimEnd()
7701
7682
  } : ns[0] === '' ? {
7702
- class: 'reference invalid',
7683
+ class: 'invalid',
7703
7684
  'data-invalid-syntax': 'reference',
7704
7685
  'data-invalid-type': 'syntax',
7705
7686
  'data-invalid-description': 'Invalid abbr.'
@@ -8658,7 +8639,6 @@ require = function () {
8658
8639
  const global_1 = _dereq_('spica/global');
8659
8640
  const parser_1 = _dereq_('../combinator/data/parser');
8660
8641
  const combinator_1 = _dereq_('../combinator');
8661
- const comment_1 = _dereq_('./inline/comment');
8662
8642
  const htmlentity_1 = _dereq_('./inline/htmlentity');
8663
8643
  const source_1 = _dereq_('./source');
8664
8644
  const array_1 = _dereq_('spica/array');
@@ -8696,10 +8676,10 @@ require = function () {
8696
8676
  'InvisibleComma',
8697
8677
  'ic'
8698
8678
  ];
8699
- const blankline = new RegExp(String.raw`^(?!$)(?:\\$|\\?[^\S\n]|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr>|\[(#+)(?!\S|\s+\1\]|\s*\[\1(?:$|\s))((?:\s+\S+)+?)(?:\s+(\1\])|\s*(?=\[\1(?:$|\s))))+(?=$|(\S))`, 'gm');
8679
+ const blankline = new RegExp(String.raw`^(?!$)(?:\\$|\\?[^\S\n]|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr>)+$`, 'gm');
8700
8680
  function visualize(parser) {
8701
8681
  return (0, combinator_1.union)([
8702
- (0, combinator_1.convert)(source => source.replace(blankline, (line, ...$) => !$[3] ? line.replace(/[\\&<\[]/g, '\x1B$&') : line), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))),
8682
+ (0, combinator_1.convert)(source => source.replace(blankline, line => line.replace(/[\\&<]/g, '\x1B$&')), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))),
8703
8683
  (0, combinator_1.some)((0, combinator_1.union)([
8704
8684
  source_1.linebreak,
8705
8685
  source_1.unescsource
@@ -8745,7 +8725,7 @@ require = function () {
8745
8725
  }
8746
8726
  exports.startTight = startTight;
8747
8727
  function isStartTight(source, context) {
8748
- var _a, _b, _c, _d, _e;
8728
+ var _a, _b, _c;
8749
8729
  if (source === '')
8750
8730
  return true;
8751
8731
  switch (source[0]) {
@@ -8769,12 +8749,6 @@ require = function () {
8769
8749
  return false;
8770
8750
  }
8771
8751
  return true;
8772
- case '[':
8773
- switch (true) {
8774
- case source.length >= 7 && source[1] === '#' && ((_d = (0, parser_1.eval)((0, comment_1.comment)(source, context))) === null || _d === void 0 ? void 0 : _d[0].className) === 'comment':
8775
- return false;
8776
- }
8777
- return true;
8778
8752
  default:
8779
8753
  return source[0].trimStart() !== '';
8780
8754
  }
@@ -8790,8 +8764,6 @@ require = function () {
8790
8764
  return true;
8791
8765
  for (let i = nodes.length; i--;) {
8792
8766
  const node = nodes[i];
8793
- if (typeof node === 'object' && node.className === 'comment')
8794
- continue;
8795
8767
  return isVisible(node, -1);
8796
8768
  }
8797
8769
  return false;
@@ -8817,8 +8789,6 @@ require = function () {
8817
8789
  return false;
8818
8790
  case 'SPAN':
8819
8791
  return node.className !== 'linebreak';
8820
- case 'SUP':
8821
- return node.className !== 'comment';
8822
8792
  default:
8823
8793
  return true;
8824
8794
  }
@@ -8832,8 +8802,6 @@ require = function () {
8832
8802
  for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[0], 0);) {
8833
8803
  if (nodes.length === 1 && typeof node === 'object' && node.className === 'indexer')
8834
8804
  break;
8835
- if (typeof node === 'object' && node.className === 'comment')
8836
- break;
8837
8805
  if (typeof node === 'string') {
8838
8806
  const pos = node.length - node.trimStart().length;
8839
8807
  if (pos > 0) {
@@ -8848,8 +8816,6 @@ require = function () {
8848
8816
  function trimNodeEnd(nodes) {
8849
8817
  const skip = nodes.length > 0 && typeof nodes[nodes.length - 1] === 'object' && nodes[nodes.length - 1]['className'] === 'indexer' ? [nodes.pop()] : [];
8850
8818
  for (let node = nodes[0]; nodes.length > 0 && !isVisible(node = nodes[nodes.length - 1], -1);) {
8851
- if (typeof node === 'object' && node.className === 'comment')
8852
- break;
8853
8819
  if (typeof node === 'string') {
8854
8820
  const pos = node.trimEnd().length;
8855
8821
  if (pos > 0) {
@@ -8886,7 +8852,6 @@ require = function () {
8886
8852
  {
8887
8853
  '../combinator': 27,
8888
8854
  '../combinator/data/parser': 47,
8889
- './inline/comment': 100,
8890
8855
  './inline/htmlentity': 112,
8891
8856
  './source': 128,
8892
8857
  'spica/array': 6,
package/markdown.d.ts CHANGED
@@ -557,11 +557,11 @@ export namespace MarkdownParser {
557
557
  // abc
558
558
  Block<'reply'>,
559
559
  Parser<HTMLParagraphElement, Context, [
560
- Parser<string | HTMLElement, Context, [
560
+ Parser<HTMLElement, Context, [
561
561
  ReplyParser.CiteParser,
562
562
  ReplyParser.QuoteParser,
563
563
  ]>,
564
- Parser<string | HTMLElement, Context, [
564
+ Parser<HTMLElement | string, Context, [
565
565
  ReplyParser.QuoteParser,
566
566
  InlineParser,
567
567
  ]>,
@@ -619,12 +619,12 @@ export namespace MarkdownParser {
619
619
  InlineParser.AnnotationParser,
620
620
  InlineParser.ReferenceParser,
621
621
  InlineParser.TemplateParser,
622
+ InlineParser.CommentParser,
622
623
  InlineParser.ExtensionParser,
623
624
  InlineParser.RubyParser,
624
625
  InlineParser.LinkParser,
625
626
  InlineParser.MediaParser,
626
627
  InlineParser.HTMLParser,
627
- InlineParser.CommentParser,
628
628
  InlineParser.InsertionParser,
629
629
  InlineParser.DeletionParser,
630
630
  InlineParser.MarkParser,
@@ -709,6 +709,13 @@ export namespace MarkdownParser {
709
709
  ]> {
710
710
  }
711
711
  }
712
+ export interface CommentParser extends
713
+ // [# comment #]
714
+ Inline<'comment'>,
715
+ Parser<HTMLElement | string, Context, [
716
+ InlineParser,
717
+ ]> {
718
+ }
712
719
  export interface ExtensionParser extends
713
720
  // [#abc]
714
721
  Inline<'extension'>,
@@ -941,22 +948,6 @@ export namespace MarkdownParser {
941
948
  }
942
949
  }
943
950
  }
944
- export interface CommentParser extends
945
- // [# comment #]
946
- Inline<'comment'>,
947
- Parser<HTMLElement, Context, [
948
- CommentParser.TextParser,
949
- ]> {
950
- }
951
- export namespace CommentParser {
952
- export interface TextParser extends
953
- Inline<'comment/text'>,
954
- Parser<string, Context, [
955
- UnsafeHTMLEntityParser,
956
- SourceParser.UnescapableSourceParser,
957
- ]> {
958
- }
959
- }
960
951
  export interface InsertionParser extends
961
952
  // ++abc++
962
953
  Inline<'insertion'>,
@@ -1030,7 +1021,7 @@ export namespace MarkdownParser {
1030
1021
  export interface HTMLEntityParser extends
1031
1022
  // &copy;
1032
1023
  Inline<'htmlentity'>,
1033
- Parser<HTMLSpanElement | string, Context, [
1024
+ Parser<string | HTMLSpanElement, Context, [
1034
1025
  UnsafeHTMLEntityParser,
1035
1026
  ]> {
1036
1027
  }
@@ -1153,7 +1144,7 @@ export namespace MarkdownParser {
1153
1144
  }
1154
1145
  export interface AutolinkParser extends
1155
1146
  Markdown<'autolink'>,
1156
- Parser<HTMLElement | string, Context, [
1147
+ Parser<string | HTMLElement, Context, [
1157
1148
  InlineParser.AutolinkParser,
1158
1149
  SourceParser.LinebreakParser,
1159
1150
  SourceParser.UnescapableSourceParser,
@@ -1164,7 +1155,7 @@ export namespace MarkdownParser {
1164
1155
  export interface TextParser extends
1165
1156
  // abc
1166
1157
  Source<'text'>,
1167
- Parser<HTMLBRElement | HTMLSpanElement | string, Context, []> {
1158
+ Parser<string | HTMLBRElement | HTMLSpanElement, Context, []> {
1168
1159
  }
1169
1160
  export interface TxtParser extends
1170
1161
  // abc
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.232.2",
3
+ "version": "0.233.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -422,12 +422,12 @@
422
422
  }
423
423
  },
424
424
  "@npmcli/fs": {
425
- "version": "1.1.1",
426
- "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz",
427
- "integrity": "sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==",
425
+ "version": "2.1.0",
426
+ "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.0.tgz",
427
+ "integrity": "sha512-DmfBvNXGaetMxj9LTp8NAN9vEidXURrf5ZTslQzEAi/6GbW+4yjaLFQc6Tue5cpZ9Frlk4OBo/Snf1Bh/S7qTQ==",
428
428
  "dev": true,
429
429
  "requires": {
430
- "@gar/promisify": "^1.0.1",
430
+ "@gar/promisify": "^1.1.3",
431
431
  "semver": "^7.3.5"
432
432
  }
433
433
  },
@@ -618,9 +618,9 @@
618
618
  "dev": true
619
619
  },
620
620
  "@types/node": {
621
- "version": "17.0.22",
622
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.22.tgz",
623
- "integrity": "sha512-8FwbVoG4fy+ykY86XCAclKZDORttqE5/s7dyWZKLXTdv3vRy5HozBEinG5IqhvPXXzIZEcTVbuHlQEI6iuwcmw==",
621
+ "version": "17.0.23",
622
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.23.tgz",
623
+ "integrity": "sha512-UxDxWn7dl97rKVeVS61vErvw086aCYhDLyvRQZ5Rk65rZKepaFdm53GeqXaKBuOhED4e9uWq34IC3TdSdJJ2Gw==",
624
624
  "dev": true
625
625
  },
626
626
  "@types/power-assert": {
@@ -1772,18 +1772,18 @@
1772
1772
  "dev": true
1773
1773
  },
1774
1774
  "cacache": {
1775
- "version": "16.0.2",
1776
- "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.0.2.tgz",
1777
- "integrity": "sha512-Q17j7s8X81i/QYVrKVQ/qwWGT+pYLfpTcZ+X+p/Qw9FULy9JEfb2FECYTTt6mPV6A/vk92nRZ80ncpKxiGTrIA==",
1775
+ "version": "16.0.3",
1776
+ "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.0.3.tgz",
1777
+ "integrity": "sha512-eC7wYodNCVb97kuHGk5P+xZsvUJHkhSEOyNwkenqQPAsOtrTjvWOE5vSPNBpz9d8X3acIf6w2Ub5s4rvOCTs4g==",
1778
1778
  "dev": true,
1779
1779
  "requires": {
1780
- "@npmcli/fs": "^1.0.0",
1780
+ "@npmcli/fs": "^2.1.0",
1781
1781
  "@npmcli/move-file": "^1.1.2",
1782
1782
  "chownr": "^2.0.0",
1783
1783
  "fs-minipass": "^2.1.0",
1784
1784
  "glob": "^7.2.0",
1785
1785
  "infer-owner": "^1.0.4",
1786
- "lru-cache": "^7.5.1",
1786
+ "lru-cache": "^7.7.1",
1787
1787
  "minipass": "^3.1.6",
1788
1788
  "minipass-collect": "^1.0.2",
1789
1789
  "minipass-flush": "^1.0.5",
@@ -1924,9 +1924,9 @@
1924
1924
  "dev": true
1925
1925
  },
1926
1926
  "caniuse-lite": {
1927
- "version": "1.0.30001319",
1928
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001319.tgz",
1929
- "integrity": "sha512-xjlIAFHucBRSMUo1kb5D4LYgcN1M45qdKP++lhqowDpwJwGkpIRTt5qQqnhxjj1vHcI7nrJxWhCC1ATrCEBTcw==",
1927
+ "version": "1.0.30001320",
1928
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001320.tgz",
1929
+ "integrity": "sha512-MWPzG54AGdo3nWx7zHZTefseM5Y1ccM7hlQKHRqJkPozUaw3hNbBTMmLn16GG2FUzjR13Cr3NPfhIieX5PzXDA==",
1930
1930
  "dev": true
1931
1931
  },
1932
1932
  "chalk": {
@@ -3030,9 +3030,9 @@
3030
3030
  "dev": true
3031
3031
  },
3032
3032
  "electron-to-chromium": {
3033
- "version": "1.4.89",
3034
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.89.tgz",
3035
- "integrity": "sha512-z1Axg0Fu54fse8wN4fd+GAINdU5mJmLtcl6bqIcYyzNVGONcfHAeeJi88KYMQVKalhXlYuVPzKkFIU5VD0raUw==",
3033
+ "version": "1.4.92",
3034
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.92.tgz",
3035
+ "integrity": "sha512-YAVbvQIcDE/IJ/vzDMjD484/hsRbFPW2qXJPaYTfOhtligmfYEYOep+5QojpaEU9kq6bMvNeC2aG7arYvTHYsA==",
3036
3036
  "dev": true
3037
3037
  },
3038
3038
  "elliptic": {
@@ -7344,13 +7344,13 @@
7344
7344
  "dev": true
7345
7345
  },
7346
7346
  "micromatch": {
7347
- "version": "4.0.4",
7348
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz",
7349
- "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==",
7347
+ "version": "4.0.5",
7348
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
7349
+ "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
7350
7350
  "dev": true,
7351
7351
  "requires": {
7352
- "braces": "^3.0.1",
7353
- "picomatch": "^2.2.3"
7352
+ "braces": "^3.0.2",
7353
+ "picomatch": "^2.3.1"
7354
7354
  }
7355
7355
  },
7356
7356
  "miller-rabin": {
@@ -7450,9 +7450,9 @@
7450
7450
  }
7451
7451
  },
7452
7452
  "minipass-fetch": {
7453
- "version": "2.0.3",
7454
- "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.0.3.tgz",
7455
- "integrity": "sha512-VA+eiiUtaIvpQJXISwE3OiMvQwAWrgKb97F0aXlCS1Ahikr8fEQq8m3Hf7Kv9KT3nokuHigJKsDMB6atU04olQ==",
7453
+ "version": "2.1.0",
7454
+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.0.tgz",
7455
+ "integrity": "sha512-H9U4UVBGXEyyWJnqYDCLp1PwD8XIkJ4akNHp1aGVI+2Ym7wQMlxDKi4IB4JbmyU+pl9pEs/cVrK6cOuvmbK4Sg==",
7456
7456
  "dev": true,
7457
7457
  "requires": {
7458
7458
  "encoding": "^0.1.13",
@@ -7530,12 +7530,12 @@
7530
7530
  }
7531
7531
  },
7532
7532
  "mkdirp": {
7533
- "version": "0.5.5",
7534
- "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz",
7535
- "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==",
7533
+ "version": "0.5.6",
7534
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
7535
+ "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
7536
7536
  "dev": true,
7537
7537
  "requires": {
7538
- "minimist": "^1.2.5"
7538
+ "minimist": "^1.2.6"
7539
7539
  }
7540
7540
  },
7541
7541
  "mkdirp-classic": {
@@ -8180,17 +8180,17 @@
8180
8180
  }
8181
8181
  },
8182
8182
  "npm-registry-fetch": {
8183
- "version": "13.0.1",
8184
- "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-13.0.1.tgz",
8185
- "integrity": "sha512-Ak+LXVtSrCLOdscFW/apUw67OPNph8waHsPKM9UOJosL7i59EF5XoSWQMEsXEOeifM9Bb4/2+WrQC4t/pd8DGg==",
8183
+ "version": "13.1.0",
8184
+ "resolved": "https://registry.npmjs.org/npm-registry-fetch/-/npm-registry-fetch-13.1.0.tgz",
8185
+ "integrity": "sha512-TIYL5X8CcwDhbFMXFDShNcpG6OMCYK6VzvSr6MUWP20tCU2DJ4ao2qQg3DT+3Pet8mO6/cgbZpon4LMh3duYLg==",
8186
8186
  "dev": true,
8187
8187
  "requires": {
8188
- "make-fetch-happen": "^10.0.3",
8188
+ "make-fetch-happen": "^10.0.6",
8189
8189
  "minipass": "^3.1.6",
8190
- "minipass-fetch": "^2.0.1",
8190
+ "minipass-fetch": "^2.0.3",
8191
8191
  "minipass-json-stream": "^1.0.1",
8192
8192
  "minizlib": "^2.1.2",
8193
- "npm-package-arg": "^9.0.0",
8193
+ "npm-package-arg": "^9.0.1",
8194
8194
  "proc-log": "^2.0.0"
8195
8195
  }
8196
8196
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.232.2",
3
+ "version": "0.233.0",
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",
@@ -53,10 +53,10 @@ describe('Unit: parser/api/parse', () => {
53
53
  ['<p>&lt;wbr&gt;<br>a</p>']);
54
54
  assert.deepStrictEqual(
55
55
  [...parse('[#\n<wbr>\n#]').children].map(el => el.outerHTML),
56
- ['<p>[#<br>&lt;wbr&gt;<br>#]</p>']);
56
+ ['<p><span class="comment">[# &lt;wbr&gt; #]</span></p>']);
57
57
  assert.deepStrictEqual(
58
58
  [...parse('[#\n<wbr>\n#]\na').children].map(el => el.outerHTML),
59
- ['<p>[#<br>&lt;wbr&gt;<br>#]<br>a</p>']);
59
+ ['<p><span class="comment">[# &lt;wbr&gt; #]</span><br>a</p>']);
60
60
  });
61
61
 
62
62
  it('linebreak', () => {
@@ -199,17 +199,17 @@ describe('Unit: parser/api/parse', () => {
199
199
  it('footnote', () => {
200
200
  const footnotes = { annotations: html('ol'), references: html('ol') };
201
201
  assert.deepStrictEqual(
202
- [...parse('$-a\n$$\n$$\n\n(($-a[[b]][[c]]))', { footnotes }).children].map(el => el.outerHTML),
202
+ [...parse('$-a\n$$\n$$\n\n(($-a[[b]][[c*d*]]))', { footnotes }).children].map(el => el.outerHTML),
203
203
  [
204
204
  '<figure data-label="$-a" data-group="$" data-number="1" id="label:$-a"><div class="figcontent"><div class="math" translate="no">$$\n$$</div></div><span class="figindex">(1)</span><figcaption></figcaption></figure>',
205
- '<p><sup class="annotation" id="annotation:ref:1" title="(1)[1][2]"><span hidden=""><a class="label" data-label="$-a" href="#label:$-a">(1)</a><sup class="reference" id="reference:ref:1" title="b"><span hidden="">b</span><a href="#reference:def:1">[1]</a></sup><sup class="reference" id="reference:ref:2" title="c"><span hidden="">c</span><a href="#reference:def:2">[2]</a></sup></span><a href="#annotation:def:1">*1</a></sup></p>',
205
+ '<p><sup class="annotation" id="annotation:ref:1" title="(1)[1][2]"><span hidden=""><a class="label" data-label="$-a" href="#label:$-a">(1)</a><sup class="reference" id="reference:ref:1" title="b"><span hidden="">b</span><a href="#reference:def:1">[1]</a></sup><sup class="reference" id="reference:ref:2" title="cd"><span hidden="">c<em>d</em></span><a href="#reference:def:2">[2]</a></sup></span><a href="#annotation:def:1">*1</a></sup></p>',
206
206
  ]);
207
207
  assert.deepStrictEqual(
208
208
  footnotes.annotations.outerHTML,
209
- '<ol><li id="annotation:def:1"><a class="label" data-label="$-a" href="#label:$-a">(1)</a><sup class="reference" id="reference:ref:1" title="b"><span hidden="">b</span><a href="#reference:def:1">[1]</a></sup><sup class="reference" id="reference:ref:2" title="c"><span hidden="">c</span><a href="#reference:def:2">[2]</a></sup><sup><a href="#annotation:ref:1">^1</a></sup></li></ol>');
209
+ '<ol><li id="annotation:def:1"><a class="label" data-label="$-a" href="#label:$-a">(1)</a><sup class="reference" id="reference:ref:1" title="b"><span hidden="">b</span><a href="#reference:def:1">[1]</a></sup><sup class="reference" id="reference:ref:2" title="cd"><span hidden="">c<em>d</em></span><a href="#reference:def:2">[2]</a></sup><sup><a href="#annotation:ref:1">^1</a></sup></li></ol>');
210
210
  assert.deepStrictEqual(
211
211
  footnotes.references.outerHTML,
212
- '<ol><li id="reference:def:1">b<sup><a href="#reference:ref:1">^1</a></sup></li><li id="reference:def:2">c<sup><a href="#reference:ref:2">^2</a></sup></li></ol>');
212
+ '<ol><li id="reference:def:1">b<sup><a href="#reference:ref:1">^1</a></sup></li><li id="reference:def:2">c<em>d</em><sup><a href="#reference:ref:2">^2</a></sup></li></ol>');
213
213
  });
214
214
 
215
215
  it('normalize', () => {
@@ -1,6 +1,6 @@
1
1
  import { ExtensionParser } from '../../block';
2
2
  import { block, validate, fence, creator, fmap } from '../../../combinator';
3
- import { identity } from '../../inline/extension/indexee';
3
+ import { identity, text } from '../../inline/extension/indexee';
4
4
  import { parse } from '../../api/parse';
5
5
  import { html } from 'typed-dom';
6
6
 
@@ -35,9 +35,9 @@ export const aside: ExtensionParser.AsideParser = creator(100, block(validate('~
35
35
  'data-invalid-type': 'content',
36
36
  'data-invalid-description': 'Missing the title at the first line.',
37
37
  }, `${opener}${body}${closer}`)];
38
- assert(identity(heading));
38
+ assert(identity(text(heading)));
39
39
  return [
40
- html('aside', { id: identity(heading), class: 'aside' }, [
40
+ html('aside', { id: identity(text(heading)), class: 'aside' }, [
41
41
  document,
42
42
  annotations,
43
43
  references,
@@ -113,9 +113,9 @@ function attributes(source: string) {
113
113
  assert(colspan?.[0] !== '0');
114
114
  rowspan === '1' ? rowspan = undefined : undefined;
115
115
  colspan === '1' ? colspan = undefined : undefined;
116
- rowspan &&= max(0, min(+rowspan, 65534)) + '';
117
- colspan &&= max(0, min(+colspan, 1000)) + '';
118
- highlight &&= highlight.length > 0 ? highlight.length + '' : undefined;
116
+ rowspan &&= `${max(0, min(+rowspan, 65534))}`;
117
+ colspan &&= `${max(0, min(+colspan, 1000))}`;
118
+ highlight &&= highlight.length > 0 ? `${highlight.length}` : undefined;
119
119
  const valid = !highlight
120
120
  || source[0] === '#' && +highlight <= 1
121
121
  || source[0] === ':' && +highlight <= 6;