securemark 0.235.2 → 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.
Files changed (58) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/securemark.js +200 -112
  3. package/karma.conf.js +1 -1
  4. package/markdown.d.ts +11 -10
  5. package/package-lock.json +111 -98
  6. package/package.json +3 -3
  7. package/src/debug.test.ts +3 -1
  8. package/src/parser/api/bind.ts +7 -3
  9. package/src/parser/api/parse.test.ts +3 -3
  10. package/src/parser/api/parse.ts +8 -11
  11. package/src/parser/block/blockquote.test.ts +1 -1
  12. package/src/parser/block/codeblock.ts +1 -1
  13. package/src/parser/block/dlist.ts +1 -3
  14. package/src/parser/block/extension/aside.test.ts +1 -1
  15. package/src/parser/block/extension/aside.ts +2 -2
  16. package/src/parser/block/extension/example.test.ts +2 -2
  17. package/src/parser/block/extension/example.ts +2 -2
  18. package/src/parser/block/extension/fig.test.ts +22 -20
  19. package/src/parser/block/extension/figure.test.ts +33 -31
  20. package/src/parser/block/extension/figure.ts +32 -3
  21. package/src/parser/block/extension/message.ts +2 -2
  22. package/src/parser/block/extension/placeholder.ts +1 -1
  23. package/src/parser/block/extension/table.ts +5 -5
  24. package/src/parser/block/extension.ts +1 -1
  25. package/src/parser/block/heading.ts +1 -3
  26. package/src/parser/block/ilist.ts +1 -1
  27. package/src/parser/block/mathblock.ts +1 -1
  28. package/src/parser/block/olist.test.ts +8 -0
  29. package/src/parser/block/olist.ts +7 -7
  30. package/src/parser/block/paragraph.test.ts +1 -1
  31. package/src/parser/block/reply/cite.test.ts +4 -0
  32. package/src/parser/block/reply/cite.ts +1 -0
  33. package/src/parser/block/reply/quote.ts +1 -1
  34. package/src/parser/block/table.ts +1 -1
  35. package/src/parser/block/ulist.test.ts +8 -0
  36. package/src/parser/block/ulist.ts +7 -7
  37. package/src/parser/header.ts +1 -1
  38. package/src/parser/inline/deletion.ts +1 -1
  39. package/src/parser/inline/emphasis.ts +1 -1
  40. package/src/parser/inline/emstrong.ts +3 -3
  41. package/src/parser/inline/extension/indexee.ts +8 -8
  42. package/src/parser/inline/extension/placeholder.ts +1 -1
  43. package/src/parser/inline/html.ts +7 -7
  44. package/src/parser/inline/htmlentity.test.ts +1 -1
  45. package/src/parser/inline/htmlentity.ts +18 -11
  46. package/src/parser/inline/insertion.ts +1 -1
  47. package/src/parser/inline/link.ts +4 -4
  48. package/src/parser/inline/mark.ts +1 -1
  49. package/src/parser/inline/math.ts +1 -1
  50. package/src/parser/inline/media.ts +3 -3
  51. package/src/parser/inline/reference.ts +1 -1
  52. package/src/parser/inline/ruby.ts +2 -2
  53. package/src/parser/inline/strong.ts +1 -1
  54. package/src/parser/inline.ts +2 -0
  55. package/src/parser/processor/figure.test.ts +33 -29
  56. package/src/parser/processor/figure.ts +25 -3
  57. package/src/parser/processor/footnote.ts +3 -3
  58. package/src/parser/util.ts +1 -1
@@ -1,4 +1,4 @@
1
- /*! securemark v0.235.2 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) {
@@ -2344,6 +2344,7 @@ require = function () {
2344
2344
  'use strict';
2345
2345
  Object.defineProperty(exports, '__esModule', { value: true });
2346
2346
  exports.SVG = exports.HTML = exports.Shadow = exports.API = void 0;
2347
+ const global_1 = _dereq_('spica/global');
2347
2348
  const alias_1 = _dereq_('spica/alias');
2348
2349
  const proxy_1 = _dereq_('./proxy');
2349
2350
  const dom_1 = _dereq_('./util/dom');
@@ -2363,22 +2364,24 @@ require = function () {
2363
2364
  };
2364
2365
  function builder(tag, baseFactory) {
2365
2366
  return function build(attrs, children, factory) {
2366
- if (typeof attrs === 'function')
2367
- return build(void 0, void 0, attrs);
2368
2367
  if (typeof children === 'function')
2369
2368
  return build(attrs, void 0, children);
2370
- if (attrs !== void 0 && isElChildren(attrs))
2369
+ if (typeof attrs === 'function')
2370
+ return build(void 0, void 0, attrs);
2371
+ if (isElChildren(attrs))
2371
2372
  return build(void 0, attrs, factory);
2372
2373
  const node = formatter(elem(factory, attrs, children));
2373
2374
  return node.nodeType === 1 ? new proxy_1.Elem(node, children) : new proxy_1.Elem(node.host, children, node);
2374
2375
  };
2375
- function isElChildren(children) {
2376
- if (typeof children !== 'object')
2376
+ function isElChildren(param) {
2377
+ if (param === void 0)
2378
+ return false;
2379
+ if (param[global_1.Symbol.iterator])
2377
2380
  return true;
2378
- for (const i in children) {
2379
- if (!(0, alias_1.hasOwnProperty)(children, i))
2381
+ for (const i in param) {
2382
+ if (!(0, alias_1.hasOwnProperty)(param, i))
2380
2383
  continue;
2381
- return typeof children[i] === 'object';
2384
+ return typeof param[i] === 'object' && !!param[i];
2382
2385
  }
2383
2386
  return true;
2384
2387
  }
@@ -2394,7 +2397,8 @@ require = function () {
2394
2397
  {
2395
2398
  './proxy': 14,
2396
2399
  './util/dom': 15,
2397
- 'spica/alias': 4
2400
+ 'spica/alias': 4,
2401
+ 'spica/global': 8
2398
2402
  }
2399
2403
  ],
2400
2404
  14: [
@@ -2808,8 +2812,8 @@ require = function () {
2808
2812
  node.replaceChildren(...typeof children === 'string' ? [children] : children);
2809
2813
  return node;
2810
2814
  }
2811
- function isChildren(o) {
2812
- return !!(o === null || o === void 0 ? void 0 : o[global_1.Symbol.iterator]);
2815
+ function isChildren(param) {
2816
+ return !!(param === null || param === void 0 ? void 0 : param[global_1.Symbol.iterator]);
2813
2817
  }
2814
2818
  exports.isChildren = isChildren;
2815
2819
  function defrag(nodes) {
@@ -4211,7 +4215,7 @@ require = function () {
4211
4215
  const array_1 = _dereq_('spica/array');
4212
4216
  function bind(target, settings) {
4213
4217
  var _a, _b;
4214
- let context = (0, alias_1.ObjectAssign)({ ...settings }, {
4218
+ const context = (0, alias_1.ObjectAssign)((0, alias_1.ObjectCreate)(settings), {
4215
4219
  host: (_a = settings.host) !== null && _a !== void 0 ? _a : new url_1.ReadonlyURL(global_1.location.pathname, global_1.location.origin),
4216
4220
  footnotes: global_1.undefined,
4217
4221
  chunk: global_1.undefined
@@ -4234,7 +4238,7 @@ require = function () {
4234
4238
  throw new Error('Chunks cannot be updated.');
4235
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 : '';
4236
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));
4237
- 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 });
4238
4242
  const rev = revision = Symbol();
4239
4243
  const sourceSegments = [];
4240
4244
  for (const seg of (0, segment_1.segment)(source)) {
@@ -4526,7 +4530,6 @@ require = function () {
4526
4530
  Object.defineProperty(exports, '__esModule', { value: true });
4527
4531
  exports.parse = void 0;
4528
4532
  const global_1 = _dereq_('spica/global');
4529
- const alias_1 = _dereq_('spica/alias');
4530
4533
  const parser_1 = _dereq_('../../combinator/data/parser');
4531
4534
  const header_1 = _dereq_('../header');
4532
4535
  const block_1 = _dereq_('../block');
@@ -4538,19 +4541,20 @@ require = function () {
4538
4541
  const typed_dom_1 = _dereq_('typed-dom');
4539
4542
  const url_1 = _dereq_('spica/url');
4540
4543
  function parse(source, opts = {}, context) {
4541
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
4544
+ var _a, _b, _c, _d, _e, _f, _g;
4542
4545
  if (!(0, segment_1.validate)(source, segment_1.MAX_SEGMENT_SIZE))
4543
4546
  throw new Error(`Too large input over ${ segment_1.MAX_SEGMENT_SIZE.toLocaleString('en') } bytes.`);
4544
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 : '';
4545
4548
  source = !context ? (0, normalize_1.normalize)(source) : source;
4546
- context = context && url === '' && context.id === opts.id ? context : (0, alias_1.ObjectAssign)((0, alias_1.ObjectCreate)(context !== null && context !== void 0 ? context : {}), opts, {
4547
- 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 = {
4548
4550
  url: url ? new url_1.ReadonlyURL(url) : context === null || context === void 0 ? void 0 : context.url,
4549
- 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,
4550
4553
  footnotes: global_1.undefined,
4551
- test: global_1.undefined
4552
- });
4553
- 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')
4554
4558
  throw new Error(`Invalid host: ${ context.host.href }`);
4555
4559
  const node = (0, typed_dom_1.frag)();
4556
4560
  let index = 0;
@@ -4574,7 +4578,6 @@ require = function () {
4574
4578
  '../segment': 127,
4575
4579
  './header': 59,
4576
4580
  './normalize': 60,
4577
- 'spica/alias': 5,
4578
4581
  'spica/global': 15,
4579
4582
  'spica/url': 24,
4580
4583
  'typed-dom': 26
@@ -4774,7 +4777,7 @@ require = function () {
4774
4777
  translate: 'no',
4775
4778
  'data-invalid-syntax': 'codeblock',
4776
4779
  'data-invalid-type': !closer ? 'closer' : 'argument',
4777
- 'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
4780
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
4778
4781
  }, `${ opener }${ body }${ closer }`)];
4779
4782
  const file = (_a = path.split('/').pop()) !== null && _a !== void 0 ? _a : '';
4780
4783
  const ext = file && file.includes('.', 1) ? file.split('.').pop() : '';
@@ -4805,8 +4808,6 @@ require = function () {
4805
4808
  exports.dlist = void 0;
4806
4809
  const combinator_1 = _dereq_('../../combinator');
4807
4810
  const inline_1 = _dereq_('../inline');
4808
- const indexer_1 = _dereq_('../inline/extension/indexer');
4809
- const indexee_1 = _dereq_('../inline/extension/indexee');
4810
4811
  const source_1 = _dereq_('../source');
4811
4812
  const locale_1 = _dereq_('../locale');
4812
4813
  const util_1 = _dereq_('../util');
@@ -4827,8 +4828,8 @@ require = function () {
4827
4828
  }, (0, combinator_1.some)(term)),
4828
4829
  (0, combinator_1.some)(desc)
4829
4830
  ]))), es => [(0, typed_dom_1.html)('dl', fillTrailingDescription(es))]))));
4830
- 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)([
4831
- 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,
4832
4833
  inline_1.inline
4833
4834
  ])))), true), ns => [(0, typed_dom_1.html)('dt', (0, typed_dom_1.defrag)(ns))]))));
4834
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));
@@ -4839,8 +4840,6 @@ require = function () {
4839
4840
  {
4840
4841
  '../../combinator': 27,
4841
4842
  '../inline': 88,
4842
- '../inline/extension/indexee': 107,
4843
- '../inline/extension/indexer': 108,
4844
4843
  '../locale': 123,
4845
4844
  '../source': 128,
4846
4845
  '../util': 134,
@@ -4866,7 +4865,7 @@ require = function () {
4866
4865
  '~~~',
4867
4866
  '[$',
4868
4867
  '$'
4869
- ], (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)([
4870
4869
  fig_1.segment,
4871
4870
  figure_1.segment,
4872
4871
  table_1.segment,
@@ -4912,7 +4911,7 @@ require = function () {
4912
4911
  translate: 'no',
4913
4912
  'data-invalid-syntax': 'aside',
4914
4913
  'data-invalid-type': !closer ? 'closer' : 'argument',
4915
- 'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
4914
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
4916
4915
  }, `${ opener }${ body }${ closer }`)];
4917
4916
  const annotations = (0, typed_dom_1.html)('ol', { class: 'annotations' });
4918
4917
  const references = (0, typed_dom_1.html)('ol', { class: 'references' });
@@ -4930,7 +4929,7 @@ require = function () {
4930
4929
  translate: 'no',
4931
4930
  'data-invalid-syntax': 'aside',
4932
4931
  'data-invalid-type': 'content',
4933
- 'data-invalid-description': 'Missing the title at the first line.'
4932
+ 'data-invalid-message': 'Missing the title at the first line'
4934
4933
  }, `${ opener }${ body }${ closer }`)];
4935
4934
  return [(0, typed_dom_1.html)('aside', {
4936
4935
  id: (0, indexee_1.identity)((0, indexee_1.text)(heading)),
@@ -4967,7 +4966,7 @@ require = function () {
4967
4966
  translate: 'no',
4968
4967
  'data-invalid-syntax': 'example',
4969
4968
  'data-invalid-type': !closer ? 'closer' : 'argument',
4970
- 'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
4969
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
4971
4970
  }, `${ opener }${ body }${ closer }`)];
4972
4971
  switch (type) {
4973
4972
  case 'markdown': {
@@ -5007,7 +5006,7 @@ require = function () {
5007
5006
  class: 'invalid',
5008
5007
  translate: 'no',
5009
5008
  'data-invalid-syntax': 'example',
5010
- 'data-invalid-description': 'Invalid example type.'
5009
+ 'data-invalid-message': 'Invalid example type'
5011
5010
  }, `${ opener }${ body }${ closer }`)];
5012
5011
  }
5013
5012
  }))));
@@ -5098,6 +5097,8 @@ require = function () {
5098
5097
  const combinator_1 = _dereq_('../../../combinator');
5099
5098
  const source_1 = _dereq_('../../source');
5100
5099
  const label_1 = _dereq_('../../inline/extension/label');
5100
+ const ulist_1 = _dereq_('../ulist');
5101
+ const olist_1 = _dereq_('../olist');
5101
5102
  const table_1 = _dereq_('../table');
5102
5103
  const codeblock_1 = _dereq_('../codeblock');
5103
5104
  const mathblock_1 = _dereq_('../mathblock');
@@ -5136,6 +5137,8 @@ require = function () {
5136
5137
  ])),
5137
5138
  (0, combinator_1.inits)([
5138
5139
  (0, combinator_1.block)((0, combinator_1.union)([
5140
+ ulist_1.ulist,
5141
+ olist_1.olist,
5139
5142
  table_1.table,
5140
5143
  codeblock_1.codeblock,
5141
5144
  mathblock_1.mathblock,
@@ -5159,22 +5162,46 @@ require = function () {
5159
5162
  const invalidParam = param.trimStart() !== '';
5160
5163
  const invalidContent = group === '$' && (!content.classList.contains('math') || caption.length > 0);
5161
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
+ }
5162
5188
  return {
5189
+ 'data-type': type,
5163
5190
  'data-label': label,
5164
5191
  'data-group': group,
5165
5192
  class: invalid && 'invalid',
5166
5193
  ...invalidLabel && {
5167
5194
  'data-invalid-syntax': 'figure',
5168
5195
  'data-invalid-type': 'label',
5169
- 'data-invalid-description': 'The last part of the fixed label numbers must not be 0.'
5196
+ 'data-invalid-message': 'The last part of the fixed label numbers must not be 0'
5170
5197
  } || invalidParam && {
5171
5198
  'data-invalid-syntax': 'figure',
5172
5199
  'data-invalid-type': 'argument',
5173
- 'data-invalid-description': 'Invalid argument.'
5200
+ 'data-invalid-message': 'Invalid argument'
5174
5201
  } || invalidContent && {
5175
5202
  'data-invalid-syntax': 'figure',
5176
5203
  'data-invalid-type': 'content',
5177
- 'data-invalid-description': 'A figure labeled to define a formula number can contain only a math formula and no caption.'
5204
+ 'data-invalid-message': 'A figure labeled to define a formula number can contain only a math formula and no caption'
5178
5205
  } || global_1.undefined
5179
5206
  };
5180
5207
  }
@@ -5189,7 +5216,9 @@ require = function () {
5189
5216
  '../blockquote': 64,
5190
5217
  '../codeblock': 65,
5191
5218
  '../mathblock': 79,
5219
+ '../olist': 80,
5192
5220
  '../table': 85,
5221
+ '../ulist': 86,
5193
5222
  './example': 69,
5194
5223
  './placeholder': 74,
5195
5224
  './table': 75,
@@ -5225,7 +5254,7 @@ require = function () {
5225
5254
  translate: 'no',
5226
5255
  'data-invalid-syntax': 'message',
5227
5256
  'data-invalid-type': !closer ? 'closer' : 'argument',
5228
- 'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
5257
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
5229
5258
  }, `${ opener }${ body }${ closer }`)];
5230
5259
  switch (type) {
5231
5260
  case 'note':
@@ -5237,7 +5266,7 @@ require = function () {
5237
5266
  class: 'invalid',
5238
5267
  translate: 'no',
5239
5268
  'data-invalid-syntax': 'message',
5240
- 'data-invalid-description': 'Invalid message type.'
5269
+ 'data-invalid-message': 'Invalid message type'
5241
5270
  }, `${ opener }${ body }${ closer }`)];
5242
5271
  }
5243
5272
  return [(0, typed_dom_1.html)('div', { class: `message type-${ type }` }, (0, array_1.unshift)([(0, typed_dom_1.html)('h6', title(type))], [...(0, segment_1.segment)(body)].reduce((acc, seg) => (0, array_1.push)(acc, (0, parser_1.eval)(content(seg, context), [])), [])))];
@@ -5296,7 +5325,7 @@ require = function () {
5296
5325
  translate: 'no',
5297
5326
  'data-invalid-syntax': 'extension',
5298
5327
  'data-invalid-type': !closer ? 'closer' : 'syntax',
5299
- 'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid syntax.'
5328
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid syntax'
5300
5329
  }, `${ opener }${ body }${ closer }`)])));
5301
5330
  },
5302
5331
  {
@@ -5330,16 +5359,16 @@ require = function () {
5330
5359
  translate: 'no',
5331
5360
  'data-invalid-syntax': 'table',
5332
5361
  'data-invalid-type': !closer ? 'closer' : 'argument',
5333
- 'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
5362
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
5334
5363
  }, `${ opener }${ body }${ closer }`)];
5335
5364
  return (_a = (0, parser_1.eval)(parser(body, context))) !== null && _a !== void 0 ? _a : [(0, typed_dom_1.html)('table')];
5336
- }), (source, _, reason) => reason instanceof Error && reason.message === 'Number of columns must be 32 or less.' ? [
5365
+ }), (source, _, reason) => reason instanceof Error && reason.message === 'Number of columns must be 32 or less' ? [
5337
5366
  [(0, typed_dom_1.html)('pre', {
5338
5367
  class: 'invalid',
5339
5368
  translate: 'no',
5340
5369
  'data-invalid-syntax': 'table',
5341
5370
  'data-invalid-type': 'content',
5342
- 'data-invalid-description': reason.message
5371
+ 'data-invalid-message': reason.message
5343
5372
  }, source)],
5344
5373
  ''
5345
5374
  ] : (() => {
@@ -5386,7 +5415,7 @@ require = function () {
5386
5415
  ...valid ? { 'data-highlight-level': +highlight > 1 ? highlight : global_1.undefined } : {
5387
5416
  'data-invalid-syntax': 'table',
5388
5417
  'data-invalid-type': 'syntax',
5389
- 'data-invalid-description': 'Too much highlight level.'
5418
+ 'data-invalid-message': 'Too much highlight level'
5390
5419
  }
5391
5420
  };
5392
5421
  }
@@ -5524,7 +5553,7 @@ require = function () {
5524
5553
  valigns[j] && cell.setAttribute('valign', valigns[j]);
5525
5554
  }
5526
5555
  if (cells.length > 32)
5527
- throw new Error('Number of columns must be 32 or less.');
5556
+ throw new Error('Number of columns must be 32 or less');
5528
5557
  target.appendChild(row);
5529
5558
  switch (target) {
5530
5559
  case thead:
@@ -5579,8 +5608,6 @@ require = function () {
5579
5608
  exports.heading = exports.segment = void 0;
5580
5609
  const combinator_1 = _dereq_('../../combinator');
5581
5610
  const inline_1 = _dereq_('../inline');
5582
- const indexer_1 = _dereq_('../inline/extension/indexer');
5583
- const indexee_1 = _dereq_('../inline/extension/indexee');
5584
5611
  const source_1 = _dereq_('../source');
5585
5612
  const util_1 = _dereq_('../util');
5586
5613
  const typed_dom_1 = _dereq_('typed-dom');
@@ -5600,13 +5627,13 @@ require = function () {
5600
5627
  media: false
5601
5628
  }
5602
5629
  }
5603
- }, (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)([
5604
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)([
5605
- indexer_1.indexer,
5632
+ inline_1.indexer,
5606
5633
  inline_1.inline
5607
5634
  ])))), true),
5608
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)([
5609
- indexer_1.indexer,
5636
+ inline_1.indexer,
5610
5637
  inline_1.inline
5611
5638
  ]))))), true)
5612
5639
  ]), ns => [(0, typed_dom_1.html)(`h${ (0, array_1.shift)(ns)[0].length }`, (0, typed_dom_1.defrag)(ns))]))))));
@@ -5614,8 +5641,6 @@ require = function () {
5614
5641
  {
5615
5642
  '../../combinator': 27,
5616
5643
  '../inline': 88,
5617
- '../inline/extension/indexee': 107,
5618
- '../inline/extension/indexer': 108,
5619
5644
  '../source': 128,
5620
5645
  '../util': 134,
5621
5646
  'spica/array': 6,
@@ -5665,7 +5690,7 @@ require = function () {
5665
5690
  class: 'invalid',
5666
5691
  'data-invalid-syntax': 'list',
5667
5692
  'data-invalid-type': 'syntax',
5668
- 'data-invalid-description': 'Use "-" instead of "+" or "*".'
5693
+ 'data-invalid-message': 'Use "-" instead of "+" or "*"'
5669
5694
  }, es)])));
5670
5695
  },
5671
5696
  {
@@ -5702,7 +5727,7 @@ require = function () {
5702
5727
  translate: 'no',
5703
5728
  'data-invalid-syntax': 'mathblock',
5704
5729
  'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? 'closer' : 'argument',
5705
- 'data-invalid-description': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
5730
+ 'data-invalid-message': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
5706
5731
  }, `${ opener }${ body }${ closer }`)];
5707
5732
  })));
5708
5733
  },
@@ -5738,17 +5763,20 @@ require = function () {
5738
5763
  (0, combinator_1.match)(new RegExp(`^(?=${ openers['.'].source.replace('?:', '') })`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]))),
5739
5764
  (0, combinator_1.match)(new RegExp(`^(?=${ openers['('].source.replace('?:', '') })`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1])))
5740
5765
  ])));
5741
- 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)([
5742
5767
  (0, combinator_1.line)((0, combinator_1.open)(heads[delim], (0, combinator_1.trim)((0, combinator_1.subsequence)([
5743
5768
  ulist_1.checkbox,
5744
- (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
+ ])))
5745
5773
  ])), true)),
5746
5774
  (0, combinator_1.indent)((0, combinator_1.union)([
5747
5775
  ulist_1.ulist_,
5748
5776
  exports.olist_,
5749
5777
  ilist_1.ilist_
5750
5778
  ]))
5751
- ]), 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)]);
5752
5780
  const heads = {
5753
5781
  '.': (0, combinator_1.focus)(openers['.'], source => [
5754
5782
  [`${ source.split('.', 1)[0] }.`],
@@ -5759,14 +5787,14 @@ require = function () {
5759
5787
  ''
5760
5788
  ])
5761
5789
  };
5762
- const iitem = (0, combinator_1.rewrite)(source_1.contentline, source => [
5790
+ const invalid = (0, combinator_1.rewrite)(source_1.contentline, source => [
5763
5791
  [
5764
5792
  '',
5765
5793
  (0, typed_dom_1.html)('span', {
5766
5794
  class: 'invalid',
5767
5795
  'data-invalid-syntax': 'listitem',
5768
5796
  'data-invalid-type': 'syntax',
5769
- 'data-invalid-description': 'Fix the indent or the head of the list item.'
5797
+ 'data-invalid-message': 'Fix the indent or the head of the list item'
5770
5798
  }, source.replace('\n', ''))
5771
5799
  ],
5772
5800
  ''
@@ -5922,6 +5950,10 @@ require = function () {
5922
5950
  (0, combinator_1.focus)(/^>>\.[^\S\n]*(?:$|\n)/, () => [
5923
5951
  [(0, typed_dom_1.html)('a', { class: 'anchor' }, '>>.')],
5924
5952
  ''
5953
+ ]),
5954
+ (0, combinator_1.focus)(/^>>#\S*[^\S\n]*(?:$|\n)/, source => [
5955
+ [(0, typed_dom_1.html)('a', { class: 'anchor' }, source)],
5956
+ ''
5925
5957
  ])
5926
5958
  ])
5927
5959
  ]))), ([el, quotes = '']) => [
@@ -5959,7 +5991,7 @@ require = function () {
5959
5991
  class: 'quote invalid',
5960
5992
  'data-invalid-syntax': 'quote',
5961
5993
  'data-invalid-type': 'syntax',
5962
- 'data-invalid-description': `Missing the whitespace after "${ ns[0].split(/[^>]/, 1)[0] }".`
5994
+ 'data-invalid-message': `Missing the whitespace after "${ ns[0].split(/[^>]/, 1)[0] }"`
5963
5995
  }, (0, typed_dom_1.defrag)(ns)),
5964
5996
  (0, typed_dom_1.html)('br')
5965
5997
  ]), false)));
@@ -6033,7 +6065,7 @@ require = function () {
6033
6065
  class: 'invalid',
6034
6066
  'data-invalid-syntax': 'tablerow',
6035
6067
  'data-invalid-type': 'syntax',
6036
- 'data-invalid-description': 'Invalid table row.'
6068
+ 'data-invalid-message': 'Invalid table row'
6037
6069
  }, [(0, typed_dom_1.html)('td', source.replace('\n', ''))])],
6038
6070
  ''
6039
6071
  ])));
@@ -6095,27 +6127,30 @@ require = function () {
6095
6127
  const array_1 = _dereq_('spica/array');
6096
6128
  const source_1 = _dereq_('../source');
6097
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_))));
6098
- 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)([
6099
6131
  (0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.trim)((0, combinator_1.subsequence)([
6100
6132
  exports.checkbox,
6101
- (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
+ ])))
6102
6137
  ])), true)),
6103
6138
  (0, combinator_1.indent)((0, combinator_1.union)([
6104
6139
  exports.ulist_,
6105
6140
  olist_1.olist_,
6106
6141
  ilist_1.ilist_
6107
6142
  ]))
6108
- ]), 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))])));
6109
6144
  exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [
6110
6145
  [(0, typed_dom_1.html)('span', { class: 'checkbox' }, source[1].trimStart() ? '\u2611' : '\u2610')],
6111
6146
  ''
6112
6147
  ]);
6113
- const iitem = (0, combinator_1.rewrite)(source_1.contentline, source => [
6148
+ const invalid = (0, combinator_1.rewrite)(source_1.contentline, source => [
6114
6149
  [(0, typed_dom_1.html)('span', {
6115
6150
  class: 'invalid',
6116
6151
  'data-invalid-syntax': 'listitem',
6117
6152
  'data-invalid-type': 'syntax',
6118
- 'data-invalid-description': 'Fix the indent or the head of the list item.'
6153
+ 'data-invalid-message': 'Fix the indent or the head of the list item'
6119
6154
  }, source.replace('\n', ''))],
6120
6155
  ''
6121
6156
  ]);
@@ -6178,7 +6213,7 @@ require = function () {
6178
6213
  translate: 'no',
6179
6214
  'data-invalid-syntax': 'header',
6180
6215
  'data-invalid-type': 'syntax',
6181
- 'data-invalid-description': 'Invalid syntax.'
6216
+ 'data-invalid-message': 'Invalid syntax'
6182
6217
  }, (0, normalize_1.normalize)(source))],
6183
6218
  ''
6184
6219
  ]
@@ -6215,7 +6250,7 @@ require = function () {
6215
6250
  function (_dereq_, module, exports) {
6216
6251
  'use strict';
6217
6252
  Object.defineProperty(exports, '__esModule', { value: true });
6218
- exports.shortmedia = exports.media = exports.inline = void 0;
6253
+ exports.shortmedia = exports.media = exports.indexer = exports.indexee = exports.inline = void 0;
6219
6254
  const combinator_1 = _dereq_('../combinator');
6220
6255
  const escape_1 = _dereq_('./inline/escape');
6221
6256
  const annotation_1 = _dereq_('./inline/annotation');
@@ -6265,6 +6300,20 @@ require = function () {
6265
6300
  bracket_1.bracket,
6266
6301
  source_1.text
6267
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
+ });
6268
6317
  var media_2 = _dereq_('./inline/media');
6269
6318
  Object.defineProperty(exports, 'media', {
6270
6319
  enumerable: true,
@@ -6292,6 +6341,8 @@ require = function () {
6292
6341
  './inline/emstrong': 103,
6293
6342
  './inline/escape': 104,
6294
6343
  './inline/extension': 105,
6344
+ './inline/extension/indexee': 107,
6345
+ './inline/extension/indexer': 108,
6295
6346
  './inline/html': 111,
6296
6347
  './inline/htmlentity': 112,
6297
6348
  './inline/insertion': 113,
@@ -6709,7 +6760,7 @@ require = function () {
6709
6760
  const typed_dom_1 = _dereq_('typed-dom');
6710
6761
  const array_1 = _dereq_('spica/array');
6711
6762
  exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([
6712
- (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/, /~~/)),
6763
+ (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/, '~~')),
6713
6764
  (0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, '~'), true)
6714
6765
  ])), (0, source_1.str)('~~'), false, ([, bs], rest) => [
6715
6766
  [(0, typed_dom_1.html)('del', (0, typed_dom_1.defrag)(bs))],
@@ -6742,7 +6793,7 @@ require = function () {
6742
6793
  const array_1 = _dereq_('spica/array');
6743
6794
  exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('*'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
6744
6795
  strong_1.strong,
6745
- (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', /\*/)),
6796
+ (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '*')),
6746
6797
  (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
6747
6798
  ])), '*'), (0, source_1.str)('*'), false, ([, bs], rest) => [
6748
6799
  [(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))],
@@ -6775,16 +6826,16 @@ require = function () {
6775
6826
  const typed_dom_1 = _dereq_('typed-dom');
6776
6827
  const array_1 = _dereq_('spica/array');
6777
6828
  const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([
6778
- (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', /\*\*/)),
6829
+ (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '**')),
6779
6830
  (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
6780
6831
  ])));
6781
6832
  const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([
6782
6833
  strong_1.strong,
6783
- (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', /\*/)),
6834
+ (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '*')),
6784
6835
  (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
6785
6836
  ])));
6786
6837
  exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('***'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
6787
- (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', /\*/)),
6838
+ (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '*')),
6788
6839
  (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
6789
6840
  ]))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
6790
6841
  var _a, _b;
@@ -6979,8 +7030,8 @@ require = function () {
6979
7030
  const global_1 = _dereq_('spica/global');
6980
7031
  const combinator_1 = _dereq_('../../../combinator');
6981
7032
  const typed_dom_1 = _dereq_('typed-dom');
6982
- function indexee(parser) {
6983
- 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 })]);
6984
7035
  }
6985
7036
  exports.indexee = indexee;
6986
7037
  function identity(text) {
@@ -6988,11 +7039,13 @@ require = function () {
6988
7039
  return text && `index:${ text.replace(/\s+/g, '_').slice(0, 101).replace(/^(.{97}).{4}$/, '$1...') }`;
6989
7040
  }
6990
7041
  exports.identity = identity;
6991
- function text(source) {
7042
+ function text(source, optional = false) {
6992
7043
  var _a;
6993
- const indexer = source.querySelector('.indexer');
7044
+ const indexer = source.querySelector(':scope > .indexer');
6994
7045
  if (indexer)
6995
7046
  return indexer.getAttribute('data-index');
7047
+ if (optional)
7048
+ return '';
6996
7049
  const target = source.cloneNode(true);
6997
7050
  for (let es = target.querySelectorAll('code[data-src], .math[data-src], .comment, rt, rp, .reference'), i = 0, len = es.length; i < len; ++i) {
6998
7051
  const el = es[i];
@@ -7123,7 +7176,7 @@ require = function () {
7123
7176
  class: 'invalid',
7124
7177
  'data-invalid-syntax': 'extension',
7125
7178
  'data-invalid-type': 'syntax',
7126
- 'data-invalid-description': 'Invalid symbol.'
7179
+ 'data-invalid-message': 'Invalid symbol'
7127
7180
  }, (0, typed_dom_1.defrag)(bs))],
7128
7181
  rest
7129
7182
  ], ([as, bs], rest) => [
@@ -7231,37 +7284,37 @@ require = function () {
7231
7284
  function elem(tag, as, bs, cs, context) {
7232
7285
  var _a, _b, _c, _d, _e, _f;
7233
7286
  if (!tags.includes(tag))
7234
- return invalid('tag', `Invalid HTML tag <${ tag }>.`, as, bs, cs);
7287
+ return invalid('tag', `Invalid HTML tag <${ tag }>`, as, bs, cs);
7235
7288
  switch (tag) {
7236
7289
  case 'sup':
7237
7290
  case 'sub':
7238
7291
  switch (true) {
7239
7292
  case (_b = (_a = context.state) === null || _a === void 0 ? void 0 : _a.in) === null || _b === void 0 ? void 0 : _b.supsub:
7240
- return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup> or <sub> HTML tag.`, as, bs, cs);
7293
+ return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup> or <sub> HTML tag`, as, bs, cs);
7241
7294
  }
7242
7295
  break;
7243
7296
  case 'small':
7244
7297
  switch (true) {
7245
7298
  case (_d = (_c = context.state) === null || _c === void 0 ? void 0 : _c.in) === null || _d === void 0 ? void 0 : _d.supsub:
7246
7299
  case (_f = (_e = context.state) === null || _e === void 0 ? void 0 : _e.in) === null || _f === void 0 ? void 0 : _f.small:
7247
- return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup>, <sub>, or <small> HTML tag.`, as, bs, cs);
7300
+ return invalid('nest', `<${ tag }> HTML tag cannot be used in <sup>, <sub>, or <small> HTML tag`, as, bs, cs);
7248
7301
  }
7249
7302
  break;
7250
7303
  }
7251
7304
  let attrs;
7252
7305
  switch (true) {
7253
7306
  case 'data-invalid-syntax' in (attrs = attributes('html', [], attrspec[tag], as.slice(1, -1))):
7254
- return invalid('attribute', 'Invalid HTML attribute.', as, bs, cs);
7307
+ return invalid('attribute', 'Invalid HTML attribute', as, bs, cs);
7255
7308
  default:
7256
7309
  return (0, typed_dom_1.html)(tag, attrs, bs);
7257
7310
  }
7258
7311
  }
7259
- function invalid(type, description, as, bs, cs) {
7312
+ function invalid(type, message, as, bs, cs) {
7260
7313
  return (0, typed_dom_1.html)('span', {
7261
7314
  class: 'invalid',
7262
7315
  'data-invalid-syntax': 'html',
7263
7316
  'data-invalid-type': type,
7264
- 'data-invalid-description': description
7317
+ 'data-invalid-message': message
7265
7318
  }, (0, typed_dom_1.defrag)((0, array_1.push)((0, array_1.unshift)(as, bs), cs)));
7266
7319
  }
7267
7320
  const requiredAttributes = (0, memoize_1.memoize)(spec => (0, alias_1.ObjectEntries)(spec).flatMap(([k, v]) => v && (0, alias_1.isFrozen)(v) ? [k] : []), new WeakMap());
@@ -7285,7 +7338,7 @@ require = function () {
7285
7338
  attrs['class'] = (0, array_1.join)(classes, ' ');
7286
7339
  attrs['data-invalid-syntax'] = syntax;
7287
7340
  attrs['data-invalid-type'] = 'argument';
7288
- attrs['data-invalid-description'] = 'Invalid argument.';
7341
+ attrs['data-invalid-message'] = 'Invalid argument';
7289
7342
  }
7290
7343
  return attrs;
7291
7344
  }
@@ -7309,21 +7362,35 @@ require = function () {
7309
7362
  'use strict';
7310
7363
  Object.defineProperty(exports, '__esModule', { value: true });
7311
7364
  exports.htmlentity = exports.unsafehtmlentity = void 0;
7365
+ const global_1 = _dereq_('spica/global');
7312
7366
  const combinator_1 = _dereq_('../../combinator');
7313
7367
  const typed_dom_1 = _dereq_('typed-dom');
7314
- exports.unsafehtmlentity = (0, combinator_1.creator)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&(?!NewLine;)[0-9A-Za-z]+;/, (parser => entity => (parser.innerHTML = entity, entity = parser.textContent, [
7315
- [`${ entity[0] !== '&' || entity.length === 1 ? '' : '\0' }${ entity }`],
7316
- ''
7317
- ]))((0, typed_dom_1.html)('b')))));
7318
- exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([str]) => [str[0] === '\0' ? (0, typed_dom_1.html)('span', {
7368
+ const memoize_1 = _dereq_('spica/memoize');
7369
+ exports.unsafehtmlentity = (0, combinator_1.creator)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]+;/, entity => {
7370
+ var _a;
7371
+ return [
7372
+ [(_a = parse(entity)) !== null && _a !== void 0 ? _a : `\0${ entity }`],
7373
+ ''
7374
+ ];
7375
+ })));
7376
+ exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([test]) => [test[0] === '\0' ? (0, typed_dom_1.html)('span', {
7319
7377
  class: 'invalid',
7320
7378
  'data-invalid-syntax': 'htmlentity',
7321
7379
  'data-invalid-type': 'syntax',
7322
- 'data-invalid-description': 'Invalid HTML entity.'
7323
- }, str.slice(1)) : str]);
7380
+ 'data-invalid-message': 'Invalid HTML entity'
7381
+ }, test.slice(1)) : test]);
7382
+ const parse = (0, memoize_1.reduce)((el => entity => {
7383
+ if (entity === '&NewLine;')
7384
+ return ' ';
7385
+ el.innerHTML = entity;
7386
+ const text = el.textContent;
7387
+ return entity === text ? global_1.undefined : text;
7388
+ })((0, typed_dom_1.html)('b')));
7324
7389
  },
7325
7390
  {
7326
7391
  '../../combinator': 27,
7392
+ 'spica/global': 15,
7393
+ 'spica/memoize': 18,
7327
7394
  'typed-dom': 26
7328
7395
  }
7329
7396
  ],
@@ -7339,7 +7406,7 @@ require = function () {
7339
7406
  const typed_dom_1 = _dereq_('typed-dom');
7340
7407
  const array_1 = _dereq_('spica/array');
7341
7408
  exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([
7342
- (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/, /\+\+/)),
7409
+ (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/, '++')),
7343
7410
  (0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, '+'), true)
7344
7411
  ])), (0, source_1.str)('++'), false, ([, bs], rest) => [
7345
7412
  [(0, typed_dom_1.html)('ins', (0, typed_dom_1.defrag)(bs))],
@@ -7444,13 +7511,13 @@ require = function () {
7444
7511
  exports.resolve = resolve;
7445
7512
  function elem(INSECURE_URI, content, uri, origin) {
7446
7513
  let type;
7447
- let description;
7514
+ let message;
7448
7515
  switch (uri.protocol) {
7449
7516
  case 'http:':
7450
7517
  case 'https:':
7451
7518
  if (INSECURE_URI.slice(0, 2) === '^/' && /\/\.\.?(?:\/|$)/.test(INSECURE_URI.slice(0, INSECURE_URI.search(/[?#]|$/)))) {
7452
7519
  type = 'argument';
7453
- description = 'Dot-segments cannot be used in subresource paths.';
7520
+ message = 'Dot-segments cannot be used in subresource paths';
7454
7521
  break;
7455
7522
  }
7456
7523
  return (0, typed_dom_1.html)('a', {
@@ -7467,14 +7534,14 @@ require = function () {
7467
7534
  return (0, typed_dom_1.html)('a', { href: uri.source }, content);
7468
7535
  }
7469
7536
  type = 'content';
7470
- description = 'Invalid phone number.';
7537
+ message = 'Invalid phone number';
7471
7538
  break;
7472
7539
  }
7473
7540
  return (0, typed_dom_1.html)('a', {
7474
7541
  class: 'invalid',
7475
7542
  'data-invalid-syntax': 'link',
7476
7543
  'data-invalid-type': type !== null && type !== void 0 ? type : type = 'argument',
7477
- 'data-invalid-description': description !== null && description !== void 0 ? description : description = 'Invalid protocol.'
7544
+ 'data-invalid-message': message !== null && message !== void 0 ? message : message = 'Invalid protocol'
7478
7545
  }, content.length === 0 ? INSECURE_URI : content);
7479
7546
  }
7480
7547
  function decode(uri) {
@@ -7513,7 +7580,7 @@ require = function () {
7513
7580
  const typed_dom_1 = _dereq_('typed-dom');
7514
7581
  const array_1 = _dereq_('spica/array');
7515
7582
  exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
7516
- (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', /==/)),
7583
+ (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '==')),
7517
7584
  (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), inline_1.inline)
7518
7585
  ]))), (0, source_1.str)('=='), false, ([, bs], rest) => [
7519
7586
  [(0, typed_dom_1.html)('mark', (0, typed_dom_1.defrag)(bs))],
@@ -7558,7 +7625,7 @@ require = function () {
7558
7625
  translate: 'no',
7559
7626
  'data-invalid-syntax': 'math',
7560
7627
  'data-invalid-type': 'content',
7561
- 'data-invalid-description': `"${ source.match(disallowedCommand)[0] }" command is disallowed.`
7628
+ 'data-invalid-message': `"${ source.match(disallowedCommand)[0] }" command is disallowed`
7562
7629
  }, source)],
7563
7630
  ''
7564
7631
  ];
@@ -7690,7 +7757,7 @@ require = function () {
7690
7757
  class: void target.classList.add('invalid'),
7691
7758
  'data-invalid-syntax': 'media',
7692
7759
  'data-invalid-type': 'argument',
7693
- 'data-invalid-description': 'Dot-segments cannot be used in media paths; use subresource paths instead.'
7760
+ 'data-invalid-message': 'Dot-segments cannot be used in media paths; use subresource paths instead'
7694
7761
  });
7695
7762
  return false;
7696
7763
  }
@@ -7700,7 +7767,7 @@ require = function () {
7700
7767
  class: void target.classList.add('invalid'),
7701
7768
  'data-invalid-syntax': 'media',
7702
7769
  'data-invalid-type': 'argument',
7703
- 'data-invalid-description': 'Invalid protocol.'
7770
+ 'data-invalid-message': 'Invalid protocol'
7704
7771
  });
7705
7772
  return false;
7706
7773
  }
@@ -7709,7 +7776,7 @@ require = function () {
7709
7776
  class: void target.classList.add('invalid'),
7710
7777
  'data-invalid-syntax': 'media',
7711
7778
  'data-invalid-type': 'content',
7712
- 'data-invalid-description': `Cannot use invalid HTML entitiy "${ alt.match(/&[0-9A-Za-z]+;/)[0] }".`,
7779
+ 'data-invalid-message': `Cannot use invalid HTML entitiy "${ alt.match(/&[0-9A-Za-z]+;/)[0] }"`,
7713
7780
  alt: (_a = target.getAttribute('alt')) === null || _a === void 0 ? void 0 : _a.replace(/\0/g, '')
7714
7781
  });
7715
7782
  return false;
@@ -7773,7 +7840,7 @@ require = function () {
7773
7840
  class: 'invalid',
7774
7841
  'data-invalid-syntax': 'reference',
7775
7842
  'data-invalid-type': 'syntax',
7776
- 'data-invalid-description': 'Invalid abbr.'
7843
+ 'data-invalid-message': 'Invalid abbr'
7777
7844
  } : { class: 'reference' };
7778
7845
  }
7779
7846
  },
@@ -7873,14 +7940,14 @@ require = function () {
7873
7940
  rubies
7874
7941
  ]) {
7875
7942
  for (let i = 0; i < ss.length; ++i) {
7876
- if (!ss[i].includes('\0'))
7943
+ if (ss[i].indexOf('\0') === -1)
7877
7944
  continue;
7878
7945
  ss[i] = ss[i].replace(/\0/g, '');
7879
7946
  attrs !== null && attrs !== void 0 ? attrs : attrs = {
7880
7947
  class: 'invalid',
7881
7948
  'data-invalid-syntax': 'ruby',
7882
7949
  'data-invalid-type': ss === texts ? 'content' : 'argument',
7883
- 'data-invalid-description': 'Invalid HTML entity.'
7950
+ 'data-invalid-message': 'Invalid HTML entity'
7884
7951
  };
7885
7952
  }
7886
7953
  }
@@ -7929,7 +7996,7 @@ require = function () {
7929
7996
  const typed_dom_1 = _dereq_('typed-dom');
7930
7997
  const array_1 = _dereq_('spica/array');
7931
7998
  exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('**'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
7932
- (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', /\*\*/)),
7999
+ (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '**')),
7933
8000
  (0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
7934
8001
  ])), '*'), (0, source_1.str)('**'), false, ([, bs], rest) => [
7935
8002
  [(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))],
@@ -8104,6 +8171,7 @@ require = function () {
8104
8171
  el.getAttribute('data-label'),
8105
8172
  el
8106
8173
  ]));
8174
+ const labels = new global_1.Set();
8107
8175
  const numbers = new global_1.Map();
8108
8176
  let base = '0';
8109
8177
  let bases = base.split('.');
@@ -8148,6 +8216,26 @@ require = function () {
8148
8216
  opts.id !== '' && def.setAttribute('id', `label:${ opts.id ? `${ opts.id }:` : '' }${ label }`);
8149
8217
  const figindex = group === '$' ? `(${ number })` : `${ capitalize(group) }${ group === 'fig' ? '.' : '' } ${ number }`;
8150
8218
  (0, typed_dom_1.define)(def.querySelector(':scope > figcaption > .figindex'), group === '$' ? figindex : `${ figindex }. `);
8219
+ if (labels.has(label)) {
8220
+ if (def.classList.contains('invalid') && def.getAttribute('data-invalid-message') !== 'Duplicate label')
8221
+ continue;
8222
+ (0, typed_dom_1.define)(def, {
8223
+ id: null,
8224
+ class: void def.classList.add('invalid'),
8225
+ 'data-invalid-syntax': 'figure',
8226
+ 'data-invalid-type': 'argument',
8227
+ 'data-invalid-message': 'Duplicate label'
8228
+ });
8229
+ continue;
8230
+ } else {
8231
+ labels.add(label);
8232
+ (0, typed_dom_1.define)(def, {
8233
+ class: void def.classList.remove('invalid'),
8234
+ 'data-invalid-syntax': null,
8235
+ 'data-invalid-type': null,
8236
+ 'data-invalid-message': null
8237
+ });
8238
+ }
8151
8239
  for (const ref of refs.take(label, global_1.Infinity)) {
8152
8240
  if (ref.hash.slice(1) === def.id && ref.innerText === figindex)
8153
8241
  continue;
@@ -8160,7 +8248,7 @@ require = function () {
8160
8248
  class: `${ ref.className } disabled invalid`,
8161
8249
  'data-invalid-syntax': 'label',
8162
8250
  'data-invalid-type': 'reference',
8163
- 'data-invalid-description': 'Missing the reference.'
8251
+ 'data-invalid-message': 'Missing the target figure'
8164
8252
  });
8165
8253
  }
8166
8254
  yield ref;
@@ -8235,7 +8323,7 @@ require = function () {
8235
8323
  class: `${ ref.className } invalid`,
8236
8324
  'data-invalid-syntax': syntax,
8237
8325
  'data-invalid-type': 'style',
8238
- 'data-invalid-description': `${ syntax[0].toUpperCase() + syntax.slice(1) } style must be consistent.`
8326
+ 'data-invalid-message': `${ syntax[0].toUpperCase() + syntax.slice(1) } style must be consistent`
8239
8327
  });
8240
8328
  }
8241
8329
  if (((_a = ref.firstElementChild) === null || _a === void 0 ? void 0 : _a.getAttribute('hidden')) !== '') {
@@ -8262,7 +8350,7 @@ require = function () {
8262
8350
  class: void ref.classList.remove('invalid'),
8263
8351
  'data-invalid-syntax': null,
8264
8352
  'data-invalid-type': null,
8265
- 'data-invalid-description': null
8353
+ 'data-invalid-message': null
8266
8354
  });
8267
8355
  }
8268
8356
  }
@@ -8275,7 +8363,7 @@ require = function () {
8275
8363
  class: void ref.classList.add('invalid'),
8276
8364
  'data-invalid-syntax': syntax,
8277
8365
  'data-invalid-type': 'content',
8278
- 'data-invalid-description': 'Missing the content.'
8366
+ 'data-invalid-message': 'Missing the content'
8279
8367
  }
8280
8368
  });
8281
8369
  yield ref.appendChild((0, typed_dom_1.html)('a', { href: refId && defId && `#${ defId }` }, marker(defIndex, abbr)));
@@ -8729,7 +8817,7 @@ require = function () {
8729
8817
  const memoize_1 = _dereq_('spica/memoize');
8730
8818
  const array_1 = _dereq_('spica/array');
8731
8819
  function blank(prefix, suffix) {
8732
- return new RegExp(String.raw`^${ prefix && prefix.source }(?:\\\s|[^\S\n]+|\n|&(?:${ normalize_1.invisibleHTMLEntityNames.join('|') });|<wbr>)?${ typeof suffix === 'string' ? suffix : suffix.source }`);
8820
+ return new RegExp(String.raw`^${ prefix && prefix.source }(?:\\\s|[^\S\n]+|\n|&(?:${ normalize_1.invisibleHTMLEntityNames.join('|') });|<wbr>)?${ typeof suffix === 'string' ? suffix.replace(/[*+()\[\]]/g, '\\$&') : suffix.source }`);
8733
8821
  }
8734
8822
  exports.blank = blank;
8735
8823
  function visualize(parser) {