securemark 0.230.0 → 0.231.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 +113 -85
- package/gulpfile.js +21 -1
- package/markdown.d.ts +0 -2
- package/package-lock.json +952 -225
- package/package.json +9 -7
- package/src/debug.test.ts +1 -0
- package/src/parser/api/header.ts +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.ts +1 -1
- package/src/parser/block/mathblock.ts +1 -1
- package/src/parser/block/olist.test.ts +4 -0
- package/src/parser/block/olist.ts +6 -6
- package/src/parser/block/paragraph/mention/quote.ts +1 -1
- package/src/parser/block/ulist.ts +1 -1
- package/src/parser/inline/autolink/account.ts +1 -1
- package/src/parser/inline/autolink/email.test.ts +2 -1
- package/src/parser/inline/autolink/email.ts +1 -1
- package/src/parser/inline/autolink/hashnum.test.ts +1 -0
- package/src/parser/inline/autolink/hashnum.ts +2 -1
- package/src/parser/inline/autolink/hashtag.test.ts +13 -12
- package/src/parser/inline/autolink/hashtag.ts +9 -2
- package/src/parser/inline/autolink.ts +5 -8
- package/src/parser/inline/bracket.ts +1 -4
- package/src/parser/inline/comment.test.ts +2 -0
- package/src/parser/inline/comment.ts +2 -2
- package/src/parser/inline/html.ts +1 -1
- package/src/parser/inline/link.ts +2 -2
- package/src/parser/inline/ruby.ts +2 -2
- package/src/parser/inline.test.ts +5 -3
- package/src/parser/source/text.ts +3 -3
- package/src/parser/source/unescapable.ts +1 -1
- package/src/parser/util.ts +2 -2
- package/src/renderer/render/media/youtube.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.231.1
|
|
4
|
+
|
|
5
|
+
- Fix comment syntax.
|
|
6
|
+
- Fix ReDoS.
|
|
7
|
+
|
|
8
|
+
## 0.231.0
|
|
9
|
+
|
|
10
|
+
- Refine hashtag syntax.
|
|
11
|
+
|
|
12
|
+
## 0.230.1
|
|
13
|
+
|
|
14
|
+
- Refactoring.
|
|
15
|
+
|
|
3
16
|
## 0.230.0
|
|
4
17
|
|
|
5
18
|
- Change table syntax's cell syntax not to depend on trailing whitespace.
|
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.231.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) {
|
|
@@ -896,12 +896,16 @@ require = function () {
|
|
|
896
896
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
897
897
|
if (k2 === undefined)
|
|
898
898
|
k2 = k;
|
|
899
|
-
Object.
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
899
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
900
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
901
|
+
desc = {
|
|
902
|
+
enumerable: true,
|
|
903
|
+
get: function () {
|
|
904
|
+
return m[k];
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
Object.defineProperty(o, k2, desc);
|
|
905
909
|
} : function (o, m, k, k2) {
|
|
906
910
|
if (k2 === undefined)
|
|
907
911
|
k2 = k;
|
|
@@ -1147,12 +1151,16 @@ require = function () {
|
|
|
1147
1151
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
1148
1152
|
if (k2 === undefined)
|
|
1149
1153
|
k2 = k;
|
|
1150
|
-
Object.
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1154
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1155
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1156
|
+
desc = {
|
|
1157
|
+
enumerable: true,
|
|
1158
|
+
get: function () {
|
|
1159
|
+
return m[k];
|
|
1160
|
+
}
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
Object.defineProperty(o, k2, desc);
|
|
1156
1164
|
} : function (o, m, k, k2) {
|
|
1157
1165
|
if (k2 === undefined)
|
|
1158
1166
|
k2 = k;
|
|
@@ -2502,7 +2510,7 @@ require = function () {
|
|
|
2502
2510
|
[privates.scope](child) {
|
|
2503
2511
|
if (child.element.tagName !== 'STYLE')
|
|
2504
2512
|
return;
|
|
2505
|
-
const target = /(^|[,}])(\s*)\$scope(
|
|
2513
|
+
const target = /(^|[,}]|\*\/)(\s*)\$scope(?=[\s~+[{:>,])/g;
|
|
2506
2514
|
const style = child.element.innerHTML;
|
|
2507
2515
|
if (!target.test(style))
|
|
2508
2516
|
return;
|
|
@@ -3081,12 +3089,16 @@ require = function () {
|
|
|
3081
3089
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
3082
3090
|
if (k2 === undefined)
|
|
3083
3091
|
k2 = k;
|
|
3084
|
-
Object.
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3092
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
3093
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
3094
|
+
desc = {
|
|
3095
|
+
enumerable: true,
|
|
3096
|
+
get: function () {
|
|
3097
|
+
return m[k];
|
|
3098
|
+
}
|
|
3099
|
+
};
|
|
3100
|
+
}
|
|
3101
|
+
Object.defineProperty(o, k2, desc);
|
|
3090
3102
|
} : function (o, m, k, k2) {
|
|
3091
3103
|
if (k2 === undefined)
|
|
3092
3104
|
k2 = k;
|
|
@@ -4015,12 +4027,16 @@ require = function () {
|
|
|
4015
4027
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4016
4028
|
if (k2 === undefined)
|
|
4017
4029
|
k2 = k;
|
|
4018
|
-
Object.
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4030
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4031
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
4032
|
+
desc = {
|
|
4033
|
+
enumerable: true,
|
|
4034
|
+
get: function () {
|
|
4035
|
+
return m[k];
|
|
4036
|
+
}
|
|
4037
|
+
};
|
|
4038
|
+
}
|
|
4039
|
+
Object.defineProperty(o, k2, desc);
|
|
4024
4040
|
} : function (o, m, k, k2) {
|
|
4025
4041
|
if (k2 === undefined)
|
|
4026
4042
|
k2 = k;
|
|
@@ -4329,7 +4345,7 @@ require = function () {
|
|
|
4329
4345
|
function headers(source) {
|
|
4330
4346
|
var _a;
|
|
4331
4347
|
const [el] = parse(source);
|
|
4332
|
-
return (_a = el === null || el === void 0 ? void 0 : el.textContent.trimEnd().slice(el.firstChild.textContent.length).split(
|
|
4348
|
+
return (_a = el === null || el === void 0 ? void 0 : el.textContent.trimEnd().slice(el.firstChild.textContent.length).split('\n')) !== null && _a !== void 0 ? _a : [];
|
|
4333
4349
|
}
|
|
4334
4350
|
exports.headers = headers;
|
|
4335
4351
|
function parse(source) {
|
|
@@ -4676,7 +4692,7 @@ require = function () {
|
|
|
4676
4692
|
translate: 'no',
|
|
4677
4693
|
'data-invalid-syntax': 'codeblock',
|
|
4678
4694
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
4679
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
4695
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
4680
4696
|
}, `${ opener }${ body }${ closer }`)];
|
|
4681
4697
|
const file = (_a = path.split('/').pop()) !== null && _a !== void 0 ? _a : '';
|
|
4682
4698
|
const ext = file && file.includes('.', 1) ? file.split('.').pop() : '';
|
|
@@ -4814,7 +4830,7 @@ require = function () {
|
|
|
4814
4830
|
translate: 'no',
|
|
4815
4831
|
'data-invalid-syntax': 'aside',
|
|
4816
4832
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
4817
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
4833
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
4818
4834
|
}, `${ opener }${ body }${ closer }`)];
|
|
4819
4835
|
const annotations = (0, typed_dom_1.html)('ol', { class: 'annotations' });
|
|
4820
4836
|
const references = (0, typed_dom_1.html)('ol', { class: 'references' });
|
|
@@ -4869,7 +4885,7 @@ require = function () {
|
|
|
4869
4885
|
translate: 'no',
|
|
4870
4886
|
'data-invalid-syntax': 'example',
|
|
4871
4887
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
4872
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
4888
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
4873
4889
|
}, `${ opener }${ body }${ closer }`)];
|
|
4874
4890
|
switch (type) {
|
|
4875
4891
|
case 'markdown': {
|
|
@@ -5126,7 +5142,7 @@ require = function () {
|
|
|
5126
5142
|
translate: 'no',
|
|
5127
5143
|
'data-invalid-syntax': 'message',
|
|
5128
5144
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
5129
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5145
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
5130
5146
|
}, `${ opener }${ body }${ closer }`)];
|
|
5131
5147
|
switch (type) {
|
|
5132
5148
|
case 'note':
|
|
@@ -5197,7 +5213,7 @@ require = function () {
|
|
|
5197
5213
|
translate: 'no',
|
|
5198
5214
|
'data-invalid-syntax': 'extension',
|
|
5199
5215
|
'data-invalid-type': !closer ? 'closer' : 'syntax',
|
|
5200
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid syntax.'
|
|
5216
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid syntax.'
|
|
5201
5217
|
}, `${ opener }${ body }${ closer }`)])));
|
|
5202
5218
|
},
|
|
5203
5219
|
{
|
|
@@ -5231,7 +5247,7 @@ require = function () {
|
|
|
5231
5247
|
translate: 'no',
|
|
5232
5248
|
'data-invalid-syntax': 'table',
|
|
5233
5249
|
'data-invalid-type': !closer ? 'closer' : 'argument',
|
|
5234
|
-
'data-invalid-description': !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5250
|
+
'data-invalid-description': !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
5235
5251
|
}, `${ opener }${ body }${ closer }`)],
|
|
5236
5252
|
''
|
|
5237
5253
|
];
|
|
@@ -5607,7 +5623,7 @@ require = function () {
|
|
|
5607
5623
|
translate: 'no',
|
|
5608
5624
|
'data-invalid-syntax': 'mathblock',
|
|
5609
5625
|
'data-invalid-type': delim.length > 2 ? 'syntax' : !closer ? 'closer' : 'argument',
|
|
5610
|
-
'data-invalid-description': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter ${ delim }.` : 'Invalid argument.'
|
|
5626
|
+
'data-invalid-description': delim.length > 2 ? 'Invalid syntax' : !closer ? `Missing the closing delimiter "${ delim }".` : 'Invalid argument.'
|
|
5611
5627
|
}, `${ opener }${ body }${ closer }`)];
|
|
5612
5628
|
})));
|
|
5613
5629
|
},
|
|
@@ -5636,15 +5652,15 @@ require = function () {
|
|
|
5636
5652
|
'(': /^\((?:[0-9]*|[a-z]*)(?![^)\n])\)?(?:-(?!-)[0-9]*)*(?=$|\s)/
|
|
5637
5653
|
};
|
|
5638
5654
|
exports.olist = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.validate)([
|
|
5639
|
-
/^(
|
|
5640
|
-
|
|
5655
|
+
/^([0-9]+|[a-z]+|[A-Z]+)(?:-[0-9]+)*\.(?=[^\S\n]|\n[^\S\n]*\S)/,
|
|
5656
|
+
/^\(([0-9]+|[a-z]+)\)(?:-[0-9]+)*(?=[^\S\n]|\n[^\S\n]*\S)/
|
|
5641
5657
|
], (0, combinator_1.context)({ syntax: { inline: { media: false } } }, exports.olist_))));
|
|
5642
5658
|
exports.olist_ = (0, combinator_1.lazy)(() => (0, combinator_1.block)((0, combinator_1.union)([
|
|
5643
5659
|
(0, combinator_1.match)(new RegExp(`^(?=${ openers['.'].source.replace('?:', '') })`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '.'), ms => type(ms[1]))),
|
|
5644
5660
|
(0, combinator_1.match)(new RegExp(`^(?=${ openers['('].source.replace('?:', '') })`), (0, memoize_1.memoize)(ms => list(type(ms[1]), '('), ms => type(ms[1])))
|
|
5645
5661
|
])));
|
|
5646
5662
|
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)(
|
|
5663
|
+
(0, combinator_1.line)((0, combinator_1.open)(heads[delim], (0, combinator_1.trim)((0, combinator_1.subsequence)([
|
|
5648
5664
|
ulist_1.checkbox,
|
|
5649
5665
|
(0, combinator_1.trimStart)((0, combinator_1.some)(inline_1.inline))
|
|
5650
5666
|
])), true)),
|
|
@@ -5654,13 +5670,13 @@ require = function () {
|
|
|
5654
5670
|
ilist_1.ilist_
|
|
5655
5671
|
]))
|
|
5656
5672
|
]), 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
|
|
5673
|
+
const heads = {
|
|
5658
5674
|
'.': (0, combinator_1.focus)(openers['.'], source => [
|
|
5659
5675
|
[`${ source.split('.', 1)[0] }.`],
|
|
5660
5676
|
''
|
|
5661
5677
|
]),
|
|
5662
5678
|
'(': (0, combinator_1.focus)(openers['('], source => [
|
|
5663
|
-
[source.
|
|
5679
|
+
[source.replace(/^\($/, '(1)').replace(/^\((\w+)$/, '($1)')],
|
|
5664
5680
|
''
|
|
5665
5681
|
])
|
|
5666
5682
|
};
|
|
@@ -5671,7 +5687,7 @@ require = function () {
|
|
|
5671
5687
|
class: 'invalid',
|
|
5672
5688
|
'data-invalid-syntax': 'listitem',
|
|
5673
5689
|
'data-invalid-type': 'syntax',
|
|
5674
|
-
'data-invalid-description': 'Fix the indent or the head of list
|
|
5690
|
+
'data-invalid-description': 'Fix the indent or the head of the list item.'
|
|
5675
5691
|
}, source.replace('\n', ''))
|
|
5676
5692
|
],
|
|
5677
5693
|
''
|
|
@@ -5854,7 +5870,7 @@ require = function () {
|
|
|
5854
5870
|
class: 'quote invalid',
|
|
5855
5871
|
'data-invalid-syntax': 'quote',
|
|
5856
5872
|
'data-invalid-type': 'syntax',
|
|
5857
|
-
'data-invalid-description': `Missing the whitespace after ${ ns[0].split(/[^>]/, 1)[0] }.`
|
|
5873
|
+
'data-invalid-description': `Missing the whitespace after "${ ns[0].split(/[^>]/, 1)[0] }".`
|
|
5858
5874
|
}, ns),
|
|
5859
5875
|
(0, typed_dom_1.html)('br')
|
|
5860
5876
|
]), false)));
|
|
@@ -6009,7 +6025,7 @@ require = function () {
|
|
|
6009
6025
|
class: 'invalid',
|
|
6010
6026
|
'data-invalid-syntax': 'listitem',
|
|
6011
6027
|
'data-invalid-type': 'syntax',
|
|
6012
|
-
'data-invalid-description': 'Fix the indent or the head of list
|
|
6028
|
+
'data-invalid-description': 'Fix the indent or the head of the list item.'
|
|
6013
6029
|
}, source.replace('\n', ''))],
|
|
6014
6030
|
''
|
|
6015
6031
|
]);
|
|
@@ -6247,22 +6263,20 @@ require = function () {
|
|
|
6247
6263
|
const anchor_1 = _dereq_('./autolink/anchor');
|
|
6248
6264
|
const source_1 = _dereq_('../source');
|
|
6249
6265
|
const util_1 = _dereq_('../util');
|
|
6250
|
-
exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]
|
|
6266
|
+
exports.autolink = (0, combinator_1.fmap)((0, combinator_1.validate)(/^(?:[@#>0-9A-Za-z]|\S#)/, (0, combinator_1.guard)(context => {
|
|
6251
6267
|
var _a, _b, _c;
|
|
6252
6268
|
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;
|
|
6253
6269
|
}, (0, combinator_1.some)((0, combinator_1.union)([
|
|
6254
6270
|
url_1.url,
|
|
6255
6271
|
email_1.email,
|
|
6256
6272
|
(0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*(?:@(?:[0-9A-Za-z]+(?:[.-][0-9A-Za-z]+)*)?)+/),
|
|
6257
|
-
(0, source_1.str)(/^@+(?![0-9A-Za-z]|[^\x00-\x7F\s])/),
|
|
6258
|
-
(0, source_1.str)(/^#+(?![0-9A-Za-z'_]|[^\x00-\x7F\s])/),
|
|
6259
6273
|
channel_1.channel,
|
|
6260
6274
|
account_1.account,
|
|
6261
|
-
(0, source_1.str)(
|
|
6262
|
-
(0, source_1.str)(
|
|
6275
|
+
(0, source_1.str)(/^@+[0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/),
|
|
6276
|
+
(0, source_1.str)(new RegExp(String.raw`^(?:[^\p{C}\p{S}\p{P}\s]|${ hashtag_1.emoji }|['_])(?=#)`, 'u')),
|
|
6263
6277
|
hashtag_1.hashtag,
|
|
6264
6278
|
hashnum_1.hashnum,
|
|
6265
|
-
(0, source_1.str)(
|
|
6279
|
+
(0, source_1.str)(new RegExp(String.raw`^#+(?:[^\p{C}\p{S}\p{P}\s]|${ hashtag_1.emoji }|['_])*`, 'u')),
|
|
6266
6280
|
anchor_1.anchor
|
|
6267
6281
|
])))), ns => ns.length === 1 ? ns : [(0, util_1.stringify)(ns)]);
|
|
6268
6282
|
},
|
|
@@ -6289,7 +6303,7 @@ require = function () {
|
|
|
6289
6303
|
const source_1 = _dereq_('../../source');
|
|
6290
6304
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6291
6305
|
exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('@', (0, combinator_1.tails)([
|
|
6292
|
-
(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:[0-9A-Za-z
|
|
6306
|
+
(0, combinator_1.verify)((0, source_1.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])?)*\//), ([source]) => source.length <= 253 + 1),
|
|
6293
6307
|
(0, combinator_1.verify)((0, source_1.str)(/^[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*/), ([source]) => source.length <= 64)
|
|
6294
6308
|
])), (0, combinator_1.context)({
|
|
6295
6309
|
syntax: {
|
|
@@ -6376,7 +6390,7 @@ require = function () {
|
|
|
6376
6390
|
const combinator_1 = _dereq_('../../../combinator');
|
|
6377
6391
|
const source_1 = _dereq_('../../source');
|
|
6378
6392
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6379
|
-
exports.email = (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*@[0-9A-Za-z](?:[0-9A-Za-z
|
|
6393
|
+
exports.email = (0, combinator_1.creator)((0, combinator_1.rewrite)((0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z]+(?:[.+_-][0-9A-Za-z]+)*@[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])?)*(?![0-9A-Za-z])/), ([source]) => source.indexOf('@') <= 64 && source.length <= 255), source => [
|
|
6380
6394
|
[(0, typed_dom_1.html)('a', {
|
|
6381
6395
|
class: 'email',
|
|
6382
6396
|
href: `mailto:${ source }`
|
|
@@ -6397,9 +6411,10 @@ require = function () {
|
|
|
6397
6411
|
exports.hashnum = void 0;
|
|
6398
6412
|
const combinator_1 = _dereq_('../../../combinator');
|
|
6399
6413
|
const link_1 = _dereq_('../link');
|
|
6414
|
+
const hashtag_1 = _dereq_('./hashtag');
|
|
6400
6415
|
const source_1 = _dereq_('../../source');
|
|
6401
6416
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6402
|
-
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(
|
|
6417
|
+
exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, source_1.str)(new RegExp(String.raw`^[0-9]{1,16}(?![^\p{C}\p{S}\p{P}\s]|${ hashtag_1.emoji }|['_])`, 'u'))), (0, combinator_1.context)({
|
|
6403
6418
|
syntax: {
|
|
6404
6419
|
inline: {
|
|
6405
6420
|
link: true,
|
|
@@ -6415,6 +6430,7 @@ require = function () {
|
|
|
6415
6430
|
'../../../combinator': 27,
|
|
6416
6431
|
'../../source': 128,
|
|
6417
6432
|
'../link': 114,
|
|
6433
|
+
'./hashtag': 96,
|
|
6418
6434
|
'typed-dom': 26
|
|
6419
6435
|
}
|
|
6420
6436
|
],
|
|
@@ -6422,14 +6438,20 @@ require = function () {
|
|
|
6422
6438
|
function (_dereq_, module, exports) {
|
|
6423
6439
|
'use strict';
|
|
6424
6440
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6425
|
-
exports.hashtag = void 0;
|
|
6441
|
+
exports.hashtag = exports.emoji = void 0;
|
|
6426
6442
|
const combinator_1 = _dereq_('../../../combinator');
|
|
6427
6443
|
const link_1 = _dereq_('../link');
|
|
6428
6444
|
const source_1 = _dereq_('../../source');
|
|
6429
6445
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6446
|
+
exports.emoji = String.raw`\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F`;
|
|
6430
6447
|
exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.open)('#', (0, combinator_1.tails)([
|
|
6431
|
-
(0, combinator_1.verify)((0, source_1.str)(/^[0-9A-Za-z](?:[0-9A-Za-z
|
|
6432
|
-
(0, combinator_1.verify)((0, source_1.str)(
|
|
6448
|
+
(0, combinator_1.verify)((0, source_1.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])?)*\//), ([source]) => source.length <= 253 + 1),
|
|
6449
|
+
(0, combinator_1.verify)((0, source_1.str)(new RegExp([
|
|
6450
|
+
'^',
|
|
6451
|
+
String.raw`(?=[0-9]{0,127}_?(?:[^\d\p{C}\p{S}\p{P}\s]|${ exports.emoji }))`,
|
|
6452
|
+
String.raw`(?:[^\p{C}\p{S}\p{P}\s]|${ exports.emoji }|_(?=[^\p{C}\p{S}\p{P}\s]|${ exports.emoji })){1,128}`,
|
|
6453
|
+
String.raw`(?!_?(?:[^\p{C}\p{S}\p{P}\s]|${ exports.emoji })|')`
|
|
6454
|
+
].join(''), 'u')), ([source]) => source.length <= 128)
|
|
6433
6455
|
])), (0, combinator_1.context)({
|
|
6434
6456
|
syntax: {
|
|
6435
6457
|
inline: {
|
|
@@ -6495,10 +6517,7 @@ require = function () {
|
|
|
6495
6517
|
const source_1 = _dereq_('../source');
|
|
6496
6518
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6497
6519
|
const array_1 = _dereq_('spica/array');
|
|
6498
|
-
const index =
|
|
6499
|
-
/(?:0|[1-9]\d*)(?:\.(?:0|[1-9]\d*))+/,
|
|
6500
|
-
/[0-9]{1,4}|[A-Za-z]/
|
|
6501
|
-
].map(r => r.source).join('|') })`);
|
|
6520
|
+
const index = /^(?:[0-9]+(?:\.[0-9]+)*|[A-Za-z])/;
|
|
6502
6521
|
const indexFW = new RegExp(index.source.replace(/[019AZaz](?!,)/g, c => String.fromCharCode(c.charCodeAt(0) + 65248)));
|
|
6503
6522
|
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([
|
|
6504
6523
|
(0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(index), (0, source_1.str)(')'), false, ([as, bs = [], cs], rest) => [
|
|
@@ -6576,8 +6595,8 @@ require = function () {
|
|
|
6576
6595
|
const htmlentity_1 = _dereq_('./htmlentity');
|
|
6577
6596
|
const source_1 = _dereq_('../source');
|
|
6578
6597
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6579
|
-
exports.comment = (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.match)(/^\[(#+)
|
|
6580
|
-
[whole, body] = `${ whole }\0${ body.
|
|
6598
|
+
exports.comment = (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.match)(/^\[(#+)(?!\S|\s+\1\]|\s*\[\1(?:$|\s))((?:\s+\S+)+?)(?:\s+(\1\])|\s*(?=\[\1(?:$|\s)))/, ([whole, , body, closer]) => (rest, context) => {
|
|
6599
|
+
[whole, body] = `${ whole }\0${ body.trimStart() }`.replace(/\x1B/g, '').split('\0', 2);
|
|
6581
6600
|
if (!closer)
|
|
6582
6601
|
return [
|
|
6583
6602
|
[(0, typed_dom_1.html)('sup', {
|
|
@@ -7118,7 +7137,7 @@ require = function () {
|
|
|
7118
7137
|
rest
|
|
7119
7138
|
] : global_1.undefined)), ([, tag]) => tag, new cache_1.Cache(1000)))
|
|
7120
7139
|
])))));
|
|
7121
|
-
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[
|
|
7140
|
+
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]);
|
|
7122
7141
|
function elem(tag, as, bs, cs, context) {
|
|
7123
7142
|
var _a, _b, _c, _d, _e, _f;
|
|
7124
7143
|
if (!tags.includes(tag))
|
|
@@ -7316,7 +7335,7 @@ require = function () {
|
|
|
7316
7335
|
]);
|
|
7317
7336
|
exports.option = (0, combinator_1.union)([
|
|
7318
7337
|
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]),
|
|
7319
|
-
(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[
|
|
7338
|
+
(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/),
|
|
7320
7339
|
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+(?=})/), () => []),
|
|
7321
7340
|
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\n{}]+/), opt => [` \\${ opt.slice(1) }`])
|
|
7322
7341
|
]);
|
|
@@ -7324,7 +7343,7 @@ require = function () {
|
|
|
7324
7343
|
switch (true) {
|
|
7325
7344
|
case uri.slice(0, 2) === '^/':
|
|
7326
7345
|
const last = host.pathname.slice(host.pathname.lastIndexOf('/') + 1);
|
|
7327
|
-
return last.includes('.') && /^[0-9]*[
|
|
7346
|
+
return last.includes('.') && /^[0-9]*[A-Za-z][0-9A-Za-z]*$/.test(last.slice(last.lastIndexOf('.') + 1)) ? `${ host.pathname.slice(0, -last.length) }${ uri.slice(2) }` : `${ host.pathname.replace(/\/?$/, '/') }${ uri.slice(2) }`;
|
|
7328
7347
|
case host.origin === source.origin && host.pathname === source.pathname:
|
|
7329
7348
|
case uri.slice(0, 2) === '//':
|
|
7330
7349
|
return uri;
|
|
@@ -7694,8 +7713,8 @@ require = function () {
|
|
|
7694
7713
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7695
7714
|
const array_1 = _dereq_('spica/array');
|
|
7696
7715
|
exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.bind)((0, combinator_1.verify)((0, combinator_1.validate)('[', ')', '\n', (0, combinator_1.sequence)([
|
|
7697
|
-
(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[
|
|
7698
|
-
(0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[
|
|
7716
|
+
(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\[\]\n])+(?=]\()/, text), ']'),
|
|
7717
|
+
(0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\(\)\n])+(?=\))/, text), ')')
|
|
7699
7718
|
])), ([texts]) => (0, util_1.isStartTightNodes)(texts)), ([texts, rubies], rest) => {
|
|
7700
7719
|
const tail = typeof texts[texts.length - 1] === 'object' ? [texts.pop()] : [];
|
|
7701
7720
|
tail.length === 0 && texts[texts.length - 1] === '' && texts.pop();
|
|
@@ -8469,9 +8488,9 @@ require = function () {
|
|
|
8469
8488
|
const combinator_1 = _dereq_('../../combinator');
|
|
8470
8489
|
const str_1 = _dereq_('./str');
|
|
8471
8490
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
8472
|
-
exports.separator = /[\s\x00-\x7F]
|
|
8491
|
+
exports.separator = /[\s\x00-\x7F]|\S#|[、。!?][^\S\n]*(?=\\\n)/;
|
|
8473
8492
|
exports.nonWhitespace = /[\S\n]|$/;
|
|
8474
|
-
exports.nonAlphanumeric = /[^0-9A-Za-z]
|
|
8493
|
+
exports.nonAlphanumeric = /[^0-9A-Za-z]|\S#|$/;
|
|
8475
8494
|
const repeat = (0, str_1.str)(/^(.)\1*/);
|
|
8476
8495
|
exports.text = (0, combinator_1.creator)((source, context) => {
|
|
8477
8496
|
if (source === '')
|
|
@@ -8545,7 +8564,7 @@ require = function () {
|
|
|
8545
8564
|
];
|
|
8546
8565
|
default:
|
|
8547
8566
|
const b = source[0].trimStart() === '';
|
|
8548
|
-
const i = b || isAlphanumeric(source[0]) ? source.search(b ? exports.nonWhitespace : exports.nonAlphanumeric) : 1;
|
|
8567
|
+
const i = b || isAlphanumeric(source[0]) ? source.search(b ? exports.nonWhitespace : exports.nonAlphanumeric) || 1 : 1;
|
|
8549
8568
|
return b && i === source.length || b && source[i] === '\n' || b && source[i] === '\\' && source[i + 1] === '\n' ? [
|
|
8550
8569
|
[],
|
|
8551
8570
|
source.slice(i)
|
|
@@ -8596,7 +8615,7 @@ require = function () {
|
|
|
8596
8615
|
];
|
|
8597
8616
|
case 0: {
|
|
8598
8617
|
const b = source[0] !== '\n' && source[0].trimStart() === '';
|
|
8599
|
-
const i = b || (0, text_1.isAlphanumeric)(source[0]) ? source.search(b ? text_1.nonWhitespace : text_1.nonAlphanumeric) : 1;
|
|
8618
|
+
const i = b || (0, text_1.isAlphanumeric)(source[0]) ? source.search(b ? text_1.nonWhitespace : text_1.nonAlphanumeric) || 1 : 1;
|
|
8600
8619
|
return [
|
|
8601
8620
|
[source.slice(0, i)],
|
|
8602
8621
|
source.slice(i)
|
|
@@ -8661,10 +8680,10 @@ require = function () {
|
|
|
8661
8680
|
'InvisibleComma',
|
|
8662
8681
|
'ic'
|
|
8663
8682
|
];
|
|
8664
|
-
const blankline = new RegExp(String.raw`^(?!$|\n)(
|
|
8683
|
+
const blankline = new RegExp(String.raw`^(?!$|\n)(?:\\?[^\S\n]|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr>|\[(#+)(?!\S|\s+\1\]|\s*\[\1(?:$|\s))((?:\s+\S+)+?)(?:\s+(\1\])|\s*(?=\[\1(?:$|\s))))*(?:\\?(?:$|\n)|(\S))`, 'gm');
|
|
8665
8684
|
function visualize(parser) {
|
|
8666
8685
|
return (0, combinator_1.union)([
|
|
8667
|
-
(0, combinator_1.convert)(source => source.replace(blankline, line => line.replace(/[\\&<\[]/g, '\x1B$&')), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))),
|
|
8686
|
+
(0, combinator_1.convert)(source => source.replace(blankline, (line, ...$) => !$[3] ? line.replace(/[\\&<\[]/g, '\x1B$&') : line), (0, combinator_1.verify)(parser, (ns, rest, context) => !rest && hasVisible(ns, context))),
|
|
8668
8687
|
(0, combinator_1.some)((0, combinator_1.union)([
|
|
8669
8688
|
source_1.linebreak,
|
|
8670
8689
|
source_1.unescsource
|
|
@@ -8944,12 +8963,16 @@ require = function () {
|
|
|
8944
8963
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
8945
8964
|
if (k2 === undefined)
|
|
8946
8965
|
k2 = k;
|
|
8947
|
-
Object.
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8966
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8967
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8968
|
+
desc = {
|
|
8969
|
+
enumerable: true,
|
|
8970
|
+
get: function () {
|
|
8971
|
+
return m[k];
|
|
8972
|
+
}
|
|
8973
|
+
};
|
|
8974
|
+
}
|
|
8975
|
+
Object.defineProperty(o, k2, desc);
|
|
8953
8976
|
} : function (o, m, k, k2) {
|
|
8954
8977
|
if (k2 === undefined)
|
|
8955
8978
|
k2 = k;
|
|
@@ -9258,11 +9281,12 @@ require = function () {
|
|
|
9258
9281
|
}
|
|
9259
9282
|
exports.youtube = youtube;
|
|
9260
9283
|
function resolve(url) {
|
|
9284
|
+
var _a;
|
|
9261
9285
|
switch (url.origin) {
|
|
9262
9286
|
case 'https://www.youtube.com':
|
|
9263
|
-
return url.pathname
|
|
9287
|
+
return url.pathname.match(/^\/watch\/?$/) ? (_a = url.searchParams.get('v')) === null || _a === void 0 ? void 0 : _a.concat(url.search.replace(/([?&])v=[^&#]*&?/g, '$1'), url.hash) : undefined;
|
|
9264
9288
|
case 'https://youtu.be':
|
|
9265
|
-
return url.pathname.match(/^\/[\w-]
|
|
9289
|
+
return url.pathname.match(/^\/[\w-]+\/?$/) ? url.href.slice(url.origin.length) : undefined;
|
|
9266
9290
|
default:
|
|
9267
9291
|
return;
|
|
9268
9292
|
}
|
|
@@ -9601,12 +9625,16 @@ require = function () {
|
|
|
9601
9625
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
9602
9626
|
if (k2 === undefined)
|
|
9603
9627
|
k2 = k;
|
|
9604
|
-
Object.
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9628
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9629
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9630
|
+
desc = {
|
|
9631
|
+
enumerable: true,
|
|
9632
|
+
get: function () {
|
|
9633
|
+
return m[k];
|
|
9634
|
+
}
|
|
9635
|
+
};
|
|
9636
|
+
}
|
|
9637
|
+
Object.defineProperty(o, k2, desc);
|
|
9610
9638
|
} : function (o, m, k, k2) {
|
|
9611
9639
|
if (k2 === undefined)
|
|
9612
9640
|
k2 = k;
|
package/gulpfile.js
CHANGED
|
@@ -98,7 +98,27 @@ gulp.task('ts:dev', () =>
|
|
|
98
98
|
gulp.task('ts:test', () =>
|
|
99
99
|
compile(config.ts.test.src)
|
|
100
100
|
.pipe($.rename({ extname: '.test.js' }))
|
|
101
|
-
.pipe(gulp.dest(config.ts.test.dest))
|
|
101
|
+
.pipe(gulp.dest(config.ts.test.dest))
|
|
102
|
+
.pipe($.eslint({
|
|
103
|
+
'parserOptions': {
|
|
104
|
+
'ecmaVersion': 2020,
|
|
105
|
+
},
|
|
106
|
+
'env': {
|
|
107
|
+
'es2020': true,
|
|
108
|
+
},
|
|
109
|
+
'plugins': ['redos'],
|
|
110
|
+
'rules': {
|
|
111
|
+
'redos/no-vulnerable': [
|
|
112
|
+
'error',
|
|
113
|
+
{
|
|
114
|
+
ignoreErrors: false,
|
|
115
|
+
timeout: 30000,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
}))
|
|
120
|
+
.pipe($.eslint.format())
|
|
121
|
+
.pipe($.eslint.failAfterError()));
|
|
102
122
|
|
|
103
123
|
gulp.task('ts:dist', () =>
|
|
104
124
|
compile(config.ts.dist.src)
|
package/markdown.d.ts
CHANGED
|
@@ -1050,8 +1050,6 @@ export namespace MarkdownParser {
|
|
|
1050
1050
|
AutolinkParser.UrlParser,
|
|
1051
1051
|
AutolinkParser.EmailParser,
|
|
1052
1052
|
SourceParser.StrParser,
|
|
1053
|
-
SourceParser.StrParser,
|
|
1054
|
-
SourceParser.StrParser,
|
|
1055
1053
|
AutolinkParser.ChannelParser,
|
|
1056
1054
|
AutolinkParser.AccountParser,
|
|
1057
1055
|
SourceParser.StrParser,
|