securemark 0.231.0 → 0.232.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/securemark.js +133 -103
- package/gulpfile.js +21 -1
- package/index.d.ts +2 -2
- package/markdown.d.ts +44 -42
- package/package-lock.json +934 -205
- package/package.json +9 -7
- package/src/debug.test.ts +1 -0
- package/src/parser/api/header.ts +1 -1
- package/src/parser/block/extension/table.ts +1 -1
- package/src/parser/block/paragraph.test.ts +4 -12
- package/src/parser/block/paragraph.ts +3 -17
- package/src/parser/block/{paragraph/mention → reply}/cite.test.ts +3 -3
- package/src/parser/block/{paragraph/mention → reply}/cite.ts +5 -5
- package/src/parser/block/{paragraph/mention → reply}/quote.test.ts +3 -3
- package/src/parser/block/{paragraph/mention → reply}/quote.ts +9 -9
- package/src/parser/block/reply.test.ts +22 -0
- package/src/parser/block/reply.ts +27 -0
- package/src/parser/block.ts +3 -0
- package/src/parser/inline/bracket.ts +2 -5
- 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 +3 -3
- package/src/parser/inline/ruby.ts +2 -2
- package/src/parser/util.ts +3 -3
- package/src/renderer/render/media/youtube.ts +4 -4
- package/src/util/info.test.ts +1 -1
- package/src/util/info.ts +2 -2
- package/src/util/quote.ts +1 -1
- package/src/util/scope.ts +3 -1
- package/src/parser/block/paragraph/mention.ts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.232.0
|
|
4
|
+
|
|
5
|
+
- Refine paragraph syntax to separate mention syntax.
|
|
6
|
+
- Rename mention syntax to reply syntax.
|
|
7
|
+
|
|
8
|
+
## 0.231.2
|
|
9
|
+
|
|
10
|
+
- Refactoring.
|
|
11
|
+
|
|
12
|
+
## 0.231.1
|
|
13
|
+
|
|
14
|
+
- Fix comment syntax.
|
|
15
|
+
- Fix ReDoS.
|
|
16
|
+
|
|
3
17
|
## 0.231.0
|
|
4
18
|
|
|
5
19
|
- Refine hashtag syntax.
|
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.
|
|
1
|
+
/*! securemark v0.232.0 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED */
|
|
2
2
|
require = function () {
|
|
3
3
|
function r(e, n, t) {
|
|
4
4
|
function o(i, f) {
|
|
@@ -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) {
|
|
@@ -4528,6 +4544,7 @@ require = function () {
|
|
|
4528
4544
|
const codeblock_1 = _dereq_('./block/codeblock');
|
|
4529
4545
|
const mathblock_1 = _dereq_('./block/mathblock');
|
|
4530
4546
|
const extension_1 = _dereq_('./block/extension');
|
|
4547
|
+
const reply_1 = _dereq_('./block/reply');
|
|
4531
4548
|
const paragraph_1 = _dereq_('./block/paragraph');
|
|
4532
4549
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
4533
4550
|
const random_1 = _dereq_('spica/random');
|
|
@@ -4544,6 +4561,7 @@ require = function () {
|
|
|
4544
4561
|
mathblock_1.mathblock,
|
|
4545
4562
|
extension_1.extension,
|
|
4546
4563
|
blockquote_1.blockquote,
|
|
4564
|
+
reply_1.reply,
|
|
4547
4565
|
paragraph_1.paragraph
|
|
4548
4566
|
]))));
|
|
4549
4567
|
function error(parser) {
|
|
@@ -4577,6 +4595,7 @@ require = function () {
|
|
|
4577
4595
|
'./block/mathblock': 79,
|
|
4578
4596
|
'./block/olist': 80,
|
|
4579
4597
|
'./block/paragraph': 81,
|
|
4598
|
+
'./block/reply': 82,
|
|
4580
4599
|
'./block/table': 85,
|
|
4581
4600
|
'./block/ulist': 86,
|
|
4582
4601
|
'./source': 128,
|
|
@@ -5291,7 +5310,7 @@ require = function () {
|
|
|
5291
5310
|
colspan,
|
|
5292
5311
|
...valid ? { 'data-highlight-level': +highlight > 1 ? highlight : global_1.undefined } : {
|
|
5293
5312
|
'data-invalid-syntax': 'table',
|
|
5294
|
-
'data-invalid-type': '
|
|
5313
|
+
'data-invalid-type': 'syntax',
|
|
5295
5314
|
'data-invalid-description': 'Too much highlight level.'
|
|
5296
5315
|
}
|
|
5297
5316
|
};
|
|
@@ -5760,31 +5779,17 @@ require = function () {
|
|
|
5760
5779
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5761
5780
|
exports.paragraph = void 0;
|
|
5762
5781
|
const combinator_1 = _dereq_('../../combinator');
|
|
5763
|
-
const mention_1 = _dereq_('./paragraph/mention');
|
|
5764
|
-
const quote_1 = _dereq_('./paragraph/mention/quote');
|
|
5765
5782
|
const inline_1 = _dereq_('../inline');
|
|
5766
|
-
const source_1 = _dereq_('../source');
|
|
5767
5783
|
const locale_1 = _dereq_('../locale');
|
|
5768
5784
|
const util_1 = _dereq_('../util');
|
|
5769
5785
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5770
|
-
|
|
5771
|
-
exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.subsequence)([
|
|
5772
|
-
(0, combinator_1.some)(mention_1.mention),
|
|
5773
|
-
(0, combinator_1.some)((0, combinator_1.union)([
|
|
5774
|
-
quote_1.quote,
|
|
5775
|
-
(0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, typed_dom_1.html)('br')]))
|
|
5776
|
-
]))
|
|
5777
|
-
]), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)((0, array_1.pop)(ns)[0]))])));
|
|
5786
|
+
exports.paragraph = (0, combinator_1.block)((0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline])))), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)(ns))])));
|
|
5778
5787
|
},
|
|
5779
5788
|
{
|
|
5780
5789
|
'../../combinator': 27,
|
|
5781
5790
|
'../inline': 88,
|
|
5782
5791
|
'../locale': 123,
|
|
5783
|
-
'../source': 128,
|
|
5784
5792
|
'../util': 134,
|
|
5785
|
-
'./paragraph/mention': 82,
|
|
5786
|
-
'./paragraph/mention/quote': 84,
|
|
5787
|
-
'spica/array': 6,
|
|
5788
5793
|
'typed-dom': 26
|
|
5789
5794
|
}
|
|
5790
5795
|
],
|
|
@@ -5792,19 +5797,37 @@ require = function () {
|
|
|
5792
5797
|
function (_dereq_, module, exports) {
|
|
5793
5798
|
'use strict';
|
|
5794
5799
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5795
|
-
exports.
|
|
5796
|
-
const combinator_1 = _dereq_('
|
|
5797
|
-
const cite_1 = _dereq_('./
|
|
5798
|
-
const quote_1 = _dereq_('./
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5800
|
+
exports.reply = void 0;
|
|
5801
|
+
const combinator_1 = _dereq_('../../combinator');
|
|
5802
|
+
const cite_1 = _dereq_('./reply/cite');
|
|
5803
|
+
const quote_1 = _dereq_('./reply/quote');
|
|
5804
|
+
const inline_1 = _dereq_('../inline');
|
|
5805
|
+
const source_1 = _dereq_('../source');
|
|
5806
|
+
const locale_1 = _dereq_('../locale');
|
|
5807
|
+
const util_1 = _dereq_('../util');
|
|
5808
|
+
const typed_dom_1 = _dereq_('typed-dom');
|
|
5809
|
+
const array_1 = _dereq_('spica/array');
|
|
5810
|
+
exports.reply = (0, combinator_1.block)((0, combinator_1.validate)('>', (0, locale_1.localize)((0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.inits)([
|
|
5811
|
+
(0, combinator_1.some)((0, combinator_1.inits)([
|
|
5812
|
+
cite_1.cite,
|
|
5813
|
+
quote_1.quote
|
|
5814
|
+
])),
|
|
5815
|
+
(0, combinator_1.subsequence)([
|
|
5816
|
+
(0, combinator_1.some)(quote_1.quote),
|
|
5817
|
+
(0, combinator_1.fmap)((0, combinator_1.rewrite)((0, combinator_1.some)(source_1.anyline, quote_1.syntax), (0, combinator_1.trim)((0, util_1.visualize)((0, combinator_1.some)(inline_1.inline)))), ns => (0, array_1.push)(ns, [(0, typed_dom_1.html)('br')]))
|
|
5818
|
+
])
|
|
5819
|
+
])), ns => [(0, typed_dom_1.html)('p', (0, typed_dom_1.defrag)((0, array_1.pop)(ns)[0]))]))));
|
|
5803
5820
|
},
|
|
5804
5821
|
{
|
|
5805
|
-
'
|
|
5806
|
-
'
|
|
5807
|
-
'
|
|
5822
|
+
'../../combinator': 27,
|
|
5823
|
+
'../inline': 88,
|
|
5824
|
+
'../locale': 123,
|
|
5825
|
+
'../source': 128,
|
|
5826
|
+
'../util': 134,
|
|
5827
|
+
'./reply/cite': 83,
|
|
5828
|
+
'./reply/quote': 84,
|
|
5829
|
+
'spica/array': 6,
|
|
5830
|
+
'typed-dom': 26
|
|
5808
5831
|
}
|
|
5809
5832
|
],
|
|
5810
5833
|
83: [
|
|
@@ -5812,9 +5835,9 @@ require = function () {
|
|
|
5812
5835
|
'use strict';
|
|
5813
5836
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5814
5837
|
exports.cite = void 0;
|
|
5815
|
-
const combinator_1 = _dereq_('
|
|
5816
|
-
const anchor_1 = _dereq_('
|
|
5817
|
-
const source_1 = _dereq_('
|
|
5838
|
+
const combinator_1 = _dereq_('../../../combinator');
|
|
5839
|
+
const anchor_1 = _dereq_('../../inline/autolink/anchor');
|
|
5840
|
+
const source_1 = _dereq_('../../source');
|
|
5818
5841
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5819
5842
|
exports.cite = (0, combinator_1.creator)((0, combinator_1.line)((0, combinator_1.fmap)((0, combinator_1.validate)('>>', (0, combinator_1.reverse)((0, combinator_1.tails)([
|
|
5820
5843
|
(0, source_1.str)(/^>*(?=>>)/),
|
|
@@ -5828,9 +5851,9 @@ require = function () {
|
|
|
5828
5851
|
])));
|
|
5829
5852
|
},
|
|
5830
5853
|
{
|
|
5831
|
-
'
|
|
5832
|
-
'
|
|
5833
|
-
'
|
|
5854
|
+
'../../../combinator': 27,
|
|
5855
|
+
'../../inline/autolink/anchor': 92,
|
|
5856
|
+
'../../source': 128,
|
|
5834
5857
|
'typed-dom': 26
|
|
5835
5858
|
}
|
|
5836
5859
|
],
|
|
@@ -5839,11 +5862,11 @@ require = function () {
|
|
|
5839
5862
|
'use strict';
|
|
5840
5863
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5841
5864
|
exports.quote = exports.syntax = void 0;
|
|
5842
|
-
const parser_1 = _dereq_('
|
|
5843
|
-
const combinator_1 = _dereq_('
|
|
5844
|
-
const math_1 = _dereq_('
|
|
5845
|
-
const source_1 = _dereq_('
|
|
5846
|
-
const autolink_1 = _dereq_('
|
|
5865
|
+
const parser_1 = _dereq_('../../../combinator/data/parser');
|
|
5866
|
+
const combinator_1 = _dereq_('../../../combinator');
|
|
5867
|
+
const math_1 = _dereq_('../../inline/math');
|
|
5868
|
+
const source_1 = _dereq_('../../source');
|
|
5869
|
+
const autolink_1 = _dereq_('../../autolink');
|
|
5847
5870
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
5848
5871
|
exports.syntax = /^>+(?=[^\S\n])|^>(?=[^\s>])|^>+(?=[^\s>])(?![0-9a-z]+(?:-[0-9a-z]+)*(?![0-9A-Za-z@#:]))/;
|
|
5849
5872
|
exports.quote = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.validate)('>', (0, combinator_1.union)([
|
|
@@ -5896,11 +5919,11 @@ require = function () {
|
|
|
5896
5919
|
]);
|
|
5897
5920
|
},
|
|
5898
5921
|
{
|
|
5899
|
-
'
|
|
5900
|
-
'
|
|
5901
|
-
'
|
|
5902
|
-
'
|
|
5903
|
-
'
|
|
5922
|
+
'../../../combinator': 27,
|
|
5923
|
+
'../../../combinator/data/parser': 47,
|
|
5924
|
+
'../../autolink': 62,
|
|
5925
|
+
'../../inline/math': 116,
|
|
5926
|
+
'../../source': 128,
|
|
5904
5927
|
'typed-dom': 26
|
|
5905
5928
|
}
|
|
5906
5929
|
],
|
|
@@ -6501,10 +6524,7 @@ require = function () {
|
|
|
6501
6524
|
const source_1 = _dereq_('../source');
|
|
6502
6525
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6503
6526
|
const array_1 = _dereq_('spica/array');
|
|
6504
|
-
const index =
|
|
6505
|
-
/(?:0|[1-9]\d*)(?:\.(?:0|[1-9]\d*))+/,
|
|
6506
|
-
/[0-9]{1,4}|[A-Za-z]/
|
|
6507
|
-
].map(r => r.source).join('|') })`);
|
|
6527
|
+
const index = /^(?:[0-9]+(?:\.[0-9]+)*|[A-Za-z])/;
|
|
6508
6528
|
const indexFW = new RegExp(index.source.replace(/[019AZaz](?!,)/g, c => String.fromCharCode(c.charCodeAt(0) + 65248)));
|
|
6509
6529
|
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([
|
|
6510
6530
|
(0, combinator_1.surround)((0, source_1.str)('('), (0, source_1.str)(index), (0, source_1.str)(')'), false, ([as, bs = [], cs], rest) => [
|
|
@@ -6582,8 +6602,8 @@ require = function () {
|
|
|
6582
6602
|
const htmlentity_1 = _dereq_('./htmlentity');
|
|
6583
6603
|
const source_1 = _dereq_('../source');
|
|
6584
6604
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6585
|
-
exports.comment = (0, combinator_1.creator)((0, combinator_1.validate)('[#', (0, combinator_1.match)(/^\[(#+)
|
|
6586
|
-
[whole, body] = `${ whole }\0${ body.
|
|
6605
|
+
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) => {
|
|
6606
|
+
[whole, body] = `${ whole }\0${ body.trimStart() }`.replace(/\x1B/g, '').split('\0', 2);
|
|
6587
6607
|
if (!closer)
|
|
6588
6608
|
return [
|
|
6589
6609
|
[(0, typed_dom_1.html)('sup', {
|
|
@@ -7124,7 +7144,7 @@ require = function () {
|
|
|
7124
7144
|
rest
|
|
7125
7145
|
] : global_1.undefined)), ([, tag]) => tag, new cache_1.Cache(1000)))
|
|
7126
7146
|
])))));
|
|
7127
|
-
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[
|
|
7147
|
+
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|>)/)]);
|
|
7128
7148
|
function elem(tag, as, bs, cs, context) {
|
|
7129
7149
|
var _a, _b, _c, _d, _e, _f;
|
|
7130
7150
|
if (!tags.includes(tag))
|
|
@@ -7305,7 +7325,7 @@ require = function () {
|
|
|
7305
7325
|
if ((_a = (0, parser_1.eval)((0, combinator_1.some)(autolink_1.autolink)((0, util_1.stringify)(content), context))) === null || _a === void 0 ? void 0 : _a.some(node => typeof node === 'object'))
|
|
7306
7326
|
return;
|
|
7307
7327
|
const INSECURE_URI = params.shift();
|
|
7308
|
-
const el =
|
|
7328
|
+
const el = elem(INSECURE_URI, (0, util_1.trimNode)((0, typed_dom_1.defrag)(content)), new url_1.ReadonlyURL(resolve(INSECURE_URI, (_b = context.host) !== null && _b !== void 0 ? _b : global_1.location, (_d = (_c = context.url) !== null && _c !== void 0 ? _c : context.host) !== null && _d !== void 0 ? _d : global_1.location), ((_e = context.host) === null || _e === void 0 ? void 0 : _e.href) || global_1.location.href), ((_f = context.host) === null || _f === void 0 ? void 0 : _f.origin) || global_1.location.origin);
|
|
7309
7329
|
if (el.classList.contains('invalid'))
|
|
7310
7330
|
return [
|
|
7311
7331
|
[el],
|
|
@@ -7322,7 +7342,7 @@ require = function () {
|
|
|
7322
7342
|
]);
|
|
7323
7343
|
exports.option = (0, combinator_1.union)([
|
|
7324
7344
|
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+nofollow(?=[^\S\n]|})/), () => [` rel="nofollow"`]),
|
|
7325
|
-
(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[
|
|
7345
|
+
(0, source_1.str)(/^[^\S\n]+[a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[^\S\n]|})/),
|
|
7326
7346
|
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+(?=})/), () => []),
|
|
7327
7347
|
(0, combinator_1.fmap)((0, source_1.str)(/^[^\S\n]+[^\n{}]+/), opt => [` \\${ opt.slice(1) }`])
|
|
7328
7348
|
]);
|
|
@@ -7340,7 +7360,7 @@ require = function () {
|
|
|
7340
7360
|
}
|
|
7341
7361
|
}
|
|
7342
7362
|
exports.resolve = resolve;
|
|
7343
|
-
function
|
|
7363
|
+
function elem(INSECURE_URI, content, uri, origin) {
|
|
7344
7364
|
let type;
|
|
7345
7365
|
let description;
|
|
7346
7366
|
switch (uri.protocol) {
|
|
@@ -7700,8 +7720,8 @@ require = function () {
|
|
|
7700
7720
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7701
7721
|
const array_1 = _dereq_('spica/array');
|
|
7702
7722
|
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)([
|
|
7703
|
-
(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[
|
|
7704
|
-
(0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[
|
|
7723
|
+
(0, combinator_1.surround)('[', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\[\]\n])+(?=]\()/, text), ']'),
|
|
7724
|
+
(0, combinator_1.surround)('(', (0, combinator_1.focus)(/^(?:\\[^\n]|[^\\\(\)\n])+(?=\))/, text), ')')
|
|
7705
7725
|
])), ([texts]) => (0, util_1.isStartTightNodes)(texts)), ([texts, rubies], rest) => {
|
|
7706
7726
|
const tail = typeof texts[texts.length - 1] === 'object' ? [texts.pop()] : [];
|
|
7707
7727
|
tail.length === 0 && texts[texts.length - 1] === '' && texts.pop();
|
|
@@ -8667,10 +8687,10 @@ require = function () {
|
|
|
8667
8687
|
'InvisibleComma',
|
|
8668
8688
|
'ic'
|
|
8669
8689
|
];
|
|
8670
|
-
const blankline = new RegExp(String.raw`^(
|
|
8690
|
+
const blankline = new RegExp(String.raw`^(?!$)(?:\\$|\\?[^\S\n]|&(?:${ invisibleHTMLEntityNames.join('|') });|<wbr>|\[(#+)(?!\S|\s+\1\]|\s*\[\1(?:$|\s))((?:\s+\S+)+?)(?:\s+(\1\])|\s*(?=\[\1(?:$|\s))))+(?=$|(\S))`, 'gm');
|
|
8671
8691
|
function visualize(parser) {
|
|
8672
8692
|
return (0, combinator_1.union)([
|
|
8673
|
-
(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))),
|
|
8693
|
+
(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))),
|
|
8674
8694
|
(0, combinator_1.some)((0, combinator_1.union)([
|
|
8675
8695
|
source_1.linebreak,
|
|
8676
8696
|
source_1.unescsource
|
|
@@ -8950,12 +8970,16 @@ require = function () {
|
|
|
8950
8970
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
8951
8971
|
if (k2 === undefined)
|
|
8952
8972
|
k2 = k;
|
|
8953
|
-
Object.
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8973
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8974
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8975
|
+
desc = {
|
|
8976
|
+
enumerable: true,
|
|
8977
|
+
get: function () {
|
|
8978
|
+
return m[k];
|
|
8979
|
+
}
|
|
8980
|
+
};
|
|
8981
|
+
}
|
|
8982
|
+
Object.defineProperty(o, k2, desc);
|
|
8959
8983
|
} : function (o, m, k, k2) {
|
|
8960
8984
|
if (k2 === undefined)
|
|
8961
8985
|
k2 = k;
|
|
@@ -9264,11 +9288,12 @@ require = function () {
|
|
|
9264
9288
|
}
|
|
9265
9289
|
exports.youtube = youtube;
|
|
9266
9290
|
function resolve(url) {
|
|
9291
|
+
var _a;
|
|
9267
9292
|
switch (url.origin) {
|
|
9268
9293
|
case 'https://www.youtube.com':
|
|
9269
|
-
return url.pathname
|
|
9294
|
+
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;
|
|
9270
9295
|
case 'https://youtu.be':
|
|
9271
|
-
return url.pathname.match(/^\/[\w-]
|
|
9296
|
+
return url.pathname.match(/^\/[\w-]+\/?$/) ? url.href.slice(url.origin.length) : undefined;
|
|
9272
9297
|
default:
|
|
9273
9298
|
return;
|
|
9274
9299
|
}
|
|
@@ -9332,7 +9357,7 @@ require = function () {
|
|
|
9332
9357
|
exports.info = void 0;
|
|
9333
9358
|
const scope_1 = _dereq_('./scope');
|
|
9334
9359
|
function info(source) {
|
|
9335
|
-
const match = (0, scope_1.scope)(source, '
|
|
9360
|
+
const match = (0, scope_1.scope)(source, '.invalid');
|
|
9336
9361
|
return {
|
|
9337
9362
|
url: find('a:not(.email):not(.account):not(.channel):not(.hashtag):not(.hashnum):not(.anchor)').filter(el => [
|
|
9338
9363
|
'http:',
|
|
@@ -9344,7 +9369,7 @@ require = function () {
|
|
|
9344
9369
|
channel: find('a.channel'),
|
|
9345
9370
|
hashtag: find('a.hashtag'),
|
|
9346
9371
|
hashnum: find('a.hashnum'),
|
|
9347
|
-
|
|
9372
|
+
reply: find('.cite > a.anchor'),
|
|
9348
9373
|
anchor: find(':not(.cite) > a.anchor'),
|
|
9349
9374
|
media: find('.media[data-src]')
|
|
9350
9375
|
};
|
|
@@ -9369,7 +9394,7 @@ require = function () {
|
|
|
9369
9394
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9370
9395
|
exports.quote = void 0;
|
|
9371
9396
|
const parser_1 = _dereq_('../combinator/data/parser');
|
|
9372
|
-
const cite_1 = _dereq_('../parser/block/
|
|
9397
|
+
const cite_1 = _dereq_('../parser/block/reply/cite');
|
|
9373
9398
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
9374
9399
|
function quote(anchor, range) {
|
|
9375
9400
|
var _a, _b;
|
|
@@ -9448,7 +9473,7 @@ require = function () {
|
|
|
9448
9473
|
},
|
|
9449
9474
|
{
|
|
9450
9475
|
'../combinator/data/parser': 47,
|
|
9451
|
-
'../parser/block/
|
|
9476
|
+
'../parser/block/reply/cite': 83,
|
|
9452
9477
|
'typed-dom': 26
|
|
9453
9478
|
}
|
|
9454
9479
|
],
|
|
@@ -9458,7 +9483,8 @@ require = function () {
|
|
|
9458
9483
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9459
9484
|
exports.scope = void 0;
|
|
9460
9485
|
const global_1 = _dereq_('spica/global');
|
|
9461
|
-
function scope(base, bound = `${ 'id' in base && base.id ? `#${ base.id }, ` : '' }section, article, aside, blockquote`) {
|
|
9486
|
+
function scope(base, filter = '', bound = `${ 'id' in base && base.id ? `#${ base.id }, ` : '' }section, article, aside, blockquote, pre, .quote, .math, .media`) {
|
|
9487
|
+
bound += filter && `, ${ filter }`;
|
|
9462
9488
|
const memory = new global_1.WeakMap();
|
|
9463
9489
|
const context = 'id' in base && base.closest(bound) || null;
|
|
9464
9490
|
return el => {
|
|
@@ -9607,12 +9633,16 @@ require = function () {
|
|
|
9607
9633
|
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
9608
9634
|
if (k2 === undefined)
|
|
9609
9635
|
k2 = k;
|
|
9610
|
-
Object.
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9636
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9637
|
+
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9638
|
+
desc = {
|
|
9639
|
+
enumerable: true,
|
|
9640
|
+
get: function () {
|
|
9641
|
+
return m[k];
|
|
9642
|
+
}
|
|
9643
|
+
};
|
|
9644
|
+
}
|
|
9645
|
+
Object.defineProperty(o, k2, desc);
|
|
9616
9646
|
} : function (o, m, k, k2) {
|
|
9617
9647
|
if (k2 === undefined)
|
|
9618
9648
|
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/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export function normalize(source: string): string;
|
|
|
22
22
|
export function quote(anchor: string, range: Range): string;
|
|
23
23
|
export function toc(source: DocumentFragment | HTMLElement | ShadowRoot): HTMLUListElement;
|
|
24
24
|
export function info(source: DocumentFragment | HTMLElement | ShadowRoot): Info;
|
|
25
|
-
export function scope(base: DocumentFragment | HTMLElement | ShadowRoot, bound?: string): (el: Element) => boolean;
|
|
25
|
+
export function scope(base: DocumentFragment | HTMLElement | ShadowRoot, filter?: string, bound?: string): (el: Element) => boolean;
|
|
26
26
|
export function sync(editor: HTMLElement, viewer: HTMLElement, bottom?: Element | null): () => void;
|
|
27
27
|
|
|
28
28
|
export type ParserOptions = Omit<Partial<ParserSettings>, 'chunk'>;
|
|
@@ -76,7 +76,7 @@ export interface Info {
|
|
|
76
76
|
readonly channel: HTMLAnchorElement[];
|
|
77
77
|
readonly hashtag: HTMLAnchorElement[];
|
|
78
78
|
readonly hashnum: HTMLAnchorElement[];
|
|
79
|
-
readonly
|
|
79
|
+
readonly reply: HTMLAnchorElement[];
|
|
80
80
|
readonly anchor: HTMLAnchorElement[];
|
|
81
81
|
readonly media: HTMLElement[];
|
|
82
82
|
}
|