securemark 0.243.0 → 0.244.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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.244.0
4
+
5
+ - Change mathblock syntax to increase the maximum number of contained lines to 300.
6
+ - Fix fence parser.
7
+
8
+ ## 0.243.2
9
+
10
+ - Refactoring.
11
+
12
+ ## 0.243.1
13
+
14
+ - Refactoring.
15
+
3
16
  ## 0.243.0
4
17
 
5
18
  - Reserve sidefence syntax.
@@ -1,4 +1,4 @@
1
- /*! securemark v0.243.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
1
+ /*! securemark v0.244.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) {
@@ -2067,24 +2067,37 @@ require = function () {
2067
2067
  return;
2068
2068
  let block = '';
2069
2069
  let closer = '';
2070
- for (let count = 1, next = (0, line_1.firstline)(rest);; ++count) {
2070
+ let overflow = '';
2071
+ for (let count = 1;; ++count) {
2071
2072
  if (rest === '')
2072
2073
  break;
2073
- const line = next;
2074
- next = (0, line_1.firstline)(rest.slice(line.length));
2075
- if (count > limit + 1 && (0, line_1.isEmpty)(line))
2076
- break;
2077
- if (count <= limit + 1 && line.slice(0, delim.length) === delim && line.trimEnd() === delim && (!separation || (0, line_1.isEmpty)(next))) {
2078
- closer = delim;
2079
- rest = rest.slice(line.length);
2074
+ const line = (0, line_1.firstline)(rest);
2075
+ if ((closer || count > limit + 1) && (0, line_1.isEmpty)(line))
2080
2076
  break;
2077
+ if (closer) {
2078
+ overflow += line;
2079
+ }
2080
+ if (!closer && count <= limit + 1 && line.slice(0, delim.length) === delim && line.trimEnd() === delim) {
2081
+ closer = line;
2082
+ if ((0, line_1.isEmpty)((0, line_1.firstline)(rest.slice(line.length)))) {
2083
+ rest = rest.slice(line.length);
2084
+ break;
2085
+ }
2086
+ if (!separation) {
2087
+ rest = rest.slice(line.length);
2088
+ break;
2089
+ }
2090
+ overflow = line;
2091
+ }
2092
+ if (!overflow) {
2093
+ block += line;
2081
2094
  }
2082
- block += line;
2083
2095
  rest = rest.slice(line.length);
2084
2096
  }
2085
2097
  return [
2086
2098
  (0, array_1.unshift)([
2087
2099
  block,
2100
+ overflow,
2088
2101
  closer
2089
2102
  ], matches),
2090
2103
  rest
@@ -2457,6 +2470,7 @@ require = function () {
2457
2470
  'use strict';
2458
2471
  Object.defineProperty(exports, '__esModule', { value: true });
2459
2472
  exports.check = exports.exec = exports.eval = exports.Delimiters = void 0;
2473
+ const global_1 = _dereq_('spica/global');
2460
2474
  class Delimiters {
2461
2475
  constructor() {
2462
2476
  this.matchers = [];
@@ -2465,7 +2479,7 @@ require = function () {
2465
2479
  push(delimiter) {
2466
2480
  const {signature, matcher, escape} = delimiter;
2467
2481
  if (this.record[signature] === !escape) {
2468
- this.matchers.unshift(() => undefined);
2482
+ this.matchers.unshift(() => global_1.undefined);
2469
2483
  } else {
2470
2484
  this.matchers.unshift(matcher);
2471
2485
  this.record[signature] = !escape;
@@ -2501,7 +2515,7 @@ require = function () {
2501
2515
  }
2502
2516
  exports.check = check;
2503
2517
  },
2504
- {}
2518
+ { 'spica/global': 13 }
2505
2519
  ],
2506
2520
  46: [
2507
2521
  function (_dereq_, module, exports) {
@@ -3403,7 +3417,7 @@ require = function () {
3403
3417
  const language = /^[0-9a-z]+(?:-[a-z][0-9a-z]*)*$/i;
3404
3418
  exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('```', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 300))));
3405
3419
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('```', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false))), false);
3406
- exports.codeblock = (0, combinator_1.block)((0, combinator_1.validate)('```', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300), ([body, closer, opener, delim, param], _, context) => {
3420
+ exports.codeblock = (0, combinator_1.block)((0, combinator_1.validate)('```', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300), ([body, overflow, closer, opener, delim, param], _, context) => {
3407
3421
  var _a, _b, _c, _d, _e, _f;
3408
3422
  const params = (_b = (_a = param.match(/(?:\\.?|\S)+/g)) === null || _a === void 0 ? void 0 : _a.reduce((params, value, i) => {
3409
3423
  var _a, _b, _c;
@@ -3423,17 +3437,17 @@ require = function () {
3423
3437
  params.lang = file && file.includes('.', 1) ? (_c = (_b = file.split('.').pop()) === null || _b === void 0 ? void 0 : _b.match(language)) === null || _c === void 0 ? void 0 : _c[0].toLowerCase() : params.lang;
3424
3438
  }
3425
3439
  }
3426
- name in params ? params.invalid = `Duplicate ${ name } value` : params[name] = value;
3440
+ name in params ? params.invalid = `Duplicate ${ name } attribute` : params[name] = value;
3427
3441
  return params;
3428
3442
  }, {})) !== null && _b !== void 0 ? _b : {};
3429
- if (!closer || params.invalid)
3443
+ if (!closer || overflow || params.invalid)
3430
3444
  return [(0, dom_1.html)('pre', {
3431
3445
  class: 'invalid',
3432
3446
  translate: 'no',
3433
3447
  'data-invalid-syntax': 'codeblock',
3434
- 'data-invalid-type': !closer ? 'fence' : 'argument',
3435
- 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : params.invalid
3436
- }, `${ opener }${ body }${ closer }`)];
3448
+ 'data-invalid-type': !closer || overflow ? 'fence' : 'argument',
3449
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : overflow ? `Invalid trailing line after the closing delimiter "${ delim }"` : params.invalid
3450
+ }, `${ opener }${ body }${ overflow || closer }`)];
3437
3451
  const el = (0, dom_1.html)('pre', {
3438
3452
  class: params.lang ? `code language-${ params.lang }` : 'text',
3439
3453
  translate: params.lang ? 'no' : global_1.undefined,
@@ -3554,16 +3568,16 @@ require = function () {
3554
3568
  const indexee_1 = _dereq_('../../inline/extension/indexee');
3555
3569
  const parse_1 = _dereq_('../../api/parse');
3556
3570
  const dom_1 = _dereq_('typed-dom/dom');
3557
- exports.aside = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/, 300), ([body, closer, opener, delim, param], _, context) => {
3571
+ exports.aside = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})aside(?!\S)([^\n]*)(?:$|\n)/, 300), ([body, overflow, closer, opener, delim, param], _, context) => {
3558
3572
  var _a;
3559
- if (!closer || param.trimStart())
3573
+ if (!closer || overflow || param.trimStart())
3560
3574
  return [(0, dom_1.html)('pre', {
3561
3575
  class: 'invalid',
3562
3576
  translate: 'no',
3563
3577
  'data-invalid-syntax': 'aside',
3564
- 'data-invalid-type': !closer ? 'fence' : 'argument',
3565
- 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
3566
- }, `${ opener }${ body }${ closer }`)];
3578
+ 'data-invalid-type': !closer || overflow ? 'fence' : 'argument',
3579
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : overflow ? `Invalid trailing line after the closing delimiter "${ delim }"` : 'Invalid argument'
3580
+ }, `${ opener }${ body }${ overflow || closer }`)];
3567
3581
  const annotations = (0, dom_1.html)('ol', { class: 'annotations' });
3568
3582
  const references = (0, dom_1.html)('ol', { class: 'references' });
3569
3583
  const document = (0, parse_1.parse)(body.slice(0, -1), {
@@ -3609,16 +3623,16 @@ require = function () {
3609
3623
  const parse_1 = _dereq_('../../api/parse');
3610
3624
  const mathblock_1 = _dereq_('../mathblock');
3611
3625
  const dom_1 = _dereq_('typed-dom/dom');
3612
- const opener = /^(~{3,})(?:example\/(\S+)|(?!\S))([^\n]*)(?:$|\n)/;
3613
- exports.example = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300), ([body, closer, opener, delim, type = 'markdown', param], _, context) => {
3614
- if (!closer || param.trimStart())
3626
+ const opener = /^(~{3,})(?:example\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/;
3627
+ exports.example = (0, combinator_1.creator)(100, (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300), ([body, overflow, closer, opener, delim, type = 'markdown', param], _, context) => {
3628
+ if (!closer || overflow || param.trimStart())
3615
3629
  return [(0, dom_1.html)('pre', {
3616
3630
  class: 'invalid',
3617
3631
  translate: 'no',
3618
3632
  'data-invalid-syntax': 'example',
3619
- 'data-invalid-type': !closer ? 'fence' : 'argument',
3620
- 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
3621
- }, `${ opener }${ body }${ closer }`)];
3633
+ 'data-invalid-type': !closer || overflow ? 'fence' : 'argument',
3634
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : overflow ? `Invalid trailing line after the closing delimiter "${ delim }"` : 'Invalid argument'
3635
+ }, `${ opener }${ body }${ overflow || closer }`)];
3622
3636
  switch (type) {
3623
3637
  case 'markdown': {
3624
3638
  const annotations = (0, dom_1.html)('ol', { class: 'annotations' });
@@ -3657,6 +3671,7 @@ require = function () {
3657
3671
  class: 'invalid',
3658
3672
  translate: 'no',
3659
3673
  'data-invalid-syntax': 'example',
3674
+ 'data-invalid-type': 'type',
3660
3675
  'data-invalid-message': 'Invalid example type'
3661
3676
  }, `${ opener }${ body }${ closer }`)];
3662
3677
  }
@@ -3701,7 +3716,7 @@ require = function () {
3701
3716
  exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)(source => {
3702
3717
  const fence = (/^[^\n]*\n!?>+\s/.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/mg) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
3703
3718
  return `${ fence }figure ${ source }\n\n${ fence }`;
3704
- }, (0, combinator_1.union)([figure_1.figure])), ([el]) => el.className !== 'invalid' || el.getAttribute('data-invalid-type') !== 'content')));
3719
+ }, (0, combinator_1.union)([figure_1.figure])), ([el]) => el.tagName === 'FIGURE')));
3705
3720
  },
3706
3721
  {
3707
3722
  '../../../combinator': 25,
@@ -3764,7 +3779,7 @@ require = function () {
3764
3779
  const dom_1 = _dereq_('typed-dom/dom');
3765
3780
  const memoize_1 = _dereq_('spica/memoize');
3766
3781
  const array_1 = _dereq_('spica/array');
3767
- exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n]+)?(?=\[?\$[A-Za-z-][^\n]*\n)/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${ fence }[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([
3782
+ exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/^(~{3,})(?:figure[^\S\n]|(?=\[?\$))/, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`^${ fence }[^\S\n]*(?:$|\n)`)) => (0, combinator_1.close)((0, combinator_1.sequence)([
3768
3783
  source_1.contentline,
3769
3784
  (0, combinator_1.inits)([
3770
3785
  (0, combinator_1.union)([
@@ -3782,10 +3797,10 @@ require = function () {
3782
3797
  ])
3783
3798
  ])
3784
3799
  ]), closer), ([, fence]) => fence.length, [])));
3785
- exports.figure = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.search(/[[$]/), source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([
3800
+ exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:figure[^\S\n]+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([
3786
3801
  (0, combinator_1.line)((0, combinator_1.sequence)([
3787
3802
  label_1.label,
3788
- (0, source_1.str)(/^.*\n/)
3803
+ (0, source_1.str)(/^(?=\s).*\n/)
3789
3804
  ])),
3790
3805
  (0, combinator_1.inits)([
3791
3806
  (0, combinator_1.block)((0, combinator_1.union)([
@@ -3799,9 +3814,8 @@ require = function () {
3799
3814
  table_2.table,
3800
3815
  blockquote_1.blockquote,
3801
3816
  placeholder_1.placeholder,
3802
- (0, combinator_1.block)((0, combinator_1.line)(inline_1.media)),
3803
- (0, combinator_1.block)((0, combinator_1.line)(inline_1.shortmedia)),
3804
- (0, combinator_1.fmap)((0, combinator_1.some)(source_1.contentline), () => [(0, dom_1.html)('br')])
3817
+ (0, combinator_1.line)(inline_1.media),
3818
+ (0, combinator_1.line)(inline_1.shortmedia)
3805
3819
  ])),
3806
3820
  source_1.emptyline,
3807
3821
  (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.context)({ syntax: { inline: { media: false } } }, (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline))))))
@@ -3809,7 +3823,30 @@ require = function () {
3809
3823
  ])), ([label, param, content, ...caption]) => [(0, dom_1.html)('figure', attributes(label.getAttribute('data-label'), param, content, caption), [
3810
3824
  (0, dom_1.html)('figcaption', (0, array_1.unshift)([(0, dom_1.html)('span', { class: 'figindex' })], (0, dom_1.defrag)(caption))),
3811
3825
  (0, dom_1.html)('div', [content])
3812
- ])])));
3826
+ ])])), (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})(?:figure|\[?\$\S*)(?!\S)[^\n]*(?:$|\n)/, 300), ([body, overflow, closer, opener, delim], _, context) => {
3827
+ var _a, _b;
3828
+ return [(0, dom_1.html)('pre', {
3829
+ class: 'invalid',
3830
+ translate: 'no',
3831
+ 'data-invalid-syntax': 'figure',
3832
+ ...!closer && {
3833
+ 'data-invalid-type': 'fence',
3834
+ 'data-invalid-message': `Missing the closing delimiter "${ delim }"`
3835
+ } || overflow && {
3836
+ 'data-invalid-type': 'fence',
3837
+ 'data-invalid-message': `Invalid trailing line after the closing delimiter "${ delim }"`
3838
+ } || !(0, label_1.segment)((_b = (_a = opener.match(/^~+(?:figure[^\S\n]+)?(\[?\$\S+)/)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : '', context) && {
3839
+ 'data-invalid-type': 'label',
3840
+ 'data-invalid-message': 'Invalid label'
3841
+ } || /^~+(?:figure[^\S\n]+)?(\[?\$\S+)[^\S\n]+\S/.test(opener) && {
3842
+ 'data-invalid-type': 'argument',
3843
+ 'data-invalid-message': 'Invalid argument'
3844
+ } || {
3845
+ 'data-invalid-type': 'content',
3846
+ 'data-invalid-message': 'Invalid content'
3847
+ }
3848
+ }, `${ opener }${ body }${ overflow || closer }`)];
3849
+ })));
3813
3850
  function attributes(label, param, content, caption) {
3814
3851
  const group = label.split('-', 1)[0];
3815
3852
  let type = content.className.split(/\s/)[0];
@@ -3828,9 +3865,6 @@ require = function () {
3828
3865
  case 'A':
3829
3866
  type = 'media';
3830
3867
  break;
3831
- case 'BR':
3832
- type = 'invalid';
3833
- break;
3834
3868
  case 'text':
3835
3869
  case 'code':
3836
3870
  case 'math':
@@ -3839,15 +3873,12 @@ require = function () {
3839
3873
  break;
3840
3874
  default:
3841
3875
  }
3842
- const invalid = type === 'invalid' && content.tagName === 'BR' && {
3843
- 'data-invalid-type': 'content',
3844
- 'data-invalid-message': 'Invalid content'
3876
+ const invalid = param.trimStart() !== '' && {
3877
+ 'data-invalid-type': 'argument',
3878
+ 'data-invalid-message': 'Invalid argument'
3845
3879
  } || /^[^-]+-(?:[0-9]+\.)*0$/.test(label) && {
3846
3880
  'data-invalid-type': 'label',
3847
3881
  'data-invalid-message': 'The last part of the fixed label numbers must not be 0'
3848
- } || param.trimStart() !== '' && {
3849
- 'data-invalid-type': 'argument',
3850
- 'data-invalid-message': 'Invalid argument'
3851
3882
  } || group === '$' && (type !== 'math' || caption.length > 0) && {
3852
3883
  'data-invalid-type': 'label',
3853
3884
  'data-invalid-message': '"$" label group must be used to math formulas with no caption'
@@ -3932,15 +3963,15 @@ require = function () {
3932
3963
  const paragraph_1 = _dereq_('../paragraph');
3933
3964
  const dom_1 = _dereq_('typed-dom/dom');
3934
3965
  const array_1 = _dereq_('spica/array');
3935
- exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/, 300), ([body, closer, opener, delim, type, param], _, context) => {
3936
- if (!closer || param.trimStart())
3966
+ exports.message = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(/^(~{3,})message\/(\S+)([^\n]*)(?:$|\n)/, 300), ([body, overflow, closer, opener, delim, type, param], _, context) => {
3967
+ if (!closer || overflow || param.trimStart())
3937
3968
  return [(0, dom_1.html)('pre', {
3938
3969
  class: 'invalid',
3939
3970
  translate: 'no',
3940
3971
  'data-invalid-syntax': 'message',
3941
- 'data-invalid-type': !closer ? 'fence' : 'argument',
3942
- 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
3943
- }, `${ opener }${ body }${ closer }`)];
3972
+ 'data-invalid-type': !closer || overflow ? 'fence' : 'argument',
3973
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : overflow ? `Invalid trailing line after the closing delimiter "${ delim }"` : 'Invalid argument'
3974
+ }, `${ opener }${ body }${ overflow || closer }`)];
3944
3975
  switch (type) {
3945
3976
  case 'note':
3946
3977
  case 'caution':
@@ -3951,6 +3982,7 @@ require = function () {
3951
3982
  class: 'invalid',
3952
3983
  translate: 'no',
3953
3984
  'data-invalid-syntax': 'message',
3985
+ 'data-invalid-type': 'type',
3954
3986
  'data-invalid-message': 'Invalid message type'
3955
3987
  }, `${ opener }${ body }${ closer }`)];
3956
3988
  }
@@ -4008,27 +4040,18 @@ require = function () {
4008
4040
  Object.defineProperty(exports, '__esModule', { value: true });
4009
4041
  exports.placeholder = exports.segment_ = exports.segment = void 0;
4010
4042
  const combinator_1 = _dereq_('../../../combinator');
4011
- const label_1 = _dereq_('../../inline/extension/label');
4012
4043
  const dom_1 = _dereq_('typed-dom/dom');
4013
4044
  const opener = /^(~{3,})(?!~)[^\n]*(?:$|\n)/;
4014
4045
  exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 300))));
4015
4046
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false))), false);
4016
- exports.placeholder = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), ([body, closer, opener, delim], _, context) => [(0, dom_1.html)('pre', {
4047
+ exports.placeholder = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), ([body, overflow, closer, opener, delim]) => [(0, dom_1.html)('pre', {
4017
4048
  class: 'invalid',
4018
4049
  translate: 'no',
4019
- 'data-invalid-syntax': 'extension',
4020
- 'data-invalid-type': !closer ? 'fence' : 'syntax',
4021
- 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid extension name',
4022
- ...closer && (opener.slice(delim.length).split(/\s/, 1)[0] === 'figure' || (0, label_1.segment)(opener.slice(delim.length), context)) && {
4023
- 'data-invalid-syntax': 'figure',
4024
- 'data-invalid-type': 'content',
4025
- 'data-invalid-message': 'Invalid content'
4026
- }
4027
- }, `${ opener }${ body }${ closer }`)])));
4050
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : overflow ? `Invalid trailing line after the closing delimiter "${ delim }"` : 'Invalid argument'
4051
+ }, `${ opener }${ body }${ overflow || closer }`)])));
4028
4052
  },
4029
4053
  {
4030
4054
  '../../../combinator': 25,
4031
- '../../inline/extension/label': 109,
4032
4055
  'typed-dom/dom': 23
4033
4056
  }
4034
4057
  ],
@@ -4050,16 +4073,16 @@ require = function () {
4050
4073
  const opener = /^(~{3,})table(?!\S)([^\n]*)(?:$|\n)/;
4051
4074
  exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000))));
4052
4075
  exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false))), false);
4053
- exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.recover)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 10000), ([body, closer, opener, delim, param], _, context) => {
4076
+ exports.table = (0, combinator_1.block)((0, combinator_1.validate)('~~~', (0, combinator_1.recover)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 10000), ([body, overflow, closer, opener, delim, param], _, context) => {
4054
4077
  var _a;
4055
- if (!closer || param.trimStart())
4078
+ if (!closer || overflow || param.trimStart())
4056
4079
  return [(0, dom_1.html)('pre', {
4057
4080
  class: 'invalid',
4058
4081
  translate: 'no',
4059
4082
  'data-invalid-syntax': 'table',
4060
- 'data-invalid-type': !closer ? 'fence' : 'argument',
4061
- 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
4062
- }, `${ opener }${ body }${ closer }`)];
4083
+ 'data-invalid-type': !closer || overflow ? 'fence' : 'argument',
4084
+ 'data-invalid-message': !closer ? `Missing the closing delimiter "${ delim }"` : overflow ? `Invalid trailing line after the closing delimiter "${ delim }"` : 'Invalid argument'
4085
+ }, `${ opener }${ body }${ overflow || closer }`)];
4063
4086
  return (_a = (0, parser_1.eval)(parser(body, context))) !== null && _a !== void 0 ? _a : [(0, dom_1.html)('table')];
4064
4087
  }), (source, _, reason) => reason instanceof Error && reason.message === 'Number of columns must be 32 or less' ? [
4065
4088
  [(0, dom_1.html)('pre', {
@@ -4431,24 +4454,24 @@ require = function () {
4431
4454
  const combinator_1 = _dereq_('../../combinator');
4432
4455
  const dom_1 = _dereq_('typed-dom/dom');
4433
4456
  const opener = /^(\${2,})(?!\$)([^\n]*)(?:$|\n)/;
4434
- exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 100))));
4435
- exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 100, false))), false);
4436
- exports.mathblock = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 100), ([body, closer, opener, delim, param], _, {
4457
+ exports.segment = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 300))));
4458
+ exports.segment_ = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false))), false);
4459
+ exports.mathblock = (0, combinator_1.block)((0, combinator_1.validate)('$$', (0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300), ([body, overflow, closer, opener, delim, param], _, {
4437
4460
  caches: {
4438
4461
  math: cache = global_1.undefined
4439
4462
  } = {}
4440
4463
  }) => {
4441
4464
  var _a;
4442
- return [delim.length === 2 && closer && param.trimStart() === '' ? ((_a = cache === null || cache === void 0 ? void 0 : cache.get(`${ delim }\n${ body }${ delim }`)) === null || _a === void 0 ? void 0 : _a.cloneNode(true)) || (0, dom_1.html)('div', {
4465
+ return [delim.length === 2 && closer && !overflow && param.trimStart() === '' ? ((_a = cache === null || cache === void 0 ? void 0 : cache.get(`${ delim }\n${ body }${ delim }`)) === null || _a === void 0 ? void 0 : _a.cloneNode(true)) || (0, dom_1.html)('div', {
4443
4466
  class: 'math',
4444
4467
  translate: 'no'
4445
4468
  }, `${ delim }\n${ body }${ delim }`) : (0, dom_1.html)('pre', {
4446
4469
  class: 'invalid',
4447
4470
  translate: 'no',
4448
4471
  'data-invalid-syntax': 'mathblock',
4449
- 'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? 'fence' : 'argument',
4450
- 'data-invalid-message': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${ delim }"` : 'Invalid argument'
4451
- }, `${ opener }${ body }${ closer }`)];
4472
+ 'data-invalid-type': delim.length > 2 ? 'syntax' : !closer || overflow ? 'fence' : 'argument',
4473
+ 'data-invalid-message': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${ delim }"` : overflow ? `Invalid trailing line after the closing delimiter "${ delim }"` : 'Invalid argument'
4474
+ }, `${ opener }${ body }${ overflow || closer }`)];
4452
4475
  })));
4453
4476
  },
4454
4477
  {
@@ -4812,9 +4835,9 @@ require = function () {
4812
4835
  const row = (parser, optional) => (0, combinator_1.creator)((0, combinator_1.fallback)((0, combinator_1.fmap)((0, combinator_1.line)((0, combinator_1.surround)(/^(?=\|)/, (0, combinator_1.some)((0, combinator_1.union)([parser])), /^\|?\s*$/, optional)), es => [(0, dom_1.html)('tr', es)]), (0, combinator_1.rewrite)(source_1.contentline, source => [
4813
4836
  [(0, dom_1.html)('tr', {
4814
4837
  class: 'invalid',
4815
- 'data-invalid-syntax': 'tablerow',
4838
+ 'data-invalid-syntax': 'table-row',
4816
4839
  'data-invalid-type': 'syntax',
4817
- 'data-invalid-message': 'Invalid table row'
4840
+ 'data-invalid-message': 'Missing the start symbol of the table row'
4818
4841
  }, [(0, dom_1.html)('td', source.replace('\n', ''))])],
4819
4842
  ''
4820
4843
  ])));
@@ -5965,7 +5988,8 @@ require = function () {
5965
5988
  const memoize_1 = _dereq_('spica/memoize');
5966
5989
  const cache_1 = _dereq_('spica/cache');
5967
5990
  const array_1 = _dereq_('spica/array');
5968
- const tags = (0, alias_1.ObjectFreeze)([
5991
+ const tags = Object.freeze([
5992
+ 'wbr',
5969
5993
  'sup',
5970
5994
  'sub',
5971
5995
  'small',
@@ -5974,19 +5998,19 @@ require = function () {
5974
5998
  ]);
5975
5999
  const attrspec = {
5976
6000
  bdo: {
5977
- dir: (0, alias_1.ObjectFreeze)([
6001
+ dir: Object.freeze([
5978
6002
  'ltr',
5979
6003
  'rtl'
5980
6004
  ])
5981
6005
  }
5982
6006
  };
5983
- (0, alias_1.ObjectSetPrototypeOf)(attrspec, null);
5984
- (0, alias_1.ObjectValues)(attrspec).forEach(o => (0, alias_1.ObjectSetPrototypeOf)(o, null));
6007
+ Object.setPrototypeOf(attrspec, null);
6008
+ Object.values(attrspec).forEach(o => Object.setPrototypeOf(o, null));
5985
6009
  exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.validate)('<', (0, combinator_1.validate)(/^<[a-z]+(?=[^\S\n]|>)/, (0, combinator_1.union)([
5986
6010
  (0, combinator_1.match)(/^(?=<(wbr)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)(`<${ tag }`, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute])), /^\s*>/, true, ([, bs = []], rest) => [
5987
6011
  [(0, dom_1.html)(tag, attributes('html', [], attrspec[tag], bs))],
5988
6012
  rest
5989
- ]), ([, tag]) => tag)),
6013
+ ]), ([, tag]) => tags.indexOf(tag), [])),
5990
6014
  (0, combinator_1.match)(/^(?=<(sup|sub|small)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.context)((() => {
5991
6015
  switch (tag) {
5992
6016
  case 'sup':
@@ -6015,27 +6039,27 @@ require = function () {
6015
6039
  ]), `</${ tag }>`)), `</${ tag }>`), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest, context) => [
6016
6040
  [elem(tag, as, (0, dom_1.defrag)(bs), cs, context)],
6017
6041
  rest
6018
- ])), ([, tag]) => tag)),
6042
+ ])), ([, tag]) => tags.indexOf(tag), [])),
6019
6043
  (0, combinator_1.match)(/^(?=<(bdo|bdi)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([
6020
6044
  (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/, `</${ tag }>`)),
6021
6045
  (0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, '</'), true)
6022
- ]), `</${ tag }>`), `</${ tag }>`), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest) => [
6023
- [elem(tag, as, (0, dom_1.defrag)(bs), cs, {})],
6046
+ ]), `</${ tag }>`), `</${ tag }>`), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest, context) => [
6047
+ [elem(tag, as, (0, dom_1.defrag)(bs), cs, context)],
6024
6048
  rest
6025
6049
  ], ([as, bs], rest) => as.length === 1 ? [
6026
6050
  (0, array_1.unshift)(as, bs),
6027
6051
  rest
6028
- ] : global_1.undefined)), ([, tag]) => tag)),
6052
+ ] : global_1.undefined)), ([, tag]) => tags.indexOf(tag), [])),
6029
6053
  (0, combinator_1.match)(/^(?=<([a-z]+)(?=[^\S\n]|>))/, (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.validate)(`<${ tag }`, `</${ tag }>`, (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${ tag }`), (0, combinator_1.some)(exports.attribute), (0, source_1.str)(/^\s*>/), true), (0, util_1.startLoose)((0, combinator_1.some)((0, combinator_1.union)([
6030
6054
  (0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/, `</${ tag }>`)),
6031
6055
  (0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, '</'), true)
6032
- ]), `</${ tag }>`), `</${ tag }>`), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest) => [
6033
- [elem(tag, as, (0, dom_1.defrag)(bs), cs, {})],
6056
+ ]), `</${ tag }>`), `</${ tag }>`), (0, source_1.str)(`</${ tag }>`), false, ([as, bs, cs], rest, context) => [
6057
+ [elem(tag, as, (0, dom_1.defrag)(bs), cs, context)],
6034
6058
  rest
6035
6059
  ], ([as, bs], rest) => as.length === 1 ? [
6036
6060
  (0, array_1.unshift)(as, bs),
6037
6061
  rest
6038
- ] : global_1.undefined)), ([, tag]) => tag, new cache_1.Cache(1000)))
6062
+ ] : global_1.undefined)), ([, tag]) => tag, new cache_1.Cache(10000)))
6039
6063
  ])))));
6040
6064
  exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]);
6041
6065
  function elem(tag, as, bs, cs, context) {
@@ -6058,9 +6082,9 @@ require = function () {
6058
6082
  }
6059
6083
  break;
6060
6084
  }
6061
- let attrs;
6085
+ const attrs = attributes('html', [], attrspec[tag], as.slice(1, -1));
6062
6086
  switch (true) {
6063
- case 'data-invalid-syntax' in (attrs = attributes('html', [], attrspec[tag], as.slice(1, -1))):
6087
+ case 'data-invalid-syntax' in attrs:
6064
6088
  return invalid('attribute', 'Invalid HTML attribute', as, bs, cs);
6065
6089
  default:
6066
6090
  return (0, dom_1.html)(tag, attrs, bs);
@@ -6091,8 +6115,7 @@ require = function () {
6091
6115
  }
6092
6116
  invalid || (invalid = !!spec && !requiredAttributes(spec).every(name => name in attrs));
6093
6117
  if (invalid) {
6094
- !classes.includes('invalid') && classes.push('invalid');
6095
- attrs['class'] = (0, array_1.join)(classes, ' ');
6118
+ attrs['class'] = (0, array_1.join)(classes.includes('invalid') ? classes : (0, array_1.unshift)(classes, ['invalid']), ' ');
6096
6119
  attrs['data-invalid-syntax'] = syntax;
6097
6120
  attrs['data-invalid-type'] = 'argument';
6098
6121
  attrs['data-invalid-message'] = 'Invalid argument';
@@ -6188,7 +6211,6 @@ require = function () {
6188
6211
  Object.defineProperty(exports, '__esModule', { value: true });
6189
6212
  exports.resolve = exports.option = exports.uri = exports.link = void 0;
6190
6213
  const global_1 = _dereq_('spica/global');
6191
- const alias_1 = _dereq_('spica/alias');
6192
6214
  const parser_1 = _dereq_('../../combinator/data/parser');
6193
6215
  const combinator_1 = _dereq_('../../combinator');
6194
6216
  const inline_1 = _dereq_('../inline');
@@ -6199,7 +6221,7 @@ require = function () {
6199
6221
  const dom_1 = _dereq_('typed-dom/dom');
6200
6222
  const url_1 = _dereq_('spica/url');
6201
6223
  const optspec = { rel: ['nofollow'] };
6202
- (0, alias_1.ObjectSetPrototypeOf)(optspec, null);
6224
+ Object.setPrototypeOf(optspec, null);
6203
6225
  exports.link = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)([
6204
6226
  '[',
6205
6227
  '{'
@@ -6279,7 +6301,7 @@ require = function () {
6279
6301
  }
6280
6302
  return (0, dom_1.html)('a', {
6281
6303
  href: uri.source,
6282
- target: undefined || uri.origin !== origin || typeof content[0] === 'object' && content[0].classList.contains('media') ? '_blank' : undefined
6304
+ target: global_1.undefined || uri.origin !== origin || typeof content[0] === 'object' && content[0].classList.contains('media') ? '_blank' : global_1.undefined
6283
6305
  }, content.length === 0 ? decode(INSECURE_URI) : content);
6284
6306
  case 'tel:':
6285
6307
  if (content.length === 0) {
@@ -6319,7 +6341,6 @@ require = function () {
6319
6341
  '../source': 128,
6320
6342
  '../util': 134,
6321
6343
  './html': 111,
6322
- 'spica/alias': 5,
6323
6344
  'spica/global': 13,
6324
6345
  'spica/url': 21,
6325
6346
  'typed-dom/dom': 23
@@ -6404,7 +6425,6 @@ require = function () {
6404
6425
  Object.defineProperty(exports, '__esModule', { value: true });
6405
6426
  exports.media = void 0;
6406
6427
  const global_1 = _dereq_('spica/global');
6407
- const alias_1 = _dereq_('spica/alias');
6408
6428
  const combinator_1 = _dereq_('../../combinator');
6409
6429
  const link_1 = _dereq_('./link');
6410
6430
  const html_1 = _dereq_('./html');
@@ -6419,7 +6439,7 @@ require = function () {
6419
6439
  'aspect-ratio': [],
6420
6440
  rel: global_1.undefined
6421
6441
  };
6422
- (0, alias_1.ObjectSetPrototypeOf)(optspec, null);
6442
+ Object.setPrototypeOf(optspec, null);
6423
6443
  exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.creator)(10, (0, combinator_1.validate)([
6424
6444
  '![',
6425
6445
  '!{'
@@ -6547,7 +6567,6 @@ require = function () {
6547
6567
  './html': 111,
6548
6568
  './htmlentity': 112,
6549
6569
  './link': 114,
6550
- 'spica/alias': 5,
6551
6570
  'spica/array': 6,
6552
6571
  'spica/global': 13,
6553
6572
  'spica/url': 21,
@@ -8034,8 +8053,8 @@ require = function () {
8034
8053
  'use strict';
8035
8054
  Object.defineProperty(exports, '__esModule', { value: true });
8036
8055
  exports.image = void 0;
8037
- const dom_1 = _dereq_('typed-dom/dom');
8038
8056
  const alias_1 = _dereq_('spica/alias');
8057
+ const dom_1 = _dereq_('typed-dom/dom');
8039
8058
  function image(source, url, cache) {
8040
8059
  if (cache === null || cache === void 0 ? void 0 : cache.has(url.href))
8041
8060
  return (0, dom_1.define)(cache.get(url.href).cloneNode(true), (0, alias_1.ObjectFromEntries)([...source.attributes].map(attr => [
@@ -8155,8 +8174,8 @@ require = function () {
8155
8174
  'use strict';
8156
8175
  Object.defineProperty(exports, '__esModule', { value: true });
8157
8176
  exports.video = void 0;
8158
- const dom_1 = _dereq_('typed-dom/dom');
8159
8177
  const alias_1 = _dereq_('spica/alias');
8178
+ const dom_1 = _dereq_('typed-dom/dom');
8160
8179
  const extensions = [
8161
8180
  '.webm',
8162
8181
  '.ogv'
@@ -8187,6 +8206,7 @@ require = function () {
8187
8206
  'use strict';
8188
8207
  Object.defineProperty(exports, '__esModule', { value: true });
8189
8208
  exports.youtube = void 0;
8209
+ const global_1 = _dereq_('spica/global');
8190
8210
  const dom_1 = _dereq_('typed-dom/dom');
8191
8211
  function youtube(source, url) {
8192
8212
  const id = resolve(url);
@@ -8206,15 +8226,18 @@ require = function () {
8206
8226
  var _a;
8207
8227
  switch (url.origin) {
8208
8228
  case 'https://www.youtube.com':
8209
- return url.pathname.match(/^\/watch\/?$/) ? (_a = url.searchParams.get('v')) === null || _a === void 0 ? void 0 : _a.concat(url.search.replace(/([?&])v=[^&#]*&?/g, '$1'), url.hash) : undefined;
8229
+ return url.pathname.match(/^\/watch\/?$/) ? (_a = url.searchParams.get('v')) === null || _a === void 0 ? void 0 : _a.concat(url.search.replace(/([?&])v=[^&#]*&?/g, '$1'), url.hash) : global_1.undefined;
8210
8230
  case 'https://youtu.be':
8211
- return url.pathname.match(/^\/[\w-]+\/?$/) ? url.href.slice(url.origin.length) : undefined;
8231
+ return url.pathname.match(/^\/[\w-]+\/?$/) ? url.href.slice(url.origin.length) : global_1.undefined;
8212
8232
  default:
8213
8233
  return;
8214
8234
  }
8215
8235
  }
8216
8236
  },
8217
- { 'typed-dom/dom': 23 }
8237
+ {
8238
+ 'spica/global': 13,
8239
+ 'typed-dom/dom': 23
8240
+ }
8218
8241
  ],
8219
8242
  146: [
8220
8243
  function (_dereq_, module, exports) {
package/markdown.d.ts CHANGED
@@ -373,7 +373,6 @@ export namespace MarkdownParser {
373
373
  PlaceholderParser,
374
374
  InlineParser.MediaParser,
375
375
  InlineParser.ShortmediaParser,
376
- Parser<HTMLElement, Context, []>,
377
376
  ]>,
378
377
  SourceParser.EmptyLineParser,
379
378
  InlineParser,