securemark 0.236.0 → 0.237.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.237.0
4
+
5
+ - Extend ulist syntax and olist syntax to make their items indexable.
6
+
3
7
  ## 0.236.0
4
8
 
5
9
  - Extend figure syntax to allow ulist syntax and olist syntax.
@@ -1,4 +1,4 @@
1
- /*! securemark v0.236.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.237.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) {
@@ -4215,7 +4215,7 @@ require = function () {
4215
4215
  const array_1 = _dereq_('spica/array');
4216
4216
  function bind(target, settings) {
4217
4217
  var _a, _b;
4218
- let context = (0, alias_1.ObjectAssign)({ ...settings }, {
4218
+ const context = (0, alias_1.ObjectAssign)((0, alias_1.ObjectCreate)(settings), {
4219
4219
  host: (_a = settings.host) !== null && _a !== void 0 ? _a : new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
4220
4220
  footnotes: global_1.undefined,
4221
4221
  chunk: global_1.undefined
@@ -4238,7 +4238,7 @@ require = function () {
4238
4238
  throw new Error('Chunks cannot be updated.');
4239
4239
  const url = (_b = (_a = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))) === null || _a === void 0 ? void 0 : _a.slice(4).trim()) !== null && _b !== void 0 ? _b : '';
4240
4240
  source = (0, normalize_1.normalize)((0, segment_1.validate)(source, segment_1.MAX_INPUT_SIZE) ? source : source.slice(0, segment_1.MAX_INPUT_SIZE + 1));
4241
- context = (0, alias_1.ObjectAssign)({ ...context }, { url: url ? new url_1.ReadonlyURL(url) : global_1.undefined });
4241
+ (0, alias_1.ObjectAssign)(context, { url: url ? new url_1.ReadonlyURL(url) : global_1.undefined });
4242
4242
  const rev = revision = Symbol();
4243
4243
  const sourceSegments = [];
4244
4244
  for (const seg of (0, segment_1.segment)(source)) {
@@ -4530,7 +4530,6 @@ require = function () {
4530
4530
  Object.defineProperty(exports, '__esModule', { value: true });
4531
4531
  exports.parse = void 0;
4532
4532
  const global_1 = _dereq_('spica/global');
4533
- const alias_1 = _dereq_('spica/alias');
4534
4533
  const parser_1 = _dereq_('../../combinator/data/parser');
4535
4534
  const header_1 = _dereq_('../header');
4536
4535
  const block_1 = _dereq_('../block');
@@ -4542,19 +4541,20 @@ require = function () {
4542
4541
  const typed_dom_1 = _dereq_('typed-dom');
4543
4542
  const url_1 = _dereq_('spica/url');
4544
4543
  function parse(source, opts = {}, context) {
4545
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
4544
+ var _a, _b, _c, _d, _e, _f, _g;
4546
4545
  if (!(0, segment_1.validate)(source, segment_1.MAX_SEGMENT_SIZE))
4547
4546
  throw new Error(`Too large input over ${ segment_1.MAX_SEGMENT_SIZE.toLocaleString('en') } bytes.`);
4548
4547
  const url = (_b = (_a = (0, header_2.headers)(source).find(field => field.toLowerCase().startsWith('url:'))) === null || _a === void 0 ? void 0 : _a.slice(4).trim()) !== null && _b !== void 0 ? _b : '';
4549
4548
  source = !context ? (0, normalize_1.normalize)(source) : source;
4550
- context = context && url === '' && context.id === opts.id ? context : (0, alias_1.ObjectAssign)((0, alias_1.ObjectCreate)(context !== null && context !== void 0 ? context : {}), opts, {
4551
- host: (_d = (_c = opts.host) !== null && _c !== void 0 ? _c : context === null || context === void 0 ? void 0 : context.host) !== null && _d !== void 0 ? _d : new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
4549
+ context = {
4552
4550
  url: url ? new url_1.ReadonlyURL(url) : context === null || context === void 0 ? void 0 : context.url,
4553
- id: (_e = opts.id) !== null && _e !== void 0 ? _e : context === null || context === void 0 ? void 0 : context.id,
4551
+ host: (_d = (_c = opts.host) !== null && _c !== void 0 ? _c : context === null || context === void 0 ? void 0 : context.host) !== null && _d !== void 0 ? _d : new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
4552
+ caches: context === null || context === void 0 ? void 0 : context.caches,
4554
4553
  footnotes: global_1.undefined,
4555
- test: global_1.undefined
4556
- });
4557
- if (((_g = context.host) === null || _g === void 0 ? void 0 : _g.origin) === 'null')
4554
+ test: global_1.undefined,
4555
+ ...opts
4556
+ };
4557
+ if (((_e = context.host) === null || _e === void 0 ? void 0 : _e.origin) === 'null')
4558
4558
  throw new Error(`Invalid host: ${ context.host.href }`);
4559
4559
  const node = (0, typed_dom_1.frag)();
4560
4560
  let index = 0;
@@ -4578,7 +4578,6 @@ require = function () {
4578
4578
  '../segment': 127,
4579
4579
  './header': 59,
4580
4580
  './normalize': 60,
4581
- 'spica/alias': 5,
4582
4581
  'spica/global': 15,
4583
4582
  'spica/url': 24,
4584
4583
  'typed-dom': 26
@@ -4809,8 +4808,6 @@ require = function () {
4809
4808
  exports.dlist = void 0;
4810
4809
  const combinator_1 = _dereq_('../../combinator');
4811
4810
  const inline_1 = _dereq_('../inline');
4812
- const indexer_1 = _dereq_('../inline/extension/indexer');
4813
- const indexee_1 = _dereq_('../inline/extension/indexee');
4814
4811
  const source_1 = _dereq_('../source');
4815
4812
  const locale_1 = _dereq_('../locale');
4816
4813
  const util_1 = _dereq_('../util');
@@ -4831,8 +4828,8 @@ require = function () {
4831
4828
  }, (0, combinator_1.some)(term)),
4832
4829
  (0, combinator_1.some)(desc)
4833
4830
  ]))), es => [(0, typed_dom_1.html)('dl', fillTrailingDescription(es))]))));
4834
- const term = (0, combinator_1.creator)((0, combinator_1.line)((0, indexee_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([
4835
- indexer_1.indexer,
4831
+ const term = (0, combinator_1.creator)((0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.open)(/^~[^\S\n]+(?=\S)/, (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([
4832
+ inline_1.indexer,
4836
4833
  inline_1.inline
4837
4834
  ])))), true), ns => [(0, typed_dom_1.html)('dt', (0, typed_dom_1.defrag)(ns))]))));
4838
4835
  const desc = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)(/^:[^\S\n]+(?=\S)|/, (0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, /^[~:][^\S\n]+\S/), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]))))), true), ns => [(0, typed_dom_1.html)('dd', (0, typed_dom_1.defrag)(ns))]), false));
@@ -4843,8 +4840,6 @@ require = function () {
4843
4840
  {
4844
4841
  '../../combinator': 27,
4845
4842
  '../inline': 88,
4846
- '../inline/extension/indexee': 107,
4847
- '../inline/extension/indexer': 108,
4848
4843
  '../locale': 123,
4849
4844
  '../source': 128,
4850
4845
  '../util': 134,
@@ -4870,7 +4865,7 @@ require = function () {
4870
4865
  '~~~',
4871
4866
  '[$',
4872
4867
  '$'
4873
- ], (0, combinator_1.validate)(/^~{3,}|^\[?\$[a-z-]\S+[^\S\n]*(?:$|\n)/, (0, combinator_1.union)([
4868
+ ], (0, combinator_1.validate)(/^~{3,}|^\[?\$[A-Za-z-]\S+[^\S\n]*(?:$|\n)/, (0, combinator_1.union)([
4874
4869
  fig_1.segment,
4875
4870
  figure_1.segment,
4876
4871
  table_1.segment,
@@ -5167,7 +5162,31 @@ require = function () {
5167
5162
  const invalidParam = param.trimStart() !== '';
5168
5163
  const invalidContent = group === '$' && (!content.classList.contains('math') || caption.length > 0);
5169
5164
  const invalid = invalidLabel || invalidParam || invalidContent || global_1.undefined;
5165
+ let type = content.className.split(/\s/)[0];
5166
+ switch (type || content.tagName) {
5167
+ case 'UL':
5168
+ case 'OL':
5169
+ type = 'list';
5170
+ break;
5171
+ case 'TABLE':
5172
+ type = 'table';
5173
+ break;
5174
+ case 'BLOCKQUOTE':
5175
+ type = 'quote';
5176
+ break;
5177
+ case 'A':
5178
+ type = 'media';
5179
+ break;
5180
+ case 'text':
5181
+ case 'code':
5182
+ case 'math':
5183
+ case 'example':
5184
+ case 'invalid':
5185
+ break;
5186
+ default:
5187
+ }
5170
5188
  return {
5189
+ 'data-type': type,
5171
5190
  'data-label': label,
5172
5191
  'data-group': group,
5173
5192
  class: invalid && 'invalid',
@@ -5589,8 +5608,6 @@ require = function () {
5589
5608
  exports.heading = exports.segment = void 0;
5590
5609
  const combinator_1 = _dereq_('../../combinator');
5591
5610
  const inline_1 = _dereq_('../inline');
5592
- const indexer_1 = _dereq_('../inline/extension/indexer');
5593
- const indexee_1 = _dereq_('../inline/extension/indexee');
5594
5611
  const source_1 = _dereq_('../source');
5595
5612
  const util_1 = _dereq_('../util');
5596
5613
  const typed_dom_1 = _dereq_('typed-dom');
@@ -5610,13 +5627,13 @@ require = function () {
5610
5627
  media: false
5611
5628
  }
5612
5629
  }
5613
- }, (0, combinator_1.line)((0, indexee_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([
5630
+ }, (0, combinator_1.line)((0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.union)([
5614
5631
  (0, combinator_1.open)((0, source_1.str)(/^##+/), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([
5615
- indexer_1.indexer,
5632
+ inline_1.indexer,
5616
5633
  inline_1.inline
5617
5634
  ])))), true),
5618
5635
  (0, combinator_1.open)((0, source_1.str)('#'), (0, combinator_1.context)({ syntax: { inline: { autolink: false } } }, (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([
5619
- indexer_1.indexer,
5636
+ inline_1.indexer,
5620
5637
  inline_1.inline
5621
5638
  ]))))), true)
5622
5639
  ]), ns => [(0, typed_dom_1.html)(`h${ (0, array_1.shift)(ns)[0].length }`, (0, typed_dom_1.defrag)(ns))]))))));
@@ -5624,8 +5641,6 @@ require = function () {
5624
5641
  {
5625
5642
  '../../combinator': 27,
5626
5643
  '../inline': 88,
5627
- '../inline/extension/indexee': 107,
5628
- '../inline/extension/indexer': 108,
5629
5644
  '../source': 128,
5630
5645
  '../util': 134,
5631
5646
  'spica/array': 6,
@@ -5748,17 +5763,20 @@ require = function () {
5748
5763
  (0, combinator_1.match)(new RegExp(`^(?=${ openers['.'].source.replace('?:', '') })`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]))),
5749
5764
  (0, combinator_1.match)(new RegExp(`^(?=${ openers['('].source.replace('?:', '') })`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1])))
5750
5765
  ])));
5751
- const list = (type, delim) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([
5766
+ const list = (type, delim) => (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([
5752
5767
  (0, combinator_1.line)((0, combinator_1.open)(heads[delim], (0, combinator_1.trim)((0, combinator_1.subsequence)([
5753
5768
  ulist_1.checkbox,
5754
- (0, combinator_1.trimStart)((0, combinator_1.some)(inline_1.inline))
5769
+ (0, combinator_1.trimStart)((0, combinator_1.some)((0, combinator_1.union)([
5770
+ inline_1.indexer,
5771
+ inline_1.inline
5772
+ ])))
5755
5773
  ])), true)),
5756
5774
  (0, combinator_1.indent)((0, combinator_1.union)([
5757
5775
  ulist_1.ulist_,
5758
5776
  exports.olist_,
5759
5777
  ilist_1.ilist_
5760
5778
  ]))
5761
- ]), iitem), ns => [(0, typed_dom_1.html)('li', { 'data-marker': ns[0] }, (0, typed_dom_1.defrag)((0, ulist_1.fillFirstLine)((0, array_1.shift)(ns)[1])))])]))), es => [format((0, typed_dom_1.html)('ol', es), type, delim)]);
5779
+ ]), invalid), ns => [(0, typed_dom_1.html)('li', { 'data-marker': ns[0] }, (0, typed_dom_1.defrag)((0, ulist_1.fillFirstLine)((0, array_1.shift)(ns)[1])))]), true)]))), es => [format((0, typed_dom_1.html)('ol', es), type, delim)]);
5762
5780
  const heads = {
5763
5781
  '.': (0, combinator_1.focus)(openers['.'], source => [
5764
5782
  [`${ source.split('.', 1)[0] }.`],
@@ -5769,7 +5787,7 @@ require = function () {
5769
5787
  ''
5770
5788
  ])
5771
5789
  };
5772
- const iitem = (0, combinator_1.rewrite)(source_1.contentline, source => [
5790
+ const invalid = (0, combinator_1.rewrite)(source_1.contentline, source => [
5773
5791
  [
5774
5792
  '',
5775
5793
  (0, typed_dom_1.html)('span', {
@@ -5932,6 +5950,10 @@ require = function () {
5932
5950
  (0, combinator_1.focus)(/^>>\.[^\S\n]*(?:$|\n)/, () => [
5933
5951
  [(0, typed_dom_1.html)('a', { class: 'anchor' }, '>>.')],
5934
5952
  ''
5953
+ ]),
5954
+ (0, combinator_1.focus)(/^>>#\S*[^\S\n]*(?:$|\n)/, source => [
5955
+ [(0, typed_dom_1.html)('a', { class: 'anchor' }, source)],
5956
+ ''
5935
5957
  ])
5936
5958
  ])
5937
5959
  ]))), ([el, quotes = '']) => [
@@ -6105,22 +6127,25 @@ require = function () {
6105
6127
  const array_1 = _dereq_('spica/array');
6106
6128
  const source_1 = _dereq_('../source');
6107
6129
  exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)(/^-(?=[^\S\n]|\n[^\S\n]*\S)/, (0, combinator_1.context)({ syntax: { inline: { media: false } } }, exports.ulist_))));
6108
- exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([
6130
+ exports.ulist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)(/^-(?=$|\s)/, (0, combinator_1.some)((0, combinator_1.creator)((0, combinator_1.union)([(0, inline_1.indexee)((0, combinator_1.fmap)((0, combinator_1.fallback)((0, combinator_1.inits)([
6109
6131
  (0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.trim)((0, combinator_1.subsequence)([
6110
6132
  exports.checkbox,
6111
- (0, combinator_1.trimStart)((0, combinator_1.some)(inline_1.inline))
6133
+ (0, combinator_1.trimStart)((0, combinator_1.some)((0, combinator_1.union)([
6134
+ inline_1.indexer,
6135
+ inline_1.inline
6136
+ ])))
6112
6137
  ])), true)),
6113
6138
  (0, combinator_1.indent)((0, combinator_1.union)([
6114
6139
  exports.ulist_,
6115
6140
  olist_1.olist_,
6116
6141
  ilist_1.ilist_
6117
6142
  ]))
6118
- ]), iitem), ns => [(0, typed_dom_1.html)('li', (0, typed_dom_1.defrag)(fillFirstLine(ns)))])])))), es => [format((0, typed_dom_1.html)('ul', es))])));
6143
+ ]), invalid), ns => [(0, typed_dom_1.html)('li', (0, typed_dom_1.defrag)(fillFirstLine(ns)))]), true)])))), es => [format((0, typed_dom_1.html)('ul', es))])));
6119
6144
  exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [
6120
6145
  [(0, typed_dom_1.html)('span', { class: 'checkbox' }, source[1].trimStart() ? '\u2611' : '\u2610')],
6121
6146
  ''
6122
6147
  ]);
6123
- const iitem = (0, combinator_1.rewrite)(source_1.contentline, source => [
6148
+ const invalid = (0, combinator_1.rewrite)(source_1.contentline, source => [
6124
6149
  [(0, typed_dom_1.html)('span', {
6125
6150
  class: 'invalid',
6126
6151
  'data-invalid-syntax': 'listitem',
@@ -6225,7 +6250,7 @@ require = function () {
6225
6250
  function (_dereq_, module, exports) {
6226
6251
  'use strict';
6227
6252
  Object.defineProperty(exports, '__esModule', { value: true });
6228
- exports.shortmedia = exports.media = exports.inline = void 0;
6253
+ exports.shortmedia = exports.media = exports.indexer = exports.indexee = exports.inline = void 0;
6229
6254
  const combinator_1 = _dereq_('../combinator');
6230
6255
  const escape_1 = _dereq_('./inline/escape');
6231
6256
  const annotation_1 = _dereq_('./inline/annotation');
@@ -6275,6 +6300,20 @@ require = function () {
6275
6300
  bracket_1.bracket,
6276
6301
  source_1.text
6277
6302
  ]);
6303
+ var indexee_1 = _dereq_('./inline/extension/indexee');
6304
+ Object.defineProperty(exports, 'indexee', {
6305
+ enumerable: true,
6306
+ get: function () {
6307
+ return indexee_1.indexee;
6308
+ }
6309
+ });
6310
+ var indexer_1 = _dereq_('./inline/extension/indexer');
6311
+ Object.defineProperty(exports, 'indexer', {
6312
+ enumerable: true,
6313
+ get: function () {
6314
+ return indexer_1.indexer;
6315
+ }
6316
+ });
6278
6317
  var media_2 = _dereq_('./inline/media');
6279
6318
  Object.defineProperty(exports, 'media', {
6280
6319
  enumerable: true,
@@ -6302,6 +6341,8 @@ require = function () {
6302
6341
  './inline/emstrong': 103,
6303
6342
  './inline/escape': 104,
6304
6343
  './inline/extension': 105,
6344
+ './inline/extension/indexee': 107,
6345
+ './inline/extension/indexer': 108,
6305
6346
  './inline/html': 111,
6306
6347
  './inline/htmlentity': 112,
6307
6348
  './inline/insertion': 113,
@@ -6989,8 +7030,8 @@ require = function () {
6989
7030
  const global_1 = _dereq_('spica/global');
6990
7031
  const combinator_1 = _dereq_('../../../combinator');
6991
7032
  const typed_dom_1 = _dereq_('typed-dom');
6992
- function indexee(parser) {
6993
- return (0, combinator_1.fmap)(parser, ([el], _, {id}) => [(0, typed_dom_1.define)(el, { id: id !== '' && identity(text(el)) || global_1.undefined })]);
7033
+ function indexee(parser, optional) {
7034
+ return (0, combinator_1.fmap)(parser, ([el], _, {id}) => [(0, typed_dom_1.define)(el, { id: id !== '' && identity(text(el, optional)) || global_1.undefined })]);
6994
7035
  }
6995
7036
  exports.indexee = indexee;
6996
7037
  function identity(text) {
@@ -6998,11 +7039,13 @@ require = function () {
6998
7039
  return text && `index:${ text.replace(/\s+/g, '_').slice(0, 101).replace(/^(.{97}).{4}$/, '$1...') }`;
6999
7040
  }
7000
7041
  exports.identity = identity;
7001
- function text(source) {
7042
+ function text(source, optional = false) {
7002
7043
  var _a;
7003
- const indexer = source.querySelector('.indexer');
7044
+ const indexer = source.querySelector(':scope > .indexer');
7004
7045
  if (indexer)
7005
7046
  return indexer.getAttribute('data-index');
7047
+ if (optional)
7048
+ return '';
7006
7049
  const target = source.cloneNode(true);
7007
7050
  for (let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference'), i = 0, len = es.length; i < len; ++i) {
7008
7051
  const el = es[i];
@@ -8205,7 +8248,7 @@ require = function () {
8205
8248
  class: `${ ref.className } disabled invalid`,
8206
8249
  'data-invalid-syntax': 'label',
8207
8250
  'data-invalid-type': 'reference',
8208
- 'data-invalid-message': 'Missing the reference'
8251
+ 'data-invalid-message': 'Missing the target figure'
8209
8252
  });
8210
8253
  }
8211
8254
  yield ref;
package/karma.conf.js CHANGED
@@ -7,7 +7,7 @@ module.exports = function (config) {
7
7
  { pattern: 'https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js', watched: false, served: false, included: true },
8
8
  { pattern: 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.22.0/prism.js', watched: false, served: false, included: true },
9
9
  { pattern: 'https://cdnjs.cloudflare.com/ajax/libs/prism/1.22.0/plugins/autoloader/prism-autoloader.min.js', watched: false, served: false, included: true },
10
- { pattern: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.1.2/es5/tex-chtml.min.js', watched: false, served: false, included: true },
10
+ { pattern: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.0/es5/tex-chtml.min.js', watched: false, served: false, included: true },
11
11
  { pattern: 'https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.2.2/purify.js', watched: false, served: false, included: true },
12
12
  { pattern: 'node_modules/power-assert/build/power-assert.js', watched: true, served: true, included: true },
13
13
  { pattern: 'dist/*.test.js', watched: true, served: true, included: true }
package/markdown.d.ts CHANGED
@@ -133,7 +133,10 @@ export namespace MarkdownParser {
133
133
  Parser<HTMLLIElement, Context, [
134
134
  Parser<HTMLElement | string, Context, [
135
135
  InlineParser,
136
- InlineParser,
136
+ Parser<HTMLElement | string, Context, [
137
+ InlineParser.ExtensionParser.IndexerParser,
138
+ InlineParser,
139
+ ]>,
137
140
  ]>,
138
141
  Parser<HTMLUListElement | HTMLOListElement, Context, [
139
142
  UListParser,
@@ -165,7 +168,10 @@ export namespace MarkdownParser {
165
168
  Parser<HTMLLIElement, Context, [
166
169
  Parser<HTMLElement | string, Context, [
167
170
  InlineParser,
168
- InlineParser,
171
+ Parser<HTMLElement | string, Context, [
172
+ InlineParser.ExtensionParser.IndexerParser,
173
+ InlineParser,
174
+ ]>,
169
175
  ]>,
170
176
  Parser<HTMLUListElement | HTMLOListElement, Context, [
171
177
  UListParser,
@@ -432,14 +438,6 @@ export namespace MarkdownParser {
432
438
  InlineParser.ExtensionParser.LabelParser,
433
439
  ]> {
434
440
  }
435
- export namespace FigbaseParser {
436
- export interface SegmentParser extends
437
- Block<'extension/figbase/segment'>,
438
- Parser<never, Context, [
439
- InlineParser.ExtensionParser.LabelParser.SegmentParser,
440
- ]> {
441
- }
442
- }
443
441
  export interface TableParser extends
444
442
  // ~~~table
445
443
  // -/-
@@ -577,6 +575,7 @@ export namespace MarkdownParser {
577
575
  Parser<HTMLAnchorElement, Context, [
578
576
  InlineParser.AutolinkParser.AnchorParser,
579
577
  Parser<HTMLAnchorElement, Context, []>,
578
+ Parser<HTMLAnchorElement, Context, []>,
580
579
  ]>,
581
580
  ]> {
582
581
  }
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.236.0",
3
+ "version": "0.237.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -783,6 +783,12 @@
783
783
  "ms": "2.1.2"
784
784
  }
785
785
  },
786
+ "depd": {
787
+ "version": "1.1.2",
788
+ "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
789
+ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
790
+ "dev": true
791
+ },
786
792
  "ms": {
787
793
  "version": "2.1.2",
788
794
  "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@@ -1420,21 +1426,23 @@
1420
1426
  "dev": true
1421
1427
  },
1422
1428
  "body-parser": {
1423
- "version": "1.19.2",
1424
- "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.2.tgz",
1425
- "integrity": "sha512-SAAwOxgoCKMGs9uUAUFHygfLAyaniaoun6I8mFY9pRAJL9+Kec34aU+oIjDhTycub1jozEfEwx1W1IuOYxVSFw==",
1429
+ "version": "1.20.0",
1430
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.0.tgz",
1431
+ "integrity": "sha512-DfJ+q6EPcGKZD1QWUjSpqp+Q7bDQTsQIF4zfUAtZ6qk+H/3/QRhg9CEp39ss+/T2vw0+HaidC0ecJj/DRLIaKg==",
1426
1432
  "dev": true,
1427
1433
  "requires": {
1428
1434
  "bytes": "3.1.2",
1429
1435
  "content-type": "~1.0.4",
1430
1436
  "debug": "2.6.9",
1431
- "depd": "~1.1.2",
1432
- "http-errors": "1.8.1",
1437
+ "depd": "2.0.0",
1438
+ "destroy": "1.2.0",
1439
+ "http-errors": "2.0.0",
1433
1440
  "iconv-lite": "0.4.24",
1434
- "on-finished": "~2.3.0",
1435
- "qs": "6.9.7",
1436
- "raw-body": "2.4.3",
1437
- "type-is": "~1.6.18"
1441
+ "on-finished": "2.4.1",
1442
+ "qs": "6.10.3",
1443
+ "raw-body": "2.5.1",
1444
+ "type-is": "~1.6.18",
1445
+ "unpipe": "1.0.0"
1438
1446
  }
1439
1447
  },
1440
1448
  "boxen": {
@@ -1915,9 +1923,9 @@
1915
1923
  "dev": true
1916
1924
  },
1917
1925
  "caniuse-lite": {
1918
- "version": "1.0.30001323",
1919
- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001323.tgz",
1920
- "integrity": "sha512-e4BF2RlCVELKx8+RmklSEIVub1TWrmdhvA5kEUueummz1XyySW0DVk+3x9HyhU9MuWTa2BhqLgEuEmUwASAdCA==",
1926
+ "version": "1.0.30001324",
1927
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001324.tgz",
1928
+ "integrity": "sha512-/eYp1J6zYh1alySQB4uzYFkLmxxI8tk0kxldbNHXp8+v+rdMKdUBNjRLz7T7fz6Iox+1lIdYpc7rq6ZcXfTukg==",
1921
1929
  "dev": true
1922
1930
  },
1923
1931
  "chalk": {
@@ -2307,9 +2315,9 @@
2307
2315
  }
2308
2316
  },
2309
2317
  "concurrently": {
2310
- "version": "7.0.0",
2311
- "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.0.0.tgz",
2312
- "integrity": "sha512-WKM7PUsI8wyXpF80H+zjHP32fsgsHNQfPLw/e70Z5dYkV7hF+rf8q3D+ScWJIEr57CpkO3OWBko6hwhQLPR8Pw==",
2318
+ "version": "7.1.0",
2319
+ "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-7.1.0.tgz",
2320
+ "integrity": "sha512-Bz0tMlYKZRUDqJlNiF/OImojMB9ruKUz6GCfmhFnSapXgPe+3xzY4byqoKG9tUZ7L2PGEUjfLPOLfIX3labnmw==",
2313
2321
  "dev": true,
2314
2322
  "requires": {
2315
2323
  "chalk": "^4.1.0",
@@ -2725,9 +2733,9 @@
2725
2733
  "dev": true
2726
2734
  },
2727
2735
  "depd": {
2728
- "version": "1.1.2",
2729
- "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
2730
- "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
2736
+ "version": "2.0.0",
2737
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
2738
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
2731
2739
  "dev": true
2732
2740
  },
2733
2741
  "deps-sort": {
@@ -2858,6 +2866,12 @@
2858
2866
  "minimalistic-assert": "^1.0.0"
2859
2867
  }
2860
2868
  },
2869
+ "destroy": {
2870
+ "version": "1.2.0",
2871
+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
2872
+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
2873
+ "dev": true
2874
+ },
2861
2875
  "detect-file": {
2862
2876
  "version": "1.0.0",
2863
2877
  "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz",
@@ -4299,6 +4313,23 @@
4299
4313
  "parseurl": "~1.3.3",
4300
4314
  "statuses": "~1.5.0",
4301
4315
  "unpipe": "~1.0.0"
4316
+ },
4317
+ "dependencies": {
4318
+ "on-finished": {
4319
+ "version": "2.3.0",
4320
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
4321
+ "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
4322
+ "dev": true,
4323
+ "requires": {
4324
+ "ee-first": "1.1.1"
4325
+ }
4326
+ },
4327
+ "statuses": {
4328
+ "version": "1.5.0",
4329
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
4330
+ "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
4331
+ "dev": true
4332
+ }
4302
4333
  }
4303
4334
  },
4304
4335
  "find-parent-dir": {
@@ -5662,15 +5693,15 @@
5662
5693
  "dev": true
5663
5694
  },
5664
5695
  "http-errors": {
5665
- "version": "1.8.1",
5666
- "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz",
5667
- "integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==",
5696
+ "version": "2.0.0",
5697
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
5698
+ "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
5668
5699
  "dev": true,
5669
5700
  "requires": {
5670
- "depd": "~1.1.2",
5701
+ "depd": "2.0.0",
5671
5702
  "inherits": "2.0.4",
5672
5703
  "setprototypeof": "1.2.0",
5673
- "statuses": ">= 1.5.0 < 2",
5704
+ "statuses": "2.0.1",
5674
5705
  "toidentifier": "1.0.1"
5675
5706
  }
5676
5707
  },
@@ -8328,9 +8359,9 @@
8328
8359
  }
8329
8360
  },
8330
8361
  "on-finished": {
8331
- "version": "2.3.0",
8332
- "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
8333
- "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
8362
+ "version": "2.4.1",
8363
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
8364
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
8334
8365
  "dev": true,
8335
8366
  "requires": {
8336
8367
  "ee-first": "1.1.1"
@@ -9009,10 +9040,13 @@
9009
9040
  "dev": true
9010
9041
  },
9011
9042
  "qs": {
9012
- "version": "6.9.7",
9013
- "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.7.tgz",
9014
- "integrity": "sha512-IhMFgUmuNpyRfxA90umL7ByLlgRXu6tIfKPpF5TmcfRLlLCckfP/g3IQmju6jjpu+Hh8rA+2p6A27ZSPOOHdKw==",
9015
- "dev": true
9043
+ "version": "6.10.3",
9044
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.3.tgz",
9045
+ "integrity": "sha512-wr7M2E0OFRfIfJZjKGieI8lBKb7fRCH4Fv5KNPEs7gJ8jadvotdsS08PzOKR7opXhZ/Xkjtt3WF9g38drmyRqQ==",
9046
+ "dev": true,
9047
+ "requires": {
9048
+ "side-channel": "^1.0.4"
9049
+ }
9016
9050
  },
9017
9051
  "querystring": {
9018
9052
  "version": "0.2.0",
@@ -9058,13 +9092,13 @@
9058
9092
  "dev": true
9059
9093
  },
9060
9094
  "raw-body": {
9061
- "version": "2.4.3",
9062
- "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.3.tgz",
9063
- "integrity": "sha512-UlTNLIcu0uzb4D2f4WltY6cVjLi+/jEN4lgEUj3E04tpMDpUlkBo/eSn6zou9hum2VMNpCCUone0O0WeJim07g==",
9095
+ "version": "2.5.1",
9096
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz",
9097
+ "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==",
9064
9098
  "dev": true,
9065
9099
  "requires": {
9066
9100
  "bytes": "3.1.2",
9067
- "http-errors": "1.8.1",
9101
+ "http-errors": "2.0.0",
9068
9102
  "iconv-lite": "0.4.24",
9069
9103
  "unpipe": "1.0.0"
9070
9104
  }
@@ -10329,9 +10363,9 @@
10329
10363
  }
10330
10364
  },
10331
10365
  "statuses": {
10332
- "version": "1.5.0",
10333
- "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
10334
- "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
10366
+ "version": "2.0.1",
10367
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
10368
+ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
10335
10369
  "dev": true
10336
10370
  },
10337
10371
  "stream-browserify": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.236.0",
3
+ "version": "0.237.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",
@@ -1,5 +1,5 @@
1
1
  import { undefined, location } from 'spica/global';
2
- import { ObjectAssign } from 'spica/alias';
2
+ import { ObjectAssign, ObjectCreate } from 'spica/alias';
3
3
  import { ParserSettings, Progress } from '../../..';
4
4
  import { MarkdownParser } from '../../../markdown';
5
5
  import { eval } from '../../combinator/data/parser';
@@ -21,7 +21,7 @@ export function bind(target: DocumentFragment | HTMLElement | ShadowRoot, settin
21
21
  nearest: (position: number) => HTMLElement | undefined;
22
22
  index: (block: HTMLElement) => number;
23
23
  } {
24
- let context: MarkdownParser.Context = ObjectAssign({ ...settings }, {
24
+ const context: MarkdownParser.Context = ObjectAssign(ObjectCreate(settings), {
25
25
  host: settings.host ?? new ReadonlyURL(location.pathname, location.origin),
26
26
  footnotes: undefined,
27
27
  chunk: undefined,
@@ -44,7 +44,11 @@ export function bind(target: DocumentFragment | HTMLElement | ShadowRoot, settin
44
44
  if (settings.chunk && revision) throw new Error('Chunks cannot be updated.');
45
45
  const url = headers(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
46
46
  source = normalize(validate(source, MAX_INPUT_SIZE) ? source : source.slice(0, MAX_INPUT_SIZE + 1));
47
- context = ObjectAssign({ ...context }, { url: url ? new ReadonlyURL(url as ':') : undefined });
47
+ ObjectAssign<MarkdownParser.Context, MarkdownParser.Context>(
48
+ context,
49
+ {
50
+ url: url ? new ReadonlyURL(url as ':') : undefined,
51
+ });
48
52
  const rev = revision = Symbol();
49
53
  const sourceSegments: string[] = [];
50
54
  for (const seg of segment(source)) {