securemark 0.229.0 → 0.231.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/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.229.0",
3
+ "version": "0.231.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -349,6 +349,12 @@
349
349
  "to-fast-properties": "^2.0.0"
350
350
  }
351
351
  },
352
+ "@colors/colors": {
353
+ "version": "1.5.0",
354
+ "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
355
+ "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==",
356
+ "dev": true
357
+ },
352
358
  "@gar/promisify": {
353
359
  "version": "1.1.3",
354
360
  "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz",
@@ -503,15 +509,15 @@
503
509
  }
504
510
  },
505
511
  "@npmcli/run-script": {
506
- "version": "2.0.0",
507
- "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-2.0.0.tgz",
508
- "integrity": "sha512-fSan/Pu11xS/TdaTpTB0MRn9guwGU8dye+x56mEVgBEd/QsybBbYcAL0phPXi8SGWFEChkQd6M9qL4y6VOpFig==",
512
+ "version": "3.0.0",
513
+ "resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-3.0.0.tgz",
514
+ "integrity": "sha512-jIdmUepw+kVP2WEE/+XrBIvrSF5miDutdGBrQ8May6uHVAvpAb0m3NRHcJ0lKWbQ1BxsRFsmTrjkdY99qTTVIw==",
509
515
  "dev": true,
510
516
  "requires": {
511
- "@npmcli/node-gyp": "^1.0.2",
517
+ "@npmcli/node-gyp": "^1.0.3",
512
518
  "@npmcli/promise-spawn": "^1.3.2",
513
- "node-gyp": "^8.2.0",
514
- "read-package-json-fast": "^2.0.1"
519
+ "node-gyp": "^8.4.1",
520
+ "read-package-json-fast": "^2.0.3"
515
521
  }
516
522
  },
517
523
  "@sindresorhus/is": {
@@ -606,9 +612,9 @@
606
612
  "dev": true
607
613
  },
608
614
  "@types/node": {
609
- "version": "17.0.19",
610
- "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.19.tgz",
611
- "integrity": "sha512-PfeQhvcMR4cPFVuYfBN4ifG7p9c+Dlh3yUZR6k+5yQK7wX3gDgVxBly4/WkBRs9x4dmcy1TVl08SY67wwtEvmA==",
615
+ "version": "17.0.21",
616
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz",
617
+ "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==",
612
618
  "dev": true
613
619
  },
614
620
  "@types/power-assert": {
@@ -2056,14 +2062,6 @@
2056
2062
  "dev": true,
2057
2063
  "requires": {
2058
2064
  "colors": "1.0.3"
2059
- },
2060
- "dependencies": {
2061
- "colors": {
2062
- "version": "1.0.3",
2063
- "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
2064
- "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=",
2065
- "dev": true
2066
- }
2067
2065
  }
2068
2066
  },
2069
2067
  "cliui": {
@@ -2164,9 +2162,9 @@
2164
2162
  "dev": true
2165
2163
  },
2166
2164
  "colors": {
2167
- "version": "1.4.0",
2168
- "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
2169
- "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
2165
+ "version": "1.0.3",
2166
+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
2167
+ "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=",
2170
2168
  "dev": true
2171
2169
  },
2172
2170
  "combine-source-map": {
@@ -2927,9 +2925,9 @@
2927
2925
  "dev": true
2928
2926
  },
2929
2927
  "electron-to-chromium": {
2930
- "version": "1.4.71",
2931
- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.71.tgz",
2932
- "integrity": "sha512-Hk61vXXKRb2cd3znPE9F+2pLWdIOmP7GjiTj45y6L3W/lO+hSnUSUhq+6lEaERWBdZOHbk2s3YV5c9xVl3boVw==",
2928
+ "version": "1.4.75",
2929
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.75.tgz",
2930
+ "integrity": "sha512-LxgUNeu3BVU7sXaKjUDD9xivocQLxFtq6wgERrutdY/yIOps3ODOZExK1jg8DTEg4U8TUCb5MLGeWFOYuxjF3Q==",
2933
2931
  "dev": true
2934
2932
  },
2935
2933
  "elliptic": {
@@ -3036,9 +3034,9 @@
3036
3034
  }
3037
3035
  },
3038
3036
  "engine.io": {
3039
- "version": "6.1.2",
3040
- "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.1.2.tgz",
3041
- "integrity": "sha512-v/7eGHxPvO2AWsksyx2PUsQvBafuvqs0jJJQ0FdmJG1b9qIvgSbqDRGwNhfk2XHaTTbTXiC4quRE8Q9nRjsrQQ==",
3037
+ "version": "6.1.3",
3038
+ "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.1.3.tgz",
3039
+ "integrity": "sha512-rqs60YwkvWTLLnfazqgZqLa/aKo+9cueVfEi/dZ8PyGyaf8TLOxj++4QMIgeG3Gn0AhrWiFXvghsoY9L9h25GA==",
3042
3040
  "dev": true,
3043
3041
  "requires": {
3044
3042
  "@types/cookie": "^0.4.1",
@@ -3049,7 +3047,7 @@
3049
3047
  "cookie": "~0.4.1",
3050
3048
  "cors": "~2.8.5",
3051
3049
  "debug": "~4.3.1",
3052
- "engine.io-parser": "~5.0.0",
3050
+ "engine.io-parser": "~5.0.3",
3053
3051
  "ws": "~8.2.3"
3054
3052
  },
3055
3053
  "dependencies": {
@@ -4125,9 +4123,9 @@
4125
4123
  }
4126
4124
  },
4127
4125
  "fs-extra": {
4128
- "version": "10.0.0",
4129
- "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz",
4130
- "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==",
4126
+ "version": "10.0.1",
4127
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
4128
+ "integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
4131
4129
  "dev": true,
4132
4130
  "requires": {
4133
4131
  "graceful-fs": "^4.2.0",
@@ -4178,20 +4176,31 @@
4178
4176
  "dev": true
4179
4177
  },
4180
4178
  "gauge": {
4181
- "version": "4.0.1",
4182
- "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.1.tgz",
4183
- "integrity": "sha512-zJ4jePUHR8cceduZ53b6temRalyGpkC2Kc2r3ecNphmL+uWNoJ3YcOcUjpbG6WwoE/Ef6/+aEZz63neI2WIa1Q==",
4179
+ "version": "4.0.2",
4180
+ "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.2.tgz",
4181
+ "integrity": "sha512-aSPRm2CvA9R8QyU5eXMFPd+cYkyxLsXHd2l5/FOH2V/eml//M04G6KZOmTap07O1PvEwNcl2NndyLfK8g3QrKA==",
4184
4182
  "dev": true,
4185
4183
  "requires": {
4186
4184
  "ansi-regex": "^5.0.1",
4187
4185
  "aproba": "^1.0.3 || ^2.0.0",
4188
- "color-support": "^1.1.2",
4189
- "console-control-strings": "^1.0.0",
4186
+ "color-support": "^1.1.3",
4187
+ "console-control-strings": "^1.1.0",
4190
4188
  "has-unicode": "^2.0.1",
4191
- "signal-exit": "^3.0.0",
4189
+ "signal-exit": "^3.0.7",
4192
4190
  "string-width": "^4.2.3",
4193
4191
  "strip-ansi": "^6.0.1",
4194
- "wide-align": "^1.1.2"
4192
+ "wide-align": "^1.1.5"
4193
+ },
4194
+ "dependencies": {
4195
+ "wide-align": {
4196
+ "version": "1.1.5",
4197
+ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
4198
+ "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
4199
+ "dev": true,
4200
+ "requires": {
4201
+ "string-width": "^1.0.2 || 2 || 3 || 4"
4202
+ }
4203
+ }
4195
4204
  }
4196
4205
  },
4197
4206
  "gensync": {
@@ -5039,9 +5048,9 @@
5039
5048
  }
5040
5049
  },
5041
5050
  "has-symbols": {
5042
- "version": "1.0.2",
5043
- "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz",
5044
- "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==",
5051
+ "version": "1.0.3",
5052
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
5053
+ "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
5045
5054
  "dev": true
5046
5055
  },
5047
5056
  "has-tostringtag": {
@@ -6099,15 +6108,15 @@
6099
6108
  "dev": true
6100
6109
  },
6101
6110
  "karma": {
6102
- "version": "6.3.16",
6103
- "resolved": "https://registry.npmjs.org/karma/-/karma-6.3.16.tgz",
6104
- "integrity": "sha512-nEU50jLvDe5yvXqkEJRf8IuvddUkOY2x5Xc4WXHz6dxINgGDrgD2uqQWeVrJs4hbfNaotn+HQ1LZJ4yOXrL7xQ==",
6111
+ "version": "6.3.17",
6112
+ "resolved": "https://registry.npmjs.org/karma/-/karma-6.3.17.tgz",
6113
+ "integrity": "sha512-2TfjHwrRExC8yHoWlPBULyaLwAFmXmxQrcuFImt/JsAsSZu1uOWTZ1ZsWjqQtWpHLiatJOHL5jFjXSJIgCd01g==",
6105
6114
  "dev": true,
6106
6115
  "requires": {
6116
+ "@colors/colors": "1.5.0",
6107
6117
  "body-parser": "^1.19.0",
6108
6118
  "braces": "^3.0.2",
6109
6119
  "chokidar": "^3.5.1",
6110
- "colors": "1.4.0",
6111
6120
  "connect": "^3.7.0",
6112
6121
  "di": "^0.0.1",
6113
6122
  "dom-serialize": "^2.2.1",
@@ -7445,9 +7454,9 @@
7445
7454
  }
7446
7455
  },
7447
7456
  "npm-check-updates": {
7448
- "version": "12.4.0",
7449
- "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-12.4.0.tgz",
7450
- "integrity": "sha512-X14H74M8SVFkStmP1NDOMh0OjLB3mU2dwUeM71zyITJHkm08MASwwTcydW6YuGcNW1RUlVq1cQY2yWijv4zKUQ==",
7457
+ "version": "12.5.0",
7458
+ "resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-12.5.0.tgz",
7459
+ "integrity": "sha512-nrryXO9IZdJsAIXo8LdtllrsGiTDE4IMAod7fl1jd5C38tOdZZG/crNNii4IkctxltQRmK/ziZwsMDTlhszZXg==",
7451
7460
  "dev": true,
7452
7461
  "requires": {
7453
7462
  "chalk": "^4.1.2",
@@ -7519,9 +7528,9 @@
7519
7528
  }
7520
7529
  },
7521
7530
  "minimatch": {
7522
- "version": "5.0.0",
7523
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.0.tgz",
7524
- "integrity": "sha512-EU+GCVjXD00yOUf1TwAHVP7v3fBD3A8RkkPYsWWKGWesxM/572sL53wJQnHxquHlRhYUV36wHkqrN8cdikKc2g==",
7531
+ "version": "5.0.1",
7532
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
7533
+ "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
7525
7534
  "dev": true,
7526
7535
  "requires": {
7527
7536
  "brace-expansion": "^2.0.1"
@@ -7974,15 +7983,15 @@
7974
7983
  }
7975
7984
  },
7976
7985
  "pacote": {
7977
- "version": "13.0.2",
7978
- "resolved": "https://registry.npmjs.org/pacote/-/pacote-13.0.2.tgz",
7979
- "integrity": "sha512-3LyfvDk2BSJNFQZIcDqnLNa7IsYb6KwX3H9uZPwaHJFIX6Gv5N9QHU+s7mEs/RbN4/ta6KUT39LAi2l6EkBi5A==",
7986
+ "version": "13.0.3",
7987
+ "resolved": "https://registry.npmjs.org/pacote/-/pacote-13.0.3.tgz",
7988
+ "integrity": "sha512-8thQ06YoO01O1k5rvSpHS/XPJZucw2DPiiT1jI+ys8QaTN6ifAyxfyoABHBa8nIt/4wPdzly4GEPqshctHFoYA==",
7980
7989
  "dev": true,
7981
7990
  "requires": {
7982
7991
  "@npmcli/git": "^3.0.0",
7983
7992
  "@npmcli/installed-package-contents": "^1.0.7",
7984
7993
  "@npmcli/promise-spawn": "^1.2.0",
7985
- "@npmcli/run-script": "^2.0.0",
7994
+ "@npmcli/run-script": "^3.0.0",
7986
7995
  "cacache": "^15.3.0",
7987
7996
  "chownr": "^2.0.0",
7988
7997
  "fs-minipass": "^2.1.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.229.0",
3
+ "version": "0.231.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",
@@ -13,11 +13,11 @@ describe('Unit: parser/autolink', () => {
13
13
  assert.deepStrictEqual(inspect(parser('@a#b')), [['<a href="/@a?ch=b" class="channel">@a#b</a>'], '']);
14
14
  assert.deepStrictEqual(inspect(parser('\\\n')), [['\\', '<br>'], '']);
15
15
  assert.deepStrictEqual(inspect(parser('a#b')), [['a#b'], '']);
16
- assert.deepStrictEqual(inspect(parser('0a#b')), [['0a#b'], '']);
16
+ assert.deepStrictEqual(inspect(parser('0a#b')), [['0', 'a#b'], '']);
17
17
  assert.deepStrictEqual(inspect(parser('あ#b')), [['あ#b'], '']);
18
- assert.deepStrictEqual(inspect(parser('あい#b')), [['あい#b'], '']);
18
+ assert.deepStrictEqual(inspect(parser('あい#b')), [['あ', 'い#b'], '']);
19
19
  assert.deepStrictEqual(inspect(parser('0aあ#b')), [['0a', 'あ#b'], '']);
20
- assert.deepStrictEqual(inspect(parser('0aあい#b')), [['0a', 'あい#b'], '']);
20
+ assert.deepStrictEqual(inspect(parser('0aあい#b')), [['0a', 'あ', 'い#b'], '']);
21
21
  assert.deepStrictEqual(inspect(parser('a\n#b')), [['a', '<br>', '<a href="/hashtags/b" class="hashtag">#b</a>'], '']);
22
22
  assert.deepStrictEqual(inspect(parser('a\\\n#b')), [['a', '\\', '<br>', '<a href="/hashtags/b" class="hashtag">#b</a>'], '']);
23
23
  });
@@ -30,7 +30,7 @@ export const codeblock: CodeBlockParser = block(validate('```', fmap(
30
30
  translate: 'no',
31
31
  'data-invalid-syntax': 'codeblock',
32
32
  'data-invalid-type': !closer ? 'closer' : 'argument',
33
- 'data-invalid-description': !closer ? `Missing the closing delimiter ${delim}.` : 'Invalid argument.',
33
+ 'data-invalid-description': !closer ? `Missing the closing delimiter "${delim}".` : 'Invalid argument.',
34
34
  }, `${opener}${body}${closer}`)];
35
35
  const file = path.split('/').pop() ?? '';
36
36
  const ext = file && file.includes('.', 1)
@@ -13,7 +13,7 @@ export const aside: ExtensionParser.AsideParser = creator(100, block(validate('~
13
13
  translate: 'no',
14
14
  'data-invalid-syntax': 'aside',
15
15
  'data-invalid-type': !closer ? 'closer' : 'argument',
16
- 'data-invalid-description': !closer ? `Missing the closing delimiter ${delim}.` : 'Invalid argument.',
16
+ 'data-invalid-description': !closer ? `Missing the closing delimiter "${delim}".` : 'Invalid argument.',
17
17
  }, `${opener}${body}${closer}`)];
18
18
  const annotations = html('ol', { class: 'annotations' });
19
19
  const references = html('ol', { class: 'references' });
@@ -16,7 +16,7 @@ export const example: ExtensionParser.ExampleParser = creator(100, block(validat
16
16
  translate: 'no',
17
17
  'data-invalid-syntax': 'example',
18
18
  'data-invalid-type': !closer ? 'closer' : 'argument',
19
- 'data-invalid-description': !closer ? `Missing the closing delimiter ${delim}.` : 'Invalid argument.',
19
+ 'data-invalid-description': !closer ? `Missing the closing delimiter "${delim}".` : 'Invalid argument.',
20
20
  }, `${opener}${body}${closer}`)];
21
21
  switch (type) {
22
22
  case 'markdown': {
@@ -25,7 +25,7 @@ export const message: MessageParser = block(validate('~~~', fmap(
25
25
  translate: 'no',
26
26
  'data-invalid-syntax': 'message',
27
27
  'data-invalid-type': !closer ? 'closer' : 'argument',
28
- 'data-invalid-description': !closer ? `Missing the closing delimiter ${delim}.` : 'Invalid argument.',
28
+ 'data-invalid-description': !closer ? `Missing the closing delimiter "${delim}".` : 'Invalid argument.',
29
29
  }, `${opener}${body}${closer}`)];
30
30
  switch (type) {
31
31
  case 'note':
@@ -18,6 +18,6 @@ export const placeholder: ExtensionParser.PlaceholderParser = block(validate('~~
18
18
  translate: 'no',
19
19
  'data-invalid-syntax': 'extension',
20
20
  'data-invalid-type': !closer ? 'closer' : 'syntax',
21
- 'data-invalid-description': !closer ? `Missing the closing delimiter ${delim}.` : 'Invalid syntax.',
21
+ 'data-invalid-description': !closer ? `Missing the closing delimiter "${delim}".` : 'Invalid syntax.',
22
22
  }, `${opener}${body}${closer}`)
23
23
  ])));
@@ -42,12 +42,9 @@ describe('Unit: parser/block/extension/table', () => {
42
42
  assert.deepStrictEqual(
43
43
  inspect(parser('~~~table\n0\n\n~~~')),
44
44
  [[html('table', [html('thead'), html('tbody', [html('tr', [html('td', '0')])]), html('tfoot')]).outerHTML], '']);
45
- assert.deepStrictEqual(
46
- inspect(parser('~~~table\n#\n~~~')),
47
- [[html('table', [html('thead'), html('tbody', [html('tr', [html('td', '#')])]), html('tfoot'),]).outerHTML], '']);
48
45
  assert.deepStrictEqual(
49
46
  inspect(parser('~~~table\n:\n~~~')),
50
- [[html('table', [html('thead'), html('tbody', [html('tr', [html('td', ':')])]), html('tfoot'),]).outerHTML], '']);
47
+ [[html('table', [html('thead'), html('tbody', [html('tr', [html('td')])]), html('tfoot'),]).outerHTML], '']);
51
48
  assert.deepStrictEqual(
52
49
  inspect(parser('~~~table\n1.1\n~~~')),
53
50
  [[html('table', [
@@ -237,6 +234,9 @@ describe('Unit: parser/block/extension/table', () => {
237
234
  });
238
235
 
239
236
  it('head', () => {
237
+ assert.deepStrictEqual(
238
+ inspect(parser('~~~table\n#\n~~~')),
239
+ [[html('table', [html('thead', [html('tr', [html('th')])]), html('tbody'), html('tfoot'),]).outerHTML], '']);
240
240
  assert.deepStrictEqual(
241
241
  inspect(parser('~~~table\n-\n# 1.1\n~~~')),
242
242
  [[html('table', [
@@ -32,7 +32,7 @@ export const table: TableParser = block(validate('~~~', recover(bind(
32
32
  translate: 'no',
33
33
  'data-invalid-syntax': 'table',
34
34
  'data-invalid-type': !closer ? 'closer' : 'argument',
35
- 'data-invalid-description': !closer ? `Missing the closing delimiter ${delim}.` : 'Invalid argument.',
35
+ 'data-invalid-description': !closer ? `Missing the closing delimiter "${delim}".` : 'Invalid argument.',
36
36
  }, `${opener}${body}${closer}`)], ''];
37
37
  return parser(body, context) ?? [[html('table')], ''];
38
38
  }),
@@ -73,10 +73,10 @@ const align: AlignParser = line(fmap(
73
73
  union([str(alignment)]),
74
74
  ([s]) => s.split('/').map(s => s.split(''))));
75
75
 
76
- const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/;
76
+ const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/;
77
77
 
78
78
  const head: CellParser.HeadParser = creator(block(fmap(open(
79
- str(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/),
79
+ str(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/),
80
80
  rewrite(
81
81
  inits([
82
82
  anyline,
@@ -88,7 +88,7 @@ const head: CellParser.HeadParser = creator(block(fmap(open(
88
88
  false));
89
89
 
90
90
  const data: CellParser.DataParser = creator(block(fmap(open(
91
- str(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=[^\S\n])/),
91
+ str(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/),
92
92
  rewrite(
93
93
  inits([
94
94
  anyline,
@@ -103,7 +103,7 @@ const dataline: CellParser.DatalineParser = creator(line(
103
103
  rewrite(
104
104
  contentline,
105
105
  union([
106
- validate(/^!+[^\S\n]/, convert(source => `:${source}`, data)),
106
+ validate(/^!+\s/, convert(source => `:${source}`, data)),
107
107
  convert(source => `: ${source}`, data),
108
108
  ]))));
109
109
 
@@ -1,14 +1,18 @@
1
1
  import { IListParser } from '../block';
2
- import { union, inits, some, block, line, validate, indent, rewrite, context, creator, open, convert, trim, fallback, lazy, fmap } from '../../combinator';
2
+ import { union, inits, some, block, line, validate, indent, rewrite, context, creator, open, trim, fallback, lazy, fmap } from '../../combinator';
3
3
  import { ulist_, fillFirstLine } from './ulist';
4
4
  import { olist_ } from './olist';
5
5
  import { inline } from '../inline';
6
6
  import { contentline } from '../source';
7
7
  import { html, defrag } from 'typed-dom';
8
8
 
9
- export const ilist: IListParser = lazy(() => block(fmap(validate(
9
+ export const ilist: IListParser = lazy(() => block(validate(
10
10
  /^[-+*](?=[^\S\n]|\n[^\S\n]*\S)/,
11
11
  context({ syntax: { inline: { media: false } } },
12
+ ilist_))));
13
+
14
+ export const ilist_: IListParser = lazy(() => block(fmap(validate(
15
+ /^[-+*](?:$|\s)/,
12
16
  some(creator(union([
13
17
  fmap(fallback(
14
18
  inits([
@@ -17,7 +21,7 @@ export const ilist: IListParser = lazy(() => block(fmap(validate(
17
21
  ]),
18
22
  rewrite(contentline, source => [[html('span', source.replace('\n', ''))], ''])),
19
23
  ns => [html('li', defrag(fillFirstLine(ns)))]),
20
- ]))))),
24
+ ])))),
21
25
  es => [
22
26
  html('ul', {
23
27
  class: 'invalid',
@@ -26,7 +30,3 @@ export const ilist: IListParser = lazy(() => block(fmap(validate(
26
30
  'data-invalid-description': 'Use "-" instead of "+" or "*".',
27
31
  }, es),
28
32
  ])));
29
-
30
- export const ilist_: IListParser = convert(
31
- source => source.replace(/^[-+*](?=$|\n)/, `$& `),
32
- ilist);
@@ -23,6 +23,6 @@ export const mathblock: MathBlockParser = block(validate('$$', fmap(
23
23
  translate: 'no',
24
24
  'data-invalid-syntax': 'mathblock',
25
25
  'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? 'closer' : 'argument',
26
- 'data-invalid-description': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter ${delim}.` : 'Invalid argument.',
26
+ 'data-invalid-description': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${delim}".` : 'Invalid argument.',
27
27
  }, `${opener}${body}${closer}`),
28
28
  ])));
@@ -50,6 +50,7 @@ describe('Unit: parser/block/olist', () => {
50
50
  it('multiple', () => {
51
51
  // pending
52
52
  assert.deepStrictEqual(inspect(parser('0.\n0')), [['<ol><li></li><li></li></ol>'], '']);
53
+ assert.deepStrictEqual(inspect(parser('0.\n0\n')), [['<ol><li></li><li></li></ol>'], '']);
53
54
  assert.deepStrictEqual(inspect(parser('0.\n0.')), [['<ol><li></li><li></li></ol>'], '']);
54
55
  assert.deepStrictEqual(inspect(parser('0.\n0. ')), [['<ol><li></li><li></li></ol>'], '']);
55
56
  assert.deepStrictEqual(inspect(parser('0.\n0.\n')), [['<ol><li></li><li></li></ol>'], '']);
@@ -58,8 +59,11 @@ describe('Unit: parser/block/olist', () => {
58
59
  assert.deepStrictEqual(inspect(parser('0. 1\n0. 2\n0. 3')), [['<ol><li>1</li><li>2</li><li>3</li></ol>'], '']);
59
60
  // pending
60
61
  assert.deepStrictEqual(inspect(parser('(1) \n(')), [['<ol data-format="paren"><li></li><li></li></ol>'], '']);
62
+ assert.deepStrictEqual(inspect(parser('(1) \n(\n')), [['<ol data-format="paren"><li></li><li></li></ol>'], '']);
61
63
  assert.deepStrictEqual(inspect(parser('(1) \n(1')), [['<ol data-format="paren"><li></li><li></li></ol>'], '']);
64
+ assert.deepStrictEqual(inspect(parser('(1) \n(1\n')), [['<ol data-format="paren"><li></li><li></li></ol>'], '']);
62
65
  assert.deepStrictEqual(inspect(parser('(1) \n(1)')), [['<ol data-format="paren"><li></li><li></li></ol>'], '']);
66
+ assert.deepStrictEqual(inspect(parser('(1) \n(1)\n')), [['<ol data-format="paren"><li></li><li></li></ol>'], '']);
63
67
  // filled
64
68
  assert.deepStrictEqual(inspect(parser('(1) \n(1) ')), [['<ol data-format="paren"><li></li><li></li></ol>'], '']);
65
69
  // invalid
@@ -1,6 +1,6 @@
1
1
  import { undefined } from 'spica/global';
2
2
  import { OListParser } from '../block';
3
- import { union, inits, subsequence, some, block, line, indent, focus, rewrite, context, creator, open, match, convert, trim, trimStart, fallback, lazy, fmap } from '../../combinator';
3
+ import { union, inits, subsequence, some, block, line, validate, indent, focus, rewrite, context, creator, open, match, trim, trimStart, fallback, lazy, fmap } from '../../combinator';
4
4
  import { checkbox, ulist_, fillFirstLine } from './ulist';
5
5
  import { ilist_ } from './ilist';
6
6
  import { inline } from '../inline';
@@ -9,51 +9,56 @@ import { html, define, defrag } from 'typed-dom';
9
9
  import { memoize } from 'spica/memoize';
10
10
  import { shift } from 'spica/array';
11
11
 
12
- export const olist: OListParser = lazy(() => block(match(
13
- /^(?=(?:([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*(\.)|\(([0-9]+|[a-z]+)(\))(?:-[0-9]+)*)(?=[^\S\n]|\n[^\S\n]*\S))/,
14
- memoize(
15
- ms => list(type(ms[1] || ms[3]), ms[2] || ms[4]),
16
- ms => type(ms[1] || ms[3]) + (ms[2] || ms[4])))));
12
+ const openers = {
13
+ '.': /^(?:[0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?=$|\s)/,
14
+ '(': /^\((?:[0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?=$|\s)/,
15
+ } as const;
17
16
 
18
- const list = (type: string, delim: string): OListParser => fmap(
17
+ export const olist: OListParser = lazy(() => block(validate(
18
+ [
19
+ /^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/,
20
+ /^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/,
21
+ ],
19
22
  context({ syntax: { inline: { media: false } } },
23
+ olist_))));
24
+
25
+ export const olist_: OListParser = lazy(() => block(union([
26
+ match(
27
+ new RegExp(`^(?=${openers['.'].source.replace('?:', '')})`),
28
+ memoize(ms => list(type(ms[1]), '.'), ms => type(ms[1]))),
29
+ match(
30
+ new RegExp(`^(?=${openers['('].source.replace('?:', '')})`),
31
+ memoize(ms => list(type(ms[1]), '('), ms => type(ms[1]))),
32
+ ])));
33
+
34
+ const list = (type: string, delim: string): OListParser.ListParser => fmap(
20
35
  some(creator(union([
21
36
  fmap(fallback(
22
37
  inits([
23
- line(open(items[delim], trim(subsequence([checkbox, trimStart(some(inline))])), true)),
38
+ line(open(heads[delim], trim(subsequence([checkbox, trimStart(some(inline))])), true)),
24
39
  indent(union([ulist_, olist_, ilist_])),
25
40
  ]),
26
41
  iitem),
27
42
  (ns: [string, ...(HTMLElement | string)[]]) => [html('li', { 'data-marker': ns[0] }, defrag(fillFirstLine(shift(ns)[1])))]),
28
- ])))),
43
+ ]))),
29
44
  es => [format(html('ol', es), type, delim)]);
30
45
 
31
- const items = {
46
+ const heads = {
32
47
  '.': focus(
33
- /^(?:[0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?=$|\s)/,
48
+ openers['.'],
34
49
  (source: string) => [[`${source.split('.', 1)[0]}.`], '']),
35
- ')': focus(
36
- /^\((?:[0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?=$|\s)/,
37
- (source: string) => [[source.trimEnd().replace(/^\($/, '(1)').replace(/^\((\w+)\)?$/, '($1)')], '']),
50
+ '(': focus(
51
+ openers['('],
52
+ (source: string) => [[source.replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')], '']),
38
53
  } as const;
39
54
 
40
- export const olist_: OListParser = convert(
41
- source =>
42
- source[0] !== '('
43
- ? source
44
- .replace(/^((?:[0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*)\.?(?=$|\n)/, `$1. `)
45
- : source
46
- .replace(/^\((?=$|\n)/, `(1) `)
47
- .replace(/^\(((?:[0-9]+|[a-z]+))\)?((?:-(?!-)[0-9]*)*(?=$|\n))/, `($1)$2 `),
48
- olist);
49
-
50
55
  const iitem = rewrite(contentline, source => [[
51
56
  '',
52
57
  html('span', {
53
58
  class: 'invalid',
54
59
  'data-invalid-syntax': 'listitem',
55
60
  'data-invalid-type': 'syntax',
56
- 'data-invalid-description': 'Fix the indent or the head of list items.',
61
+ 'data-invalid-description': 'Fix the indent or the head of the list item.',
57
62
  }, source.replace('\n', ''))
58
63
  ], '']);
59
64
 
@@ -26,7 +26,7 @@ export const quote: ParagraphParser.MentionParser.QuoteParser = lazy(() => creat
26
26
  class: 'quote invalid',
27
27
  'data-invalid-syntax': 'quote',
28
28
  'data-invalid-type': 'syntax',
29
- 'data-invalid-description': `Missing the whitespace after ${ns[0].split(/[^>]/, 1)[0]}.`,
29
+ 'data-invalid-description': `Missing the whitespace after "${ns[0].split(/[^>]/, 1)[0]}".`,
30
30
  },
31
31
  ns),
32
32
  html('br'),
@@ -1,5 +1,5 @@
1
1
  import { UListParser } from '../block';
2
- import { union, inits, subsequence, some, block, line, validate, indent, focus, rewrite, context, creator, open, convert, trim, trimStart, fallback, lazy, fmap } from '../../combinator';
2
+ import { union, inits, subsequence, some, block, line, validate, indent, focus, rewrite, context, creator, open, trim, trimStart, fallback, lazy, fmap } from '../../combinator';
3
3
  import { olist_ } from './olist';
4
4
  import { ilist_ } from './ilist';
5
5
  import { inline } from '../inline';
@@ -7,9 +7,13 @@ import { html, defrag } from 'typed-dom';
7
7
  import { unshift } from 'spica/array';
8
8
  import { contentline } from '../source';
9
9
 
10
- export const ulist: UListParser = lazy(() => block(fmap(validate(
10
+ export const ulist: UListParser = lazy(() => block(validate(
11
11
  /^-(?=[^\S\n]|\n[^\S\n]*\S)/,
12
12
  context({ syntax: { inline: { media: false } } },
13
+ ulist_))));
14
+
15
+ export const ulist_: UListParser = lazy(() => block(fmap(validate(
16
+ /^-(?=$|\s)/,
13
17
  some(creator(union([
14
18
  fmap(fallback(
15
19
  inits([
@@ -18,7 +22,7 @@ export const ulist: UListParser = lazy(() => block(fmap(validate(
18
22
  ]),
19
23
  iitem),
20
24
  ns => [html('li', defrag(fillFirstLine(ns)))]),
21
- ]))))),
25
+ ])))),
22
26
  es => [format(html('ul', es))])));
23
27
 
24
28
  export const checkbox = focus(
@@ -27,16 +31,12 @@ export const checkbox = focus(
27
31
  html('span', { class: 'checkbox' }, source[1].trimStart() ? '☑' : '☐'),
28
32
  ], '']);
29
33
 
30
- export const ulist_: UListParser = convert(
31
- source => source.replace(/^-(?=$|\n)/, `$& `),
32
- ulist);
33
-
34
34
  const iitem = rewrite(contentline, source => [[
35
35
  html('span', {
36
36
  class: 'invalid',
37
37
  'data-invalid-syntax': 'listitem',
38
38
  'data-invalid-type': 'syntax',
39
- 'data-invalid-description': 'Fix the indent or the head of list items.',
39
+ 'data-invalid-description': 'Fix the indent or the head of the list item.',
40
40
  }, source.replace('\n', ''))
41
41
  ], '']);
42
42
 
@@ -11,7 +11,7 @@ export const account: AutolinkParser.AccountParser = lazy(() => fmap(rewrite(
11
11
  '@',
12
12
  tails([
13
13
  verify(
14
- str(/^[0-9A-Za-z](?:[0-9A-Za-z-]{0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:[0-9A-Za-z-]{0,61}[0-9A-Za-z])?)*\//),
14
+ str(/^[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-(?=\w)){0,61}[0-9A-Za-z])?)*\//),
15
15
  ([source]) => source.length <= 253 + 1),
16
16
  verify(
17
17
  str(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/),
@@ -23,6 +23,7 @@ describe('Unit: parser/inline/autolink/email', () => {
23
23
  assert.deepStrictEqual(inspect(parser('a+@b')), undefined);
24
24
  assert.deepStrictEqual(inspect(parser('a..b@c')), undefined);
25
25
  assert.deepStrictEqual(inspect(parser('a++b@c')), undefined);
26
+ assert.deepStrictEqual(inspect(parser(`a@${'b'.repeat(64)}`)), [[`a@${'b'.repeat(64)}`], '']);
26
27
  assert.deepStrictEqual(inspect(parser(' a@b')), undefined);
27
28
  });
28
29
 
@@ -36,7 +37,7 @@ describe('Unit: parser/inline/autolink/email', () => {
36
37
  assert.deepStrictEqual(inspect(parser('a@b_c')), [['<a class="email" href="mailto:a@b">a@b</a>'], '_c']);
37
38
  assert.deepStrictEqual(inspect(parser('a@b-')), [['<a class="email" href="mailto:a@b">a@b</a>'], '-']);
38
39
  assert.deepStrictEqual(inspect(parser('a@b-c')), [['<a class="email" href="mailto:a@b-c">a@b-c</a>'], '']);
39
- assert.deepStrictEqual(inspect(parser('a@b--c')), [['<a class="email" href="mailto:a@b--c">a@b--c</a>'], '']);
40
+ assert.deepStrictEqual(inspect(parser('a@b--c')), [['<a class="email" href="mailto:a@b">a@b</a>'], '--c']);
40
41
  assert.deepStrictEqual(inspect(parser('a@b.')), [['<a class="email" href="mailto:a@b">a@b</a>'], '.']);
41
42
  assert.deepStrictEqual(inspect(parser('a@b.c')), [['<a class="email" href="mailto:a@b.c">a@b.c</a>'], '']);
42
43
  assert.deepStrictEqual(inspect(parser('a@b..c')), [['<a class="email" href="mailto:a@b">a@b</a>'], '..c']);