securemark 0.228.0 → 0.230.1
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 +13 -0
- package/dist/securemark.js +53 -49
- package/markdown.d.ts +17 -13
- package/package-lock.json +59 -48
- package/package.json +1 -1
- package/src/parser/autolink.test.ts +3 -3
- package/src/parser/block/codeblock.ts +1 -1
- package/src/parser/block/extension/aside.ts +1 -1
- package/src/parser/block/extension/example.ts +1 -1
- package/src/parser/block/extension/message.ts +1 -1
- package/src/parser/block/extension/placeholder.ts +1 -1
- package/src/parser/block/extension/table.test.ts +13 -21
- package/src/parser/block/extension/table.ts +8 -12
- package/src/parser/block/ilist.ts +7 -7
- package/src/parser/block/mathblock.ts +1 -1
- package/src/parser/block/olist.test.ts +4 -0
- package/src/parser/block/olist.ts +30 -25
- package/src/parser/block/paragraph/mention/quote.ts +1 -1
- package/src/parser/block/ulist.ts +8 -8
- package/src/parser/inline/autolink.ts +4 -7
- package/src/parser/inline.test.ts +3 -3
- package/src/parser/source/text.ts +3 -3
- package/src/parser/source/unescapable.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.230.1
|
|
4
|
+
|
|
5
|
+
- Refactoring.
|
|
6
|
+
|
|
7
|
+
## 0.230.0
|
|
8
|
+
|
|
9
|
+
- Change table syntax's cell syntax not to depend on trailing whitespace.
|
|
10
|
+
|
|
11
|
+
## 0.229.0
|
|
12
|
+
|
|
13
|
+
- Change table syntax's alignment syntax to remove cell type declaration.
|
|
14
|
+
- Change table syntax's dataline syntax.
|
|
15
|
+
|
|
3
16
|
## 0.228.0
|
|
4
17
|
|
|
5
18
|
- Change table syntax to require horizontal alignment in alignment syntax.
|
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.230.1 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) {
|
|
@@ -4676,7 +4676,7 @@ require = function () {
|
|
|
4676
4676
|
translate: 'no',
|
|
4677
4677
|
'data-invalid-syntax': 'codeblock',
|
|
4678
4678
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
4679
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
4679
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
4680
4680
|
}, `${ opener }${ body }${ closer }`)];
|
|
4681
4681
|
const file = (_a = path.split('/').pop()) !== null && _a !== void 0 ? _a : '';
|
|
4682
4682
|
const ext = file && file.includes('.', 1) ? file.split('.').pop() : '';
|
|
@@ -4814,7 +4814,7 @@ require = function () {
|
|
|
4814
4814
|
translate: 'no',
|
|
4815
4815
|
'data-invalid-syntax': 'aside',
|
|
4816
4816
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
4817
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
4817
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
4818
4818
|
}, `${ opener }${ body }${ closer }`)];
|
|
4819
4819
|
const annotations = (0, typed_dom_1.html)('ol', { class: 'annotations' });
|
|
4820
4820
|
const references = (0, typed_dom_1.html)('ol', { class: 'references' });
|
|
@@ -4869,7 +4869,7 @@ require = function () {
|
|
|
4869
4869
|
translate: 'no',
|
|
4870
4870
|
'data-invalid-syntax': 'example',
|
|
4871
4871
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
4872
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
4872
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
4873
4873
|
}, `${ opener }${ body }${ closer }`)];
|
|
4874
4874
|
switch (type) {
|
|
4875
4875
|
case 'markdown': {
|
|
@@ -5126,7 +5126,7 @@ require = function () {
|
|
|
5126
5126
|
translate: 'no',
|
|
5127
5127
|
'data-invalid-syntax': 'message',
|
|
5128
5128
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
5129
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5129
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
5130
5130
|
}, `${ opener }${ body }${ closer }`)];
|
|
5131
5131
|
switch (type) {
|
|
5132
5132
|
case 'note':
|
|
@@ -5197,7 +5197,7 @@ require = function () {
|
|
|
5197
5197
|
translate: 'no',
|
|
5198
5198
|
'data-invalid-syntax': 'extension',
|
|
5199
5199
|
'data-invalid-type': !closer ? 'closer' : 'syntax',
|
|
5200
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid syntax.'
|
|
5200
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid syntax.'
|
|
5201
5201
|
}, `${ opener }${ body }${ closer }`)])));
|
|
5202
5202
|
},
|
|
5203
5203
|
{
|
|
@@ -5231,7 +5231,7 @@ require = function () {
|
|
|
5231
5231
|
translate: 'no',
|
|
5232
5232
|
'data-invalid-syntax': 'table',
|
|
5233
5233
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
5234
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5234
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
5235
5235
|
}, `${ opener }${ body }${ closer }`)],
|
|
5236
5236
|
''
|
|
5237
5237
|
];
|
|
@@ -5257,24 +5257,23 @@ require = function () {
|
|
|
5257
5257
|
(0, combinator_1.some)((0, combinator_1.union)([
|
|
5258
5258
|
head,
|
|
5259
5259
|
data,
|
|
5260
|
-
|
|
5261
|
-
|
|
5260
|
+
(0, combinator_1.some)(dataline, alignment),
|
|
5261
|
+
source_1.emptyline
|
|
5262
5262
|
]))
|
|
5263
5263
|
]), ns => !(0, alias_1.isArray)(ns[0]) ? (0, array_1.unshift)([[[]]], ns) : ns)));
|
|
5264
|
-
const alignment = /^[
|
|
5264
|
+
const alignment = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
|
|
5265
5265
|
const align = (0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.union)([(0, source_1.str)(alignment)]), ([s]) => s.split('/').map(s => s.split(''))));
|
|
5266
|
-
const delimiter = /^[
|
|
5267
|
-
const head = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(
|
|
5266
|
+
const delimiter = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)|^[#:](?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/;
|
|
5267
|
+
const head = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^#(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([
|
|
5268
5268
|
source_1.anyline,
|
|
5269
5269
|
(0, combinator_1.some)(source_1.contentline, delimiter)
|
|
5270
5270
|
]), (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)('th', attributes(ns.shift()), (0, typed_dom_1.defrag)(ns))]), false));
|
|
5271
|
-
const data = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(
|
|
5271
|
+
const data = (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.open)((0, source_1.str)(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/), (0, combinator_1.rewrite)((0, combinator_1.inits)([
|
|
5272
5272
|
source_1.anyline,
|
|
5273
5273
|
(0, combinator_1.some)(source_1.contentline, delimiter)
|
|
5274
5274
|
]), (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)('td', attributes(ns.shift()), (0, typed_dom_1.defrag)(ns))]), false));
|
|
5275
5275
|
const dataline = (0, combinator_1.creator)((0, combinator_1.line)((0, combinator_1.rewrite)(source_1.contentline, (0, combinator_1.union)([
|
|
5276
|
-
(0, combinator_1.validate)(
|
|
5277
|
-
(0, combinator_1.validate)(/^!+[^\S\n]/, (0, combinator_1.convert)(source => `:${ source }`, data)),
|
|
5276
|
+
(0, combinator_1.validate)(/^!+\s/, (0, combinator_1.convert)(source => `:${ source }`, data)),
|
|
5278
5277
|
(0, combinator_1.convert)(source => `: ${ source }`, data)
|
|
5279
5278
|
]))));
|
|
5280
5279
|
function attributes(source) {
|
|
@@ -5310,10 +5309,7 @@ require = function () {
|
|
|
5310
5309
|
ROW:
|
|
5311
5310
|
for (let i = 0; i < rows.length; ++i) {
|
|
5312
5311
|
const [[[...as], [...vs] = []], ...cells] = rows[i];
|
|
5313
|
-
let isBody = target === tfoot ? false :
|
|
5314
|
-
as[0] === '#' ? !as.shift() : global_1.undefined,
|
|
5315
|
-
as[0] === ':' ? !!as.shift() : global_1.undefined
|
|
5316
|
-
].reduce((a, b) => a !== null && a !== void 0 ? a : b);
|
|
5312
|
+
let isBody = target === tfoot ? false : global_1.undefined;
|
|
5317
5313
|
as.length === 0 && as.push('-');
|
|
5318
5314
|
ALIGN_H:
|
|
5319
5315
|
for (let j = 0, update = false; j < as.length || j < aligns.length; ++j) {
|
|
@@ -5559,7 +5555,8 @@ require = function () {
|
|
|
5559
5555
|
const inline_1 = _dereq_('../inline');
|
|
5560
5556
|
const source_1 = _dereq_('../source');
|
|
5561
5557
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5562
|
-
exports.ilist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.
|
|
5558
|
+
exports.ilist = (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.ilist_))));
|
|
5559
|
+
exports.ilist_ = (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)([
|
|
5563
5560
|
(0, combinator_1.line)((0, combinator_1.open)(/^[-+*](?:$|\s)/, (0, combinator_1.trim)((0, combinator_1.some)(inline_1.inline)), true)),
|
|
5564
5561
|
(0, combinator_1.indent)((0, combinator_1.union)([
|
|
5565
5562
|
ulist_1.ulist_,
|
|
@@ -5569,13 +5566,12 @@ require = function () {
|
|
|
5569
5566
|
]), (0, combinator_1.rewrite)(source_1.contentline, source => [
|
|
5570
5567
|
[(0, typed_dom_1.html)('span', source.replace('\n', ''))],
|
|
5571
5568
|
''
|
|
5572
|
-
])), ns => [(0, typed_dom_1.html)('li', (0, typed_dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))])]))))
|
|
5569
|
+
])), ns => [(0, typed_dom_1.html)('li', (0, typed_dom_1.defrag)((0, ulist_1.fillFirstLine)(ns)))])])))), es => [(0, typed_dom_1.html)('ul', {
|
|
5573
5570
|
class: 'invalid',
|
|
5574
5571
|
'data-invalid-syntax': 'list',
|
|
5575
5572
|
'data-invalid-type': 'syntax',
|
|
5576
5573
|
'data-invalid-description': 'Use "-" instead of "+" or "*".'
|
|
5577
5574
|
}, es)])));
|
|
5578
|
-
exports.ilist_ = (0, combinator_1.convert)(source => source.replace(/^[-+*](?=$|\n)/, `$& `), exports.ilist);
|
|
5579
5575
|
},
|
|
5580
5576
|
{
|
|
5581
5577
|
'../../combinator': 27,
|
|
@@ -5611,7 +5607,7 @@ require = function () {
|
|
|
5611
5607
|
translate: 'no',
|
|
5612
5608
|
'data-invalid-syntax': 'mathblock',
|
|
5613
5609
|
'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? 'closer' : 'argument',
|
|
5614
|
-
'data-invalid-description': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5610
|
+
'data-invalid-description': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
5615
5611
|
}, `${ opener }${ body }${ closer }`)];
|
|
5616
5612
|
})));
|
|
5617
5613
|
},
|
|
@@ -5635,9 +5631,20 @@ require = function () {
|
|
|
5635
5631
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5636
5632
|
const memoize_1 = _dereq_('spica/memoize');
|
|
5637
5633
|
const array_1 = _dereq_('spica/array');
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5634
|
+
const openers = {
|
|
5635
|
+
'.': /^(?:[0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*(?![^\S\n])\.?(?=$|\s)/,
|
|
5636
|
+
'(': /^\((?:[0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?=$|\s)/
|
|
5637
|
+
};
|
|
5638
|
+
exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)([
|
|
5639
|
+
/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/,
|
|
5640
|
+
/^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/
|
|
5641
|
+
], (0, combinator_1.context)({ syntax: { inline: { media: false } } }, exports.olist_))));
|
|
5642
|
+
exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([
|
|
5643
|
+
(0, combinator_1.match)(new RegExp(`^(?=${ openers['.'].source.replace('?:', '') })`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]))),
|
|
5644
|
+
(0, combinator_1.match)(new RegExp(`^(?=${ openers['('].source.replace('?:', '') })`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1])))
|
|
5645
|
+
])));
|
|
5646
|
+
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)([
|
|
5647
|
+
(0, combinator_1.line)((0, combinator_1.open)(heads[delim], (0, combinator_1.trim)((0, combinator_1.subsequence)([
|
|
5641
5648
|
ulist_1.checkbox,
|
|
5642
5649
|
(0, combinator_1.trimStart)((0, combinator_1.some)(inline_1.inline))
|
|
5643
5650
|
])), true)),
|
|
@@ -5646,18 +5653,17 @@ require = function () {
|
|
|
5646
5653
|
exports.olist_,
|
|
5647
5654
|
ilist_1.ilist_
|
|
5648
5655
|
]))
|
|
5649
|
-
]), 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])))])])))
|
|
5650
|
-
const
|
|
5651
|
-
'.': (0, combinator_1.focus)(
|
|
5656
|
+
]), 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)]);
|
|
5657
|
+
const heads = {
|
|
5658
|
+
'.': (0, combinator_1.focus)(openers['.'], source => [
|
|
5652
5659
|
[`${ source.split('.', 1)[0] }.`],
|
|
5653
5660
|
''
|
|
5654
5661
|
]),
|
|
5655
|
-
'
|
|
5656
|
-
[source.
|
|
5662
|
+
'(': (0, combinator_1.focus)(openers['('], source => [
|
|
5663
|
+
[source.replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')],
|
|
5657
5664
|
''
|
|
5658
5665
|
])
|
|
5659
5666
|
};
|
|
5660
|
-
exports.olist_ = (0, combinator_1.convert)(source => source[0] !== '(' ? source.replace(/^((?:[0-9]+|[a-z]+|[A-Z]+)(?:-(?!-)[0-9]*)*)\.?(?=$|\n)/, `$1. `) : source.replace(/^\((?=$|\n)/, `(1) `).replace(/^\(((?:[0-9]+|[a-z]+))\)?((?:-(?!-)[0-9]*)*(?=$|\n))/, `($1)$2 `), exports.olist);
|
|
5661
5667
|
const iitem = (0, combinator_1.rewrite)(source_1.contentline, source => [
|
|
5662
5668
|
[
|
|
5663
5669
|
'',
|
|
@@ -5665,7 +5671,7 @@ require = function () {
|
|
|
5665
5671
|
class: 'invalid',
|
|
5666
5672
|
'data-invalid-syntax': 'listitem',
|
|
5667
5673
|
'data-invalid-type': 'syntax',
|
|
5668
|
-
'data-invalid-description': 'Fix the indent or the head of list
|
|
5674
|
+
'data-invalid-description': 'Fix the indent or the head of the list item.'
|
|
5669
5675
|
}, source.replace('\n', ''))
|
|
5670
5676
|
],
|
|
5671
5677
|
''
|
|
@@ -5848,7 +5854,7 @@ require = function () {
|
|
|
5848
5854
|
class: 'quote invalid',
|
|
5849
5855
|
'data-invalid-syntax': 'quote',
|
|
5850
5856
|
'data-invalid-type': 'syntax',
|
|
5851
|
-
'data-invalid-description': `Missing the whitespace after ${ ns[0].split(/[^>]/, 1)[0] }.`
|
|
5857
|
+
'data-invalid-description': `Missing the whitespace after "${ ns[0].split(/[^>]/, 1)[0] }".`
|
|
5852
5858
|
}, ns),
|
|
5853
5859
|
(0, typed_dom_1.html)('br')
|
|
5854
5860
|
]), false)));
|
|
@@ -5974,7 +5980,7 @@ require = function () {
|
|
|
5974
5980
|
function (_dereq_, module, exports) {
|
|
5975
5981
|
'use strict';
|
|
5976
5982
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5977
|
-
exports.fillFirstLine = exports.
|
|
5983
|
+
exports.fillFirstLine = exports.checkbox = exports.ulist_ = exports.ulist = void 0;
|
|
5978
5984
|
const combinator_1 = _dereq_('../../combinator');
|
|
5979
5985
|
const olist_1 = _dereq_('./olist');
|
|
5980
5986
|
const ilist_1 = _dereq_('./ilist');
|
|
@@ -5982,7 +5988,8 @@ require = function () {
|
|
|
5982
5988
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5983
5989
|
const array_1 = _dereq_('spica/array');
|
|
5984
5990
|
const source_1 = _dereq_('../source');
|
|
5985
|
-
exports.ulist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.
|
|
5991
|
+
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_))));
|
|
5992
|
+
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)([
|
|
5986
5993
|
(0, combinator_1.line)((0, combinator_1.open)(/^-(?:$|\s)/, (0, combinator_1.trim)((0, combinator_1.subsequence)([
|
|
5987
5994
|
exports.checkbox,
|
|
5988
5995
|
(0, combinator_1.trimStart)((0, combinator_1.some)(inline_1.inline))
|
|
@@ -5992,18 +5999,17 @@ require = function () {
|
|
|
5992
5999
|
olist_1.olist_,
|
|
5993
6000
|
ilist_1.ilist_
|
|
5994
6001
|
]))
|
|
5995
|
-
]), iitem), ns => [(0, typed_dom_1.html)('li', (0, typed_dom_1.defrag)(fillFirstLine(ns)))])]))))
|
|
6002
|
+
]), iitem), ns => [(0, typed_dom_1.html)('li', (0, typed_dom_1.defrag)(fillFirstLine(ns)))])])))), es => [format((0, typed_dom_1.html)('ul', es))])));
|
|
5996
6003
|
exports.checkbox = (0, combinator_1.focus)(/^\[[xX ]\](?=$|\s)/, source => [
|
|
5997
6004
|
[(0, typed_dom_1.html)('span', { class: 'checkbox' }, source[1].trimStart() ? '\u2611' : '\u2610')],
|
|
5998
6005
|
''
|
|
5999
6006
|
]);
|
|
6000
|
-
exports.ulist_ = (0, combinator_1.convert)(source => source.replace(/^-(?=$|\n)/, `$& `), exports.ulist);
|
|
6001
6007
|
const iitem = (0, combinator_1.rewrite)(source_1.contentline, source => [
|
|
6002
6008
|
[(0, typed_dom_1.html)('span', {
|
|
6003
6009
|
class: 'invalid',
|
|
6004
6010
|
'data-invalid-syntax': 'listitem',
|
|
6005
6011
|
'data-invalid-type': 'syntax',
|
|
6006
|
-
'data-invalid-description': 'Fix the indent or the head of list
|
|
6012
|
+
'data-invalid-description': 'Fix the indent or the head of the list item.'
|
|
6007
6013
|
}, source.replace('\n', ''))],
|
|
6008
6014
|
''
|
|
6009
6015
|
]);
|
|
@@ -6241,22 +6247,20 @@ require = function () {
|
|
|
6241
6247
|
const anchor_1 = _dereq_('./autolink/anchor');
|
|
6242
6248
|
const source_1 = _dereq_('../source');
|
|
6243
6249
|
const util_1 = _dereq_('../util');
|
|
6244
|
-
exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]
|
|
6250
|
+
exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S#)/, (0, combinator_1.guard)(context => {
|
|
6245
6251
|
var _a, _b, _c;
|
|
6246
6252
|
return (_c = (_b = (_a = context.syntax) === null || _a === void 0 ? void 0 : _a.inline) === null || _b === void 0 ? void 0 : _b.autolink) !== null && _c !== void 0 ? _c : true;
|
|
6247
6253
|
}, (0, combinator_1.some)((0, combinator_1.union)([
|
|
6248
6254
|
url_1.url,
|
|
6249
6255
|
email_1.email,
|
|
6250
6256
|
(0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*(?:@(?:[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)+/),
|
|
6251
|
-
(0, source_1.str)(/^@+(?![0-9A-Za-z]|[^\x00-\x7F\s])/),
|
|
6252
|
-
(0, source_1.str)(/^#+(?![0-9A-Za-z'_]|[^\x00-\x7F\s])/),
|
|
6253
6257
|
channel_1.channel,
|
|
6254
6258
|
account_1.account,
|
|
6255
|
-
(0, source_1.str)(
|
|
6256
|
-
(0, source_1.str)(/^[0-9A-Za-z]
|
|
6259
|
+
(0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/),
|
|
6260
|
+
(0, source_1.str)(/^(?:[0-9A-Za-z]|[^\x00-\x7F\s])(?=#)/u),
|
|
6257
6261
|
hashtag_1.hashtag,
|
|
6258
6262
|
hashnum_1.hashnum,
|
|
6259
|
-
(0, source_1.str)(
|
|
6263
|
+
(0, source_1.str)(/^#+(?:[0-9A-Za-z'_]|[^\x00-\x7F\s])*/),
|
|
6260
6264
|
anchor_1.anchor
|
|
6261
6265
|
])))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
|
|
6262
6266
|
},
|
|
@@ -8463,9 +8467,9 @@ require = function () {
|
|
|
8463
8467
|
const combinator_1 = _dereq_('../../combinator');
|
|
8464
8468
|
const str_1 = _dereq_('./str');
|
|
8465
8469
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
8466
|
-
exports.separator = /[\s\x00-\x7F]
|
|
8470
|
+
exports.separator = /[\s\x00-\x7F]|\S#|[、。!?][^\S\n]*(?=\\\n)/;
|
|
8467
8471
|
exports.nonWhitespace = /[\S\n]|$/;
|
|
8468
|
-
exports.nonAlphanumeric = /[^0-9A-Za-z]
|
|
8472
|
+
exports.nonAlphanumeric = /[^0-9A-Za-z]|\S#|$/;
|
|
8469
8473
|
const repeat = (0, str_1.str)(/^(.)\1*/);
|
|
8470
8474
|
exports.text = (0, combinator_1.creator)((source, context) => {
|
|
8471
8475
|
if (source === '')
|
|
@@ -8539,7 +8543,7 @@ require = function () {
|
|
|
8539
8543
|
];
|
|
8540
8544
|
default:
|
|
8541
8545
|
const b = source[0].trimStart() === '';
|
|
8542
|
-
const i = b || isAlphanumeric(source[0]) ? source.search(b ? exports.nonWhitespace : exports.nonAlphanumeric) : 1;
|
|
8546
|
+
const i = b || isAlphanumeric(source[0]) ? source.search(b ? exports.nonWhitespace : exports.nonAlphanumeric) || 1 : 1;
|
|
8543
8547
|
return b && i === source.length || b && source[i] === '\n' || b && source[i] === '\\' && source[i + 1] === '\n' ? [
|
|
8544
8548
|
[],
|
|
8545
8549
|
source.slice(i)
|
|
@@ -8590,7 +8594,7 @@ require = function () {
|
|
|
8590
8594
|
];
|
|
8591
8595
|
case 0: {
|
|
8592
8596
|
const b = source[0] !== '\n' && source[0].trimStart() === '';
|
|
8593
|
-
const i = b || (0, text_1.isAlphanumeric)(source[0]) ? source.search(b ? text_1.nonWhitespace : text_1.nonAlphanumeric) : 1;
|
|
8597
|
+
const i = b || (0, text_1.isAlphanumeric)(source[0]) ? source.search(b ? text_1.nonWhitespace : text_1.nonAlphanumeric) || 1 : 1;
|
|
8594
8598
|
return [
|
|
8595
8599
|
[source.slice(0, i)],
|
|
8596
8600
|
source.slice(i)
|
package/markdown.d.ts
CHANGED
|
@@ -123,12 +123,12 @@ export namespace MarkdownParser {
|
|
|
123
123
|
// - item
|
|
124
124
|
Block<'ulist'>,
|
|
125
125
|
Parser<HTMLUListElement, Context, [
|
|
126
|
-
UListParser.
|
|
126
|
+
UListParser.ItemParser,
|
|
127
127
|
]> {
|
|
128
128
|
}
|
|
129
129
|
export namespace UListParser {
|
|
130
|
-
export interface
|
|
131
|
-
Block<'ulist/
|
|
130
|
+
export interface ItemParser extends
|
|
131
|
+
Block<'ulist/item'>,
|
|
132
132
|
Parser<HTMLLIElement, Context, [
|
|
133
133
|
Parser<HTMLElement | string, Context, [
|
|
134
134
|
InlineParser,
|
|
@@ -148,12 +148,19 @@ export namespace MarkdownParser {
|
|
|
148
148
|
// (a)-1 item
|
|
149
149
|
Block<'olist'>,
|
|
150
150
|
Parser<HTMLOListElement, Context, [
|
|
151
|
-
OListParser.
|
|
151
|
+
OListParser.ListParser,
|
|
152
|
+
OListParser.ListParser,
|
|
152
153
|
]> {
|
|
153
154
|
}
|
|
154
155
|
export namespace OListParser {
|
|
155
|
-
export interface
|
|
156
|
-
Block<'olist/
|
|
156
|
+
export interface ListParser extends
|
|
157
|
+
Block<'olist/list'>,
|
|
158
|
+
Parser<HTMLOListElement, Context, [
|
|
159
|
+
OListParser.ItemParser,
|
|
160
|
+
]> {
|
|
161
|
+
}
|
|
162
|
+
export interface ItemParser extends
|
|
163
|
+
Block<'olist/item'>,
|
|
157
164
|
Parser<HTMLLIElement, Context, [
|
|
158
165
|
Parser<HTMLElement | string, Context, [
|
|
159
166
|
InlineParser,
|
|
@@ -172,12 +179,12 @@ export namespace MarkdownParser {
|
|
|
172
179
|
// * item
|
|
173
180
|
Block<'ilist'>,
|
|
174
181
|
Parser<HTMLUListElement, Context, [
|
|
175
|
-
IListParser.
|
|
182
|
+
IListParser.ItemParser,
|
|
176
183
|
]> {
|
|
177
184
|
}
|
|
178
185
|
export namespace IListParser {
|
|
179
|
-
export interface
|
|
180
|
-
Block<'ilist/
|
|
186
|
+
export interface ItemParser extends
|
|
187
|
+
Block<'ilist/item'>,
|
|
181
188
|
Parser<HTMLLIElement, Context, [
|
|
182
189
|
InlineParser,
|
|
183
190
|
Parser<HTMLUListElement | HTMLOListElement, Context, [
|
|
@@ -455,8 +462,8 @@ export namespace MarkdownParser {
|
|
|
455
462
|
Parser<HTMLTableCellElement, Context, [
|
|
456
463
|
CellParser.HeadParser,
|
|
457
464
|
CellParser.DataParser,
|
|
458
|
-
SourceParser.EmptyLineParser,
|
|
459
465
|
CellParser.DatalineParser,
|
|
466
|
+
SourceParser.EmptyLineParser,
|
|
460
467
|
]>,
|
|
461
468
|
]> {
|
|
462
469
|
}
|
|
@@ -484,7 +491,6 @@ export namespace MarkdownParser {
|
|
|
484
491
|
Parser<HTMLTableCellElement, Context, [
|
|
485
492
|
DataParser,
|
|
486
493
|
DataParser,
|
|
487
|
-
DataParser,
|
|
488
494
|
]> {
|
|
489
495
|
}
|
|
490
496
|
}
|
|
@@ -1044,8 +1050,6 @@ export namespace MarkdownParser {
|
|
|
1044
1050
|
AutolinkParser.UrlParser,
|
|
1045
1051
|
AutolinkParser.EmailParser,
|
|
1046
1052
|
SourceParser.StrParser,
|
|
1047
|
-
SourceParser.StrParser,
|
|
1048
|
-
SourceParser.StrParser,
|
|
1049
1053
|
AutolinkParser.ChannelParser,
|
|
1050
1054
|
AutolinkParser.AccountParser,
|
|
1051
1055
|
SourceParser.StrParser,
|
package/package-lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.230.1",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -168,9 +168,9 @@
|
|
|
168
168
|
}
|
|
169
169
|
},
|
|
170
170
|
"@babel/helper-module-transforms": {
|
|
171
|
-
"version": "7.
|
|
172
|
-
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.
|
|
173
|
-
"integrity": "sha512-
|
|
171
|
+
"version": "7.17.6",
|
|
172
|
+
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.17.6.tgz",
|
|
173
|
+
"integrity": "sha512-2ULmRdqoOMpdvkbT8jONrZML/XALfzxlb052bldftkicAUy8AxSCkD5trDPQcwHNmolcl7wP6ehNqMlyUw6AaA==",
|
|
174
174
|
"dev": true,
|
|
175
175
|
"requires": {
|
|
176
176
|
"@babel/helper-environment-visitor": "^7.16.7",
|
|
@@ -179,8 +179,8 @@
|
|
|
179
179
|
"@babel/helper-split-export-declaration": "^7.16.7",
|
|
180
180
|
"@babel/helper-validator-identifier": "^7.16.7",
|
|
181
181
|
"@babel/template": "^7.16.7",
|
|
182
|
-
"@babel/traverse": "^7.
|
|
183
|
-
"@babel/types": "^7.
|
|
182
|
+
"@babel/traverse": "^7.17.3",
|
|
183
|
+
"@babel/types": "^7.17.0"
|
|
184
184
|
}
|
|
185
185
|
},
|
|
186
186
|
"@babel/helper-simple-access": {
|
|
@@ -437,9 +437,9 @@
|
|
|
437
437
|
},
|
|
438
438
|
"dependencies": {
|
|
439
439
|
"lru-cache": {
|
|
440
|
-
"version": "7.
|
|
441
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.
|
|
442
|
-
"integrity": "sha512-
|
|
440
|
+
"version": "7.4.0",
|
|
441
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.4.0.tgz",
|
|
442
|
+
"integrity": "sha512-YOfuyWa/Ee+PXbDm40j9WXyJrzQUynVbgn4Km643UYcWNcrSfRkKL0WaiUcxcIbkXcVTgNpDqSnPXntWXT75cw==",
|
|
443
443
|
"dev": true
|
|
444
444
|
},
|
|
445
445
|
"mkdirp": {
|
|
@@ -503,15 +503,15 @@
|
|
|
503
503
|
}
|
|
504
504
|
},
|
|
505
505
|
"@npmcli/run-script": {
|
|
506
|
-
"version": "
|
|
507
|
-
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-
|
|
508
|
-
"integrity": "sha512-
|
|
506
|
+
"version": "3.0.0",
|
|
507
|
+
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-3.0.0.tgz",
|
|
508
|
+
"integrity": "sha512-jIdmUepw+kVP2WEE/+XrBIvrSF5miDutdGBrQ8May6uHVAvpAb0m3NRHcJ0lKWbQ1BxsRFsmTrjkdY99qTTVIw==",
|
|
509
509
|
"dev": true,
|
|
510
510
|
"requires": {
|
|
511
|
-
"@npmcli/node-gyp": "^1.0.
|
|
511
|
+
"@npmcli/node-gyp": "^1.0.3",
|
|
512
512
|
"@npmcli/promise-spawn": "^1.3.2",
|
|
513
|
-
"node-gyp": "^8.
|
|
514
|
-
"read-package-json-fast": "^2.0.
|
|
513
|
+
"node-gyp": "^8.4.1",
|
|
514
|
+
"read-package-json-fast": "^2.0.3"
|
|
515
515
|
}
|
|
516
516
|
},
|
|
517
517
|
"@sindresorhus/is": {
|
|
@@ -606,9 +606,9 @@
|
|
|
606
606
|
"dev": true
|
|
607
607
|
},
|
|
608
608
|
"@types/node": {
|
|
609
|
-
"version": "17.0.
|
|
610
|
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.
|
|
611
|
-
"integrity": "sha512-
|
|
609
|
+
"version": "17.0.21",
|
|
610
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz",
|
|
611
|
+
"integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==",
|
|
612
612
|
"dev": true
|
|
613
613
|
},
|
|
614
614
|
"@types/power-assert": {
|
|
@@ -752,9 +752,9 @@
|
|
|
752
752
|
}
|
|
753
753
|
},
|
|
754
754
|
"agentkeepalive": {
|
|
755
|
-
"version": "4.2.
|
|
756
|
-
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.
|
|
757
|
-
"integrity": "sha512-
|
|
755
|
+
"version": "4.2.1",
|
|
756
|
+
"resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.2.1.tgz",
|
|
757
|
+
"integrity": "sha512-Zn4cw2NEqd+9fiSVWMscnjyQ1a8Yfoc5oBajLeo5w+YBHgDUcEBY2hS4YpTz6iN5f/2zQiktcuM6tS8x1p9dpA==",
|
|
758
758
|
"dev": true,
|
|
759
759
|
"requires": {
|
|
760
760
|
"debug": "^4.1.0",
|
|
@@ -2927,9 +2927,9 @@
|
|
|
2927
2927
|
"dev": true
|
|
2928
2928
|
},
|
|
2929
2929
|
"electron-to-chromium": {
|
|
2930
|
-
"version": "1.4.
|
|
2931
|
-
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.
|
|
2932
|
-
"integrity": "sha512-
|
|
2930
|
+
"version": "1.4.73",
|
|
2931
|
+
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.73.tgz",
|
|
2932
|
+
"integrity": "sha512-RlCffXkE/LliqfA5m29+dVDPB2r72y2D2egMMfIy3Le8ODrxjuZNVo4NIC2yPL01N4xb4nZQLwzi6Z5tGIGLnA==",
|
|
2933
2933
|
"dev": true
|
|
2934
2934
|
},
|
|
2935
2935
|
"elliptic": {
|
|
@@ -3036,9 +3036,9 @@
|
|
|
3036
3036
|
}
|
|
3037
3037
|
},
|
|
3038
3038
|
"engine.io": {
|
|
3039
|
-
"version": "6.1.
|
|
3040
|
-
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.1.
|
|
3041
|
-
"integrity": "sha512-
|
|
3039
|
+
"version": "6.1.3",
|
|
3040
|
+
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.1.3.tgz",
|
|
3041
|
+
"integrity": "sha512-rqs60YwkvWTLLnfazqgZqLa/aKo+9cueVfEi/dZ8PyGyaf8TLOxj++4QMIgeG3Gn0AhrWiFXvghsoY9L9h25GA==",
|
|
3042
3042
|
"dev": true,
|
|
3043
3043
|
"requires": {
|
|
3044
3044
|
"@types/cookie": "^0.4.1",
|
|
@@ -3049,7 +3049,7 @@
|
|
|
3049
3049
|
"cookie": "~0.4.1",
|
|
3050
3050
|
"cors": "~2.8.5",
|
|
3051
3051
|
"debug": "~4.3.1",
|
|
3052
|
-
"engine.io-parser": "~5.0.
|
|
3052
|
+
"engine.io-parser": "~5.0.3",
|
|
3053
3053
|
"ws": "~8.2.3"
|
|
3054
3054
|
},
|
|
3055
3055
|
"dependencies": {
|
|
@@ -4125,9 +4125,9 @@
|
|
|
4125
4125
|
}
|
|
4126
4126
|
},
|
|
4127
4127
|
"fs-extra": {
|
|
4128
|
-
"version": "10.0.
|
|
4129
|
-
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.
|
|
4130
|
-
"integrity": "sha512-
|
|
4128
|
+
"version": "10.0.1",
|
|
4129
|
+
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.1.tgz",
|
|
4130
|
+
"integrity": "sha512-NbdoVMZso2Lsrn/QwLXOy6rm0ufY2zEOKCDzJR/0kBsb0E6qed0P3iYK+Ath3BfvXEeu4JhEtXLgILx5psUfag==",
|
|
4131
4131
|
"dev": true,
|
|
4132
4132
|
"requires": {
|
|
4133
4133
|
"graceful-fs": "^4.2.0",
|
|
@@ -4178,20 +4178,31 @@
|
|
|
4178
4178
|
"dev": true
|
|
4179
4179
|
},
|
|
4180
4180
|
"gauge": {
|
|
4181
|
-
"version": "4.0.
|
|
4182
|
-
"resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.
|
|
4183
|
-
"integrity": "sha512-
|
|
4181
|
+
"version": "4.0.2",
|
|
4182
|
+
"resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.2.tgz",
|
|
4183
|
+
"integrity": "sha512-aSPRm2CvA9R8QyU5eXMFPd+cYkyxLsXHd2l5/FOH2V/eml//M04G6KZOmTap07O1PvEwNcl2NndyLfK8g3QrKA==",
|
|
4184
4184
|
"dev": true,
|
|
4185
4185
|
"requires": {
|
|
4186
4186
|
"ansi-regex": "^5.0.1",
|
|
4187
4187
|
"aproba": "^1.0.3 || ^2.0.0",
|
|
4188
|
-
"color-support": "^1.1.
|
|
4189
|
-
"console-control-strings": "^1.
|
|
4188
|
+
"color-support": "^1.1.3",
|
|
4189
|
+
"console-control-strings": "^1.1.0",
|
|
4190
4190
|
"has-unicode": "^2.0.1",
|
|
4191
|
-
"signal-exit": "^3.0.
|
|
4191
|
+
"signal-exit": "^3.0.7",
|
|
4192
4192
|
"string-width": "^4.2.3",
|
|
4193
4193
|
"strip-ansi": "^6.0.1",
|
|
4194
|
-
"wide-align": "^1.1.
|
|
4194
|
+
"wide-align": "^1.1.5"
|
|
4195
|
+
},
|
|
4196
|
+
"dependencies": {
|
|
4197
|
+
"wide-align": {
|
|
4198
|
+
"version": "1.1.5",
|
|
4199
|
+
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz",
|
|
4200
|
+
"integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==",
|
|
4201
|
+
"dev": true,
|
|
4202
|
+
"requires": {
|
|
4203
|
+
"string-width": "^1.0.2 || 2 || 3 || 4"
|
|
4204
|
+
}
|
|
4205
|
+
}
|
|
4195
4206
|
}
|
|
4196
4207
|
},
|
|
4197
4208
|
"gensync": {
|
|
@@ -7519,9 +7530,9 @@
|
|
|
7519
7530
|
}
|
|
7520
7531
|
},
|
|
7521
7532
|
"minimatch": {
|
|
7522
|
-
"version": "5.0.
|
|
7523
|
-
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.
|
|
7524
|
-
"integrity": "sha512-
|
|
7533
|
+
"version": "5.0.1",
|
|
7534
|
+
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz",
|
|
7535
|
+
"integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==",
|
|
7525
7536
|
"dev": true,
|
|
7526
7537
|
"requires": {
|
|
7527
7538
|
"brace-expansion": "^2.0.1"
|
|
@@ -7656,9 +7667,9 @@
|
|
|
7656
7667
|
}
|
|
7657
7668
|
},
|
|
7658
7669
|
"lru-cache": {
|
|
7659
|
-
"version": "7.
|
|
7660
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.
|
|
7661
|
-
"integrity": "sha512-
|
|
7670
|
+
"version": "7.4.0",
|
|
7671
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.4.0.tgz",
|
|
7672
|
+
"integrity": "sha512-YOfuyWa/Ee+PXbDm40j9WXyJrzQUynVbgn4Km643UYcWNcrSfRkKL0WaiUcxcIbkXcVTgNpDqSnPXntWXT75cw==",
|
|
7662
7673
|
"dev": true
|
|
7663
7674
|
},
|
|
7664
7675
|
"make-fetch-happen": {
|
|
@@ -7974,15 +7985,15 @@
|
|
|
7974
7985
|
}
|
|
7975
7986
|
},
|
|
7976
7987
|
"pacote": {
|
|
7977
|
-
"version": "13.0.
|
|
7978
|
-
"resolved": "https://registry.npmjs.org/pacote/-/pacote-13.0.
|
|
7979
|
-
"integrity": "sha512-
|
|
7988
|
+
"version": "13.0.3",
|
|
7989
|
+
"resolved": "https://registry.npmjs.org/pacote/-/pacote-13.0.3.tgz",
|
|
7990
|
+
"integrity": "sha512-8thQ06YoO01O1k5rvSpHS/XPJZucw2DPiiT1jI+ys8QaTN6ifAyxfyoABHBa8nIt/4wPdzly4GEPqshctHFoYA==",
|
|
7980
7991
|
"dev": true,
|
|
7981
7992
|
"requires": {
|
|
7982
7993
|
"@npmcli/git": "^3.0.0",
|
|
7983
7994
|
"@npmcli/installed-package-contents": "^1.0.7",
|
|
7984
7995
|
"@npmcli/promise-spawn": "^1.2.0",
|
|
7985
|
-
"@npmcli/run-script": "^
|
|
7996
|
+
"@npmcli/run-script": "^3.0.0",
|
|
7986
7997
|
"cacache": "^15.3.0",
|
|
7987
7998
|
"chownr": "^2.0.0",
|
|
7988
7999
|
"fs-minipass": "^2.1.0",
|
package/package.json
CHANGED
|
@@ -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')), [['
|
|
16
|
+
assert.deepStrictEqual(inspect(parser('0a#b')), [['0', 'a#b'], '']);
|
|
17
17
|
assert.deepStrictEqual(inspect(parser('あ#b')), [['あ#b'], '']);
|
|
18
|
-
assert.deepStrictEqual(inspect(parser('あい#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', '
|
|
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'
|
|
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', [
|
|
@@ -108,7 +105,7 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
108
105
|
[[html('table', [
|
|
109
106
|
html('thead'),
|
|
110
107
|
html('tbody', [
|
|
111
|
-
html('tr', [html('td', '1.1'), html('td', '1.2'), html('td', ':1:1 1.3'), html('td', '1.4')]),
|
|
108
|
+
html('tr', [html('td', '1.1'), html('td', ': 1.2'), html('td', ':1:1 1.3'), html('td', '1.4')]),
|
|
112
109
|
]),
|
|
113
110
|
html('tfoot'),
|
|
114
111
|
]).outerHTML], '']);
|
|
@@ -238,18 +235,21 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
238
235
|
|
|
239
236
|
it('head', () => {
|
|
240
237
|
assert.deepStrictEqual(
|
|
241
|
-
inspect(parser('~~~table\n
|
|
238
|
+
inspect(parser('~~~table\n#\n~~~')),
|
|
239
|
+
[[html('table', [html('thead', [html('tr', [html('th')])]), html('tbody'), html('tfoot'),]).outerHTML], '']);
|
|
240
|
+
assert.deepStrictEqual(
|
|
241
|
+
inspect(parser('~~~table\n-\n# 1.1\n~~~')),
|
|
242
242
|
[[html('table', [
|
|
243
243
|
html('thead', [
|
|
244
|
-
html('tr', [html('
|
|
244
|
+
html('tr', [html('th', '1.1')]),
|
|
245
245
|
]),
|
|
246
246
|
html('tbody'),
|
|
247
247
|
html('tfoot')]).outerHTML], '']);
|
|
248
248
|
assert.deepStrictEqual(
|
|
249
|
-
inspect(parser('~~~table\n
|
|
249
|
+
inspect(parser('~~~table\n-/-\n# 1.1\n~~~')),
|
|
250
250
|
[[html('table', [
|
|
251
251
|
html('thead', [
|
|
252
|
-
html('tr', [html('
|
|
252
|
+
html('tr', [html('th', '1.1')]),
|
|
253
253
|
]),
|
|
254
254
|
html('tbody'),
|
|
255
255
|
html('tfoot')]).outerHTML], '']);
|
|
@@ -269,14 +269,6 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
269
269
|
html('tr', [html('th', '1.1'), html('td', '1.2')]),
|
|
270
270
|
]),
|
|
271
271
|
html('tfoot')]).outerHTML], '']);
|
|
272
|
-
assert.deepStrictEqual(
|
|
273
|
-
inspect(parser('~~~table\n:-\n# 1.1\n~~~')),
|
|
274
|
-
[[html('table', [
|
|
275
|
-
html('thead'),
|
|
276
|
-
html('tbody', [
|
|
277
|
-
html('tr', [html('th', '1.1')]),
|
|
278
|
-
]),
|
|
279
|
-
html('tfoot')]).outerHTML], '']);
|
|
280
272
|
});
|
|
281
273
|
|
|
282
274
|
it('foot', () => {
|
|
@@ -408,11 +400,11 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
408
400
|
html('tfoot'),
|
|
409
401
|
]).outerHTML], '']);
|
|
410
402
|
assert.deepStrictEqual(
|
|
411
|
-
inspect(parser('~~~table\n
|
|
403
|
+
inspect(parser('~~~table\n-\n# \n#! 1.2\n-\n#! 2.1\n: 2.2\n~~~')),
|
|
412
404
|
[[html('table', [
|
|
413
405
|
html('thead', [
|
|
414
406
|
html('tr', [
|
|
415
|
-
html('
|
|
407
|
+
html('th'),
|
|
416
408
|
html('th', { class: 'highlight' }, '1.2'),
|
|
417
409
|
]),
|
|
418
410
|
]),
|
|
@@ -425,11 +417,11 @@ describe('Unit: parser/block/extension/table', () => {
|
|
|
425
417
|
html('tfoot'),
|
|
426
418
|
]).outerHTML], '']);
|
|
427
419
|
assert.deepStrictEqual(
|
|
428
|
-
inspect(parser('~~~table\n
|
|
420
|
+
inspect(parser('~~~table\n-\n# \n#! 1.2\n-\n#! 2.1\n:! 2.2\n~~~')),
|
|
429
421
|
[[html('table', [
|
|
430
422
|
html('thead', [
|
|
431
423
|
html('tr', [
|
|
432
|
-
html('
|
|
424
|
+
html('th'),
|
|
433
425
|
html('th', { class: 'highlight' }, '1.2'),
|
|
434
426
|
]),
|
|
435
427
|
]),
|
|
@@ -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
|
}),
|
|
@@ -61,22 +61,22 @@ const row: RowParser = lazy(() => dup(fmap(
|
|
|
61
61
|
some(union([
|
|
62
62
|
head,
|
|
63
63
|
data,
|
|
64
|
-
emptyline,
|
|
65
64
|
some(dataline, alignment),
|
|
65
|
+
emptyline,
|
|
66
66
|
])),
|
|
67
67
|
]),
|
|
68
68
|
ns => !isArray(ns[0]) ? unshift([[[]]], ns) : ns)));
|
|
69
69
|
|
|
70
|
-
const alignment = /^[
|
|
70
|
+
const alignment = /^[-=<>]+(?:\/[-=^v]*)?(?=[^\S\n]*\n)/;
|
|
71
71
|
|
|
72
72
|
const align: AlignParser = line(fmap(
|
|
73
73
|
union([str(alignment)]),
|
|
74
74
|
([s]) => s.split('/').map(s => s.split(''))));
|
|
75
75
|
|
|
76
|
-
const delimiter = /^[
|
|
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(/^#(?:(
|
|
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(/^:(?:(
|
|
91
|
+
str(/^:(?:(?!:\D|0)\d*:(?!0)\d*)?!*(?=\s)/),
|
|
92
92
|
rewrite(
|
|
93
93
|
inits([
|
|
94
94
|
anyline,
|
|
@@ -103,8 +103,7 @@ const dataline: CellParser.DatalineParser = creator(line(
|
|
|
103
103
|
rewrite(
|
|
104
104
|
contentline,
|
|
105
105
|
union([
|
|
106
|
-
validate(
|
|
107
|
-
validate(/^!+[^\S\n]/, convert(source => `:${source}`, data)),
|
|
106
|
+
validate(/^!+\s/, convert(source => `:${source}`, data)),
|
|
108
107
|
convert(source => `: ${source}`, data),
|
|
109
108
|
]))));
|
|
110
109
|
|
|
@@ -152,10 +151,7 @@ function format(rows: Tree<RowParser>[]): HTMLTableSectionElement[] {
|
|
|
152
151
|
assert(cells !== rows[i]);
|
|
153
152
|
let isBody = target === tfoot
|
|
154
153
|
? false
|
|
155
|
-
:
|
|
156
|
-
as[0] === '#' ? !as.shift() : undefined,
|
|
157
|
-
as[0] === ':' ? !!as.shift() : undefined,
|
|
158
|
-
].reduce((a, b) => a ?? b);
|
|
154
|
+
: undefined;
|
|
159
155
|
as.length === 0 && as.push('-');
|
|
160
156
|
ALIGN_H:
|
|
161
157
|
for (let j = 0, update = false; j < as.length || j < aligns.length; ++j) {
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { IListParser } from '../block';
|
|
2
|
-
import { union, inits, some, block, line, validate, indent, rewrite, context, creator, open,
|
|
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(
|
|
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,
|
|
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
|
-
|
|
13
|
-
/^(
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
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(
|
|
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
|
|
46
|
+
const heads = {
|
|
32
47
|
'.': focus(
|
|
33
|
-
|
|
48
|
+
openers['.'],
|
|
34
49
|
(source: string) => [[`${source.split('.', 1)[0]}.`], '']),
|
|
35
|
-
'
|
|
36
|
-
|
|
37
|
-
(source: string) => [[source.
|
|
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
|
|
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,
|
|
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(
|
|
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
|
|
39
|
+
'data-invalid-description': 'Fix the indent or the head of the list item.',
|
|
40
40
|
}, source.replace('\n', ''))
|
|
41
41
|
], '']);
|
|
42
42
|
|
|
@@ -11,26 +11,23 @@ import { str } from '../source';
|
|
|
11
11
|
import { stringify } from '../util';
|
|
12
12
|
|
|
13
13
|
export const autolink: AutolinkParser = fmap(
|
|
14
|
-
validate(/^(?:[@#>0-9A-Za-z]
|
|
14
|
+
validate(/^(?:[@#>0-9A-Za-z]|\S#)/,
|
|
15
15
|
guard(context => context.syntax?.inline?.autolink ?? true,
|
|
16
16
|
some(union([
|
|
17
17
|
url,
|
|
18
18
|
email,
|
|
19
19
|
// Escape unmatched email-like strings.
|
|
20
20
|
str(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*(?:@(?:[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)+/),
|
|
21
|
-
// Escape repeated symbols.
|
|
22
|
-
str(/^@+(?![0-9A-Za-z]|[^\x00-\x7F\s])/),
|
|
23
|
-
str(/^#+(?![0-9A-Za-z'_]|[^\x00-\x7F\s])/),
|
|
24
21
|
channel,
|
|
25
22
|
account,
|
|
26
23
|
// Escape unmatched account-like strings.
|
|
27
|
-
str(
|
|
24
|
+
str(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/),
|
|
28
25
|
// Escape invalid leading characters.
|
|
29
|
-
str(/^[0-9A-Za-z]
|
|
26
|
+
str(/^(?:[0-9A-Za-z]|[^\x00-\x7F\s])(?=#)/u),
|
|
30
27
|
hashtag,
|
|
31
28
|
hashnum,
|
|
32
29
|
// Escape unmatched hashtag-like strings.
|
|
33
|
-
str(
|
|
30
|
+
str(/^#+(?:[0-9A-Za-z'_]|[^\x00-\x7F\s])*/),
|
|
34
31
|
anchor,
|
|
35
32
|
])))),
|
|
36
33
|
ns => ns.length === 1 ? ns : [stringify(ns)]);
|
|
@@ -168,11 +168,11 @@ describe('Unit: parser/inline', () => {
|
|
|
168
168
|
assert.deepStrictEqual(inspect(parser('#a\nb\n#c\n[#d]')), [['<a href="/hashtags/a" class="hashtag">#a</a>', '<br>', 'b', '<br>', '<a href="/hashtags/c" class="hashtag">#c</a>', '<br>', '<a class="index" href="#index:d">d</a>'], '']);
|
|
169
169
|
assert.deepStrictEqual(inspect(parser('##a')), [['##a'], '']);
|
|
170
170
|
assert.deepStrictEqual(inspect(parser('a#b')), [['a#b'], '']);
|
|
171
|
-
assert.deepStrictEqual(inspect(parser('0a#b')), [['
|
|
171
|
+
assert.deepStrictEqual(inspect(parser('0a#b')), [['0', 'a#b'], '']);
|
|
172
172
|
assert.deepStrictEqual(inspect(parser('あ#b')), [['あ#b'], '']);
|
|
173
|
-
assert.deepStrictEqual(inspect(parser('あい#b')), [['
|
|
173
|
+
assert.deepStrictEqual(inspect(parser('あい#b')), [['あ', 'い#b'], '']);
|
|
174
174
|
assert.deepStrictEqual(inspect(parser('0aあ#b')), [['0a', 'あ#b'], '']);
|
|
175
|
-
assert.deepStrictEqual(inspect(parser('0aあい#b')), [['0a', '
|
|
175
|
+
assert.deepStrictEqual(inspect(parser('0aあい#b')), [['0a', 'あ', 'い#b'], '']);
|
|
176
176
|
assert.deepStrictEqual(inspect(parser('a\n#b')), [['a', '<br>', '<a href="/hashtags/b" class="hashtag">#b</a>'], '']);
|
|
177
177
|
assert.deepStrictEqual(inspect(parser('a\\\n#b')), [['a', '<span class="linebreak"> </span>', '<a href="/hashtags/b" class="hashtag">#b</a>'], '']);
|
|
178
178
|
assert.deepStrictEqual(inspect(parser('*a*#b')), [['<em>a</em>', '<a href="/hashtags/b" class="hashtag">#b</a>'], '']);
|
|
@@ -4,9 +4,9 @@ import { union, focus, creator } from '../../combinator';
|
|
|
4
4
|
import { str } from './str';
|
|
5
5
|
import { html } from 'typed-dom';
|
|
6
6
|
|
|
7
|
-
export const separator = /[\s\x00-\x7F]
|
|
7
|
+
export const separator = /[\s\x00-\x7F]|\S#|[、。!?][^\S\n]*(?=\\\n)/;
|
|
8
8
|
export const nonWhitespace = /[\S\n]|$/;
|
|
9
|
-
export const nonAlphanumeric = /[^0-9A-Za-z]
|
|
9
|
+
export const nonAlphanumeric = /[^0-9A-Za-z]|\S#|$/;
|
|
10
10
|
const repeat = str(/^(.)\1*/);
|
|
11
11
|
|
|
12
12
|
export const text: TextParser = creator((source, context) => {
|
|
@@ -59,7 +59,7 @@ export const text: TextParser = creator((source, context) => {
|
|
|
59
59
|
assert(source[0] !== '\n');
|
|
60
60
|
const b = source[0].trimStart() === '';
|
|
61
61
|
const i = b || isAlphanumeric(source[0])
|
|
62
|
-
? source.search(b ? nonWhitespace : nonAlphanumeric)
|
|
62
|
+
? source.search(b ? nonWhitespace : nonAlphanumeric) || 1
|
|
63
63
|
: 1;
|
|
64
64
|
assert(i > 0);
|
|
65
65
|
assert(!['\\', '\n'].includes(source[0]));
|
|
@@ -12,7 +12,7 @@ export const unescsource: UnescapableSourceParser = creator(source => {
|
|
|
12
12
|
case 0: {
|
|
13
13
|
const b = source[0] !== '\n' && source[0].trimStart() === '';
|
|
14
14
|
const i = b || isAlphanumeric(source[0])
|
|
15
|
-
? source.search(b ? nonWhitespace : nonAlphanumeric)
|
|
15
|
+
? source.search(b ? nonWhitespace : nonAlphanumeric) || 1
|
|
16
16
|
: 1;
|
|
17
17
|
assert(i > 0);
|
|
18
18
|
return [[source.slice(0, i)], source.slice(i)];
|