securemark 0.235.2 → 0.235.3
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 +4 -0
- package/dist/securemark.js +46 -28
- package/package-lock.json +30 -54
- package/package.json +3 -3
- package/src/parser/block/paragraph.test.ts +1 -1
- package/src/parser/inline/deletion.ts +1 -1
- package/src/parser/inline/emphasis.ts +1 -1
- package/src/parser/inline/emstrong.ts +3 -3
- package/src/parser/inline/htmlentity.test.ts +1 -1
- package/src/parser/inline/htmlentity.ts +17 -10
- package/src/parser/inline/insertion.ts +1 -1
- package/src/parser/inline/mark.ts +1 -1
- package/src/parser/inline/ruby.ts +1 -1
- package/src/parser/inline/strong.ts +1 -1
- package/src/parser/util.ts +1 -1
package/CHANGELOG.md
CHANGED
package/dist/securemark.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.235.
|
|
1
|
+
/*! securemark v0.235.3 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) {
|
|
@@ -2344,6 +2344,7 @@ require = function () {
|
|
|
2344
2344
|
'use strict';
|
|
2345
2345
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2346
2346
|
exports.SVG = exports.HTML = exports.Shadow = exports.API = void 0;
|
|
2347
|
+
const global_1 = _dereq_('spica/global');
|
|
2347
2348
|
const alias_1 = _dereq_('spica/alias');
|
|
2348
2349
|
const proxy_1 = _dereq_('./proxy');
|
|
2349
2350
|
const dom_1 = _dereq_('./util/dom');
|
|
@@ -2363,22 +2364,24 @@ require = function () {
|
|
|
2363
2364
|
};
|
|
2364
2365
|
function builder(tag, baseFactory) {
|
|
2365
2366
|
return function build(attrs, children, factory) {
|
|
2366
|
-
if (typeof attrs === 'function')
|
|
2367
|
-
return build(void 0, void 0, attrs);
|
|
2368
2367
|
if (typeof children === 'function')
|
|
2369
2368
|
return build(attrs, void 0, children);
|
|
2370
|
-
if (attrs
|
|
2369
|
+
if (typeof attrs === 'function')
|
|
2370
|
+
return build(void 0, void 0, attrs);
|
|
2371
|
+
if (isElChildren(attrs))
|
|
2371
2372
|
return build(void 0, attrs, factory);
|
|
2372
2373
|
const node = formatter(elem(factory, attrs, children));
|
|
2373
2374
|
return node.nodeType === 1 ? new proxy_1.Elem(node, children) : new proxy_1.Elem(node.host, children, node);
|
|
2374
2375
|
};
|
|
2375
|
-
function isElChildren(
|
|
2376
|
-
if (
|
|
2376
|
+
function isElChildren(param) {
|
|
2377
|
+
if (param === void 0)
|
|
2378
|
+
return false;
|
|
2379
|
+
if (param[global_1.Symbol.iterator])
|
|
2377
2380
|
return true;
|
|
2378
|
-
for (const i in
|
|
2379
|
-
if (!(0, alias_1.hasOwnProperty)(
|
|
2381
|
+
for (const i in param) {
|
|
2382
|
+
if (!(0, alias_1.hasOwnProperty)(param, i))
|
|
2380
2383
|
continue;
|
|
2381
|
-
return typeof
|
|
2384
|
+
return typeof param[i] === 'object' && !!param[i];
|
|
2382
2385
|
}
|
|
2383
2386
|
return true;
|
|
2384
2387
|
}
|
|
@@ -2394,7 +2397,8 @@ require = function () {
|
|
|
2394
2397
|
{
|
|
2395
2398
|
'./proxy': 14,
|
|
2396
2399
|
'./util/dom': 15,
|
|
2397
|
-
'spica/alias': 4
|
|
2400
|
+
'spica/alias': 4,
|
|
2401
|
+
'spica/global': 8
|
|
2398
2402
|
}
|
|
2399
2403
|
],
|
|
2400
2404
|
14: [
|
|
@@ -2808,8 +2812,8 @@ require = function () {
|
|
|
2808
2812
|
node.replaceChildren(...typeof children === 'string' ? [children] : children);
|
|
2809
2813
|
return node;
|
|
2810
2814
|
}
|
|
2811
|
-
function isChildren(
|
|
2812
|
-
return !!(
|
|
2815
|
+
function isChildren(param) {
|
|
2816
|
+
return !!(param === null || param === void 0 ? void 0 : param[global_1.Symbol.iterator]);
|
|
2813
2817
|
}
|
|
2814
2818
|
exports.isChildren = isChildren;
|
|
2815
2819
|
function defrag(nodes) {
|
|
@@ -6709,7 +6713,7 @@ require = function () {
|
|
|
6709
6713
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6710
6714
|
const array_1 = _dereq_('spica/array');
|
|
6711
6715
|
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('~~'), (0, combinator_1.some)((0, combinator_1.union)([
|
|
6712
|
-
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/,
|
|
6716
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/, '~~')),
|
|
6713
6717
|
(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, '~'), true)
|
|
6714
6718
|
])), (0, source_1.str)('~~'), false, ([, bs], rest) => [
|
|
6715
6719
|
[(0, typed_dom_1.html)('del', (0, typed_dom_1.defrag)(bs))],
|
|
@@ -6742,7 +6746,7 @@ require = function () {
|
|
|
6742
6746
|
const array_1 = _dereq_('spica/array');
|
|
6743
6747
|
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('*'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
6744
6748
|
strong_1.strong,
|
|
6745
|
-
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('',
|
|
6749
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '*')),
|
|
6746
6750
|
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
6747
6751
|
])), '*'), (0, source_1.str)('*'), false, ([, bs], rest) => [
|
|
6748
6752
|
[(0, typed_dom_1.html)('em', (0, typed_dom_1.defrag)(bs))],
|
|
@@ -6775,16 +6779,16 @@ require = function () {
|
|
|
6775
6779
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
6776
6780
|
const array_1 = _dereq_('spica/array');
|
|
6777
6781
|
const substrong = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([
|
|
6778
|
-
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('',
|
|
6782
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '**')),
|
|
6779
6783
|
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
6780
6784
|
])));
|
|
6781
6785
|
const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, combinator_1.union)([
|
|
6782
6786
|
strong_1.strong,
|
|
6783
|
-
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('',
|
|
6787
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '*')),
|
|
6784
6788
|
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
6785
6789
|
])));
|
|
6786
6790
|
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('***'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
6787
|
-
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('',
|
|
6791
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '*')),
|
|
6788
6792
|
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
6789
6793
|
]))), (0, source_1.str)(/^\*{1,3}/), false, ([, bs, cs], rest, context) => {
|
|
6790
6794
|
var _a, _b;
|
|
@@ -7309,21 +7313,35 @@ require = function () {
|
|
|
7309
7313
|
'use strict';
|
|
7310
7314
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7311
7315
|
exports.htmlentity = exports.unsafehtmlentity = void 0;
|
|
7316
|
+
const global_1 = _dereq_('spica/global');
|
|
7312
7317
|
const combinator_1 = _dereq_('../../combinator');
|
|
7313
7318
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
+
const memoize_1 = _dereq_('spica/memoize');
|
|
7320
|
+
exports.unsafehtmlentity = (0, combinator_1.creator)((0, combinator_1.validate)('&', (0, combinator_1.focus)(/^&[0-9A-Za-z]+;/, entity => {
|
|
7321
|
+
var _a;
|
|
7322
|
+
return [
|
|
7323
|
+
[(_a = parse(entity)) !== null && _a !== void 0 ? _a : `\0${ entity }`],
|
|
7324
|
+
''
|
|
7325
|
+
];
|
|
7326
|
+
})));
|
|
7327
|
+
exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([test]) => [test[0] === '\0' ? (0, typed_dom_1.html)('span', {
|
|
7319
7328
|
class: 'invalid',
|
|
7320
7329
|
'data-invalid-syntax': 'htmlentity',
|
|
7321
7330
|
'data-invalid-type': 'syntax',
|
|
7322
7331
|
'data-invalid-description': 'Invalid HTML entity.'
|
|
7323
|
-
},
|
|
7332
|
+
}, test.slice(1)) : test]);
|
|
7333
|
+
const parse = (0, memoize_1.reduce)((el => entity => {
|
|
7334
|
+
if (entity === '
')
|
|
7335
|
+
return ' ';
|
|
7336
|
+
el.innerHTML = entity;
|
|
7337
|
+
const text = el.textContent;
|
|
7338
|
+
return entity === text ? global_1.undefined : text;
|
|
7339
|
+
})((0, typed_dom_1.html)('b')));
|
|
7324
7340
|
},
|
|
7325
7341
|
{
|
|
7326
7342
|
'../../combinator': 27,
|
|
7343
|
+
'spica/global': 15,
|
|
7344
|
+
'spica/memoize': 18,
|
|
7327
7345
|
'typed-dom': 26
|
|
7328
7346
|
}
|
|
7329
7347
|
],
|
|
@@ -7339,7 +7357,7 @@ require = function () {
|
|
|
7339
7357
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7340
7358
|
const array_1 = _dereq_('spica/array');
|
|
7341
7359
|
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('++'), (0, combinator_1.some)((0, combinator_1.union)([
|
|
7342
|
-
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/,
|
|
7360
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)(/\n?/, '++')),
|
|
7343
7361
|
(0, combinator_1.open)(/^\n?/, (0, combinator_1.some)(inline_1.inline, '+'), true)
|
|
7344
7362
|
])), (0, source_1.str)('++'), false, ([, bs], rest) => [
|
|
7345
7363
|
[(0, typed_dom_1.html)('ins', (0, typed_dom_1.defrag)(bs))],
|
|
@@ -7513,7 +7531,7 @@ require = function () {
|
|
|
7513
7531
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7514
7532
|
const array_1 = _dereq_('spica/array');
|
|
7515
7533
|
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('=='), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
7516
|
-
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('',
|
|
7534
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '==')),
|
|
7517
7535
|
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '='), inline_1.inline)
|
|
7518
7536
|
]))), (0, source_1.str)('=='), false, ([, bs], rest) => [
|
|
7519
7537
|
[(0, typed_dom_1.html)('mark', (0, typed_dom_1.defrag)(bs))],
|
|
@@ -7873,7 +7891,7 @@ require = function () {
|
|
|
7873
7891
|
rubies
|
|
7874
7892
|
]) {
|
|
7875
7893
|
for (let i = 0; i < ss.length; ++i) {
|
|
7876
|
-
if (
|
|
7894
|
+
if (ss[i].indexOf('\0') === -1)
|
|
7877
7895
|
continue;
|
|
7878
7896
|
ss[i] = ss[i].replace(/\0/g, '');
|
|
7879
7897
|
attrs !== null && attrs !== void 0 ? attrs : attrs = {
|
|
@@ -7929,7 +7947,7 @@ require = function () {
|
|
|
7929
7947
|
const typed_dom_1 = _dereq_('typed-dom');
|
|
7930
7948
|
const array_1 = _dereq_('spica/array');
|
|
7931
7949
|
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.creator)((0, combinator_1.surround)((0, source_1.str)('**'), (0, util_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([
|
|
7932
|
-
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('',
|
|
7950
|
+
(0, combinator_1.some)(inline_1.inline, (0, util_1.blank)('', '**')),
|
|
7933
7951
|
(0, combinator_1.open)((0, combinator_1.some)(inline_1.inline, '*'), inline_1.inline)
|
|
7934
7952
|
])), '*'), (0, source_1.str)('**'), false, ([, bs], rest) => [
|
|
7935
7953
|
[(0, typed_dom_1.html)('strong', (0, typed_dom_1.defrag)(bs))],
|
|
@@ -8729,7 +8747,7 @@ require = function () {
|
|
|
8729
8747
|
const memoize_1 = _dereq_('spica/memoize');
|
|
8730
8748
|
const array_1 = _dereq_('spica/array');
|
|
8731
8749
|
function blank(prefix, suffix) {
|
|
8732
|
-
return new RegExp(String.raw`^${ prefix && prefix.source }(?:\\\s|[^\S\n]+|\n|&(?:${ normalize_1.invisibleHTMLEntityNames.join('|') });|<wbr>)?${ typeof suffix === 'string' ? suffix : suffix.source }`);
|
|
8750
|
+
return new RegExp(String.raw`^${ prefix && prefix.source }(?:\\\s|[^\S\n]+|\n|&(?:${ normalize_1.invisibleHTMLEntityNames.join('|') });|<wbr>)?${ typeof suffix === 'string' ? suffix.replace(/[*+()\[\]]/g, '\\$&') : suffix.source }`);
|
|
8733
8751
|
}
|
|
8734
8752
|
exports.blank = blank;
|
|
8735
8753
|
function visualize(parser) {
|
package/package-lock.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.235.
|
|
3
|
+
"version": "0.235.3",
|
|
4
4
|
"lockfileVersion": 1,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"dependencies": {
|
|
@@ -448,12 +448,6 @@
|
|
|
448
448
|
"which": "^2.0.2"
|
|
449
449
|
},
|
|
450
450
|
"dependencies": {
|
|
451
|
-
"lru-cache": {
|
|
452
|
-
"version": "7.7.3",
|
|
453
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
|
|
454
|
-
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==",
|
|
455
|
-
"dev": true
|
|
456
|
-
},
|
|
457
451
|
"mkdirp": {
|
|
458
452
|
"version": "1.0.4",
|
|
459
453
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
|
@@ -1800,12 +1794,6 @@
|
|
|
1800
1794
|
"unique-filename": "^1.1.1"
|
|
1801
1795
|
},
|
|
1802
1796
|
"dependencies": {
|
|
1803
|
-
"lru-cache": {
|
|
1804
|
-
"version": "7.7.3",
|
|
1805
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
|
|
1806
|
-
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==",
|
|
1807
|
-
"dev": true
|
|
1808
|
-
},
|
|
1809
1797
|
"mkdirp": {
|
|
1810
1798
|
"version": "1.0.4",
|
|
1811
1799
|
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
|
|
@@ -7069,13 +7057,10 @@
|
|
|
7069
7057
|
"dev": true
|
|
7070
7058
|
},
|
|
7071
7059
|
"lru-cache": {
|
|
7072
|
-
"version": "
|
|
7073
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-
|
|
7074
|
-
"integrity": "sha512-
|
|
7075
|
-
"dev": true
|
|
7076
|
-
"requires": {
|
|
7077
|
-
"yallist": "^4.0.0"
|
|
7078
|
-
}
|
|
7060
|
+
"version": "7.7.3",
|
|
7061
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
|
|
7062
|
+
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==",
|
|
7063
|
+
"dev": true
|
|
7079
7064
|
},
|
|
7080
7065
|
"make-dir": {
|
|
7081
7066
|
"version": "3.1.0",
|
|
@@ -7116,14 +7101,6 @@
|
|
|
7116
7101
|
"promise-retry": "^2.0.1",
|
|
7117
7102
|
"socks-proxy-agent": "^6.1.1",
|
|
7118
7103
|
"ssri": "^8.0.1"
|
|
7119
|
-
},
|
|
7120
|
-
"dependencies": {
|
|
7121
|
-
"lru-cache": {
|
|
7122
|
-
"version": "7.7.3",
|
|
7123
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
|
|
7124
|
-
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==",
|
|
7125
|
-
"dev": true
|
|
7126
|
-
}
|
|
7127
7104
|
}
|
|
7128
7105
|
},
|
|
7129
7106
|
"make-iterator": {
|
|
@@ -8007,9 +7984,9 @@
|
|
|
8007
7984
|
}
|
|
8008
7985
|
},
|
|
8009
7986
|
"npm-check-updates": {
|
|
8010
|
-
"version": "12.5.
|
|
8011
|
-
"resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-12.5.
|
|
8012
|
-
"integrity": "sha512-
|
|
7987
|
+
"version": "12.5.5",
|
|
7988
|
+
"resolved": "https://registry.npmjs.org/npm-check-updates/-/npm-check-updates-12.5.5.tgz",
|
|
7989
|
+
"integrity": "sha512-7LH6KN6F1fZMtY4zNYAQPpJU1ToxZ6sSCxk948vrLIz97aNqmPLSX72MrmbOWwpyBgLCPbFJWY/k3zE18pmxfw==",
|
|
8013
7990
|
"dev": true,
|
|
8014
7991
|
"requires": {
|
|
8015
7992
|
"chalk": "^4.1.2",
|
|
@@ -8021,7 +7998,7 @@
|
|
|
8021
7998
|
"fp-and-or": "^0.1.3",
|
|
8022
7999
|
"get-stdin": "^8.0.0",
|
|
8023
8000
|
"globby": "^11.0.4",
|
|
8024
|
-
"hosted-git-info": "^
|
|
8001
|
+
"hosted-git-info": "^5.0.0",
|
|
8025
8002
|
"json-parse-helpfulerror": "^1.0.3",
|
|
8026
8003
|
"jsonlines": "^0.1.1",
|
|
8027
8004
|
"libnpmconfig": "^1.2.1",
|
|
@@ -8063,12 +8040,12 @@
|
|
|
8063
8040
|
}
|
|
8064
8041
|
},
|
|
8065
8042
|
"hosted-git-info": {
|
|
8066
|
-
"version": "
|
|
8067
|
-
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-
|
|
8068
|
-
"integrity": "sha512-
|
|
8043
|
+
"version": "5.0.0",
|
|
8044
|
+
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-5.0.0.tgz",
|
|
8045
|
+
"integrity": "sha512-rRnjWu0Bxj+nIfUOkz0695C0H6tRrN5iYIzYejb0tDEefe2AekHu/U5Kn9pEie5vsJqpNQU02az7TGSH3qpz4Q==",
|
|
8069
8046
|
"dev": true,
|
|
8070
8047
|
"requires": {
|
|
8071
|
-
"lru-cache": "^
|
|
8048
|
+
"lru-cache": "^7.5.1"
|
|
8072
8049
|
}
|
|
8073
8050
|
},
|
|
8074
8051
|
"locate-path": {
|
|
@@ -8149,12 +8126,6 @@
|
|
|
8149
8126
|
"requires": {
|
|
8150
8127
|
"lru-cache": "^7.5.1"
|
|
8151
8128
|
}
|
|
8152
|
-
},
|
|
8153
|
-
"lru-cache": {
|
|
8154
|
-
"version": "7.7.3",
|
|
8155
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
|
|
8156
|
-
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==",
|
|
8157
|
-
"dev": true
|
|
8158
8129
|
}
|
|
8159
8130
|
}
|
|
8160
8131
|
},
|
|
@@ -9189,12 +9160,6 @@
|
|
|
9189
9160
|
"lru-cache": "^7.5.1"
|
|
9190
9161
|
}
|
|
9191
9162
|
},
|
|
9192
|
-
"lru-cache": {
|
|
9193
|
-
"version": "7.7.3",
|
|
9194
|
-
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.3.tgz",
|
|
9195
|
-
"integrity": "sha512-WY9wjJNQt9+PZilnLbuFKM+SwDull9+6IAguOrarOMoOHTcJ9GnXSO11+Gw6c7xtDkBkthR57OZMtZKYr+1CEw==",
|
|
9196
|
-
"dev": true
|
|
9197
|
-
},
|
|
9198
9163
|
"normalize-package-data": {
|
|
9199
9164
|
"version": "4.0.0",
|
|
9200
9165
|
"resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-4.0.0.tgz",
|
|
@@ -9787,6 +9752,17 @@
|
|
|
9787
9752
|
"dev": true,
|
|
9788
9753
|
"requires": {
|
|
9789
9754
|
"lru-cache": "^6.0.0"
|
|
9755
|
+
},
|
|
9756
|
+
"dependencies": {
|
|
9757
|
+
"lru-cache": {
|
|
9758
|
+
"version": "6.0.0",
|
|
9759
|
+
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
|
|
9760
|
+
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
|
|
9761
|
+
"dev": true,
|
|
9762
|
+
"requires": {
|
|
9763
|
+
"yallist": "^4.0.0"
|
|
9764
|
+
}
|
|
9765
|
+
}
|
|
9790
9766
|
}
|
|
9791
9767
|
},
|
|
9792
9768
|
"semver-diff": {
|
|
@@ -10940,9 +10916,9 @@
|
|
|
10940
10916
|
"dev": true
|
|
10941
10917
|
},
|
|
10942
10918
|
"typed-dom": {
|
|
10943
|
-
"version": "0.0.
|
|
10944
|
-
"resolved": "https://registry.npmjs.org/typed-dom/-/typed-dom-0.0.
|
|
10945
|
-
"integrity": "sha512-
|
|
10919
|
+
"version": "0.0.250",
|
|
10920
|
+
"resolved": "https://registry.npmjs.org/typed-dom/-/typed-dom-0.0.250.tgz",
|
|
10921
|
+
"integrity": "sha512-hjCpUI+E7St1bGVgyjYZww0ruhXLbPrcih6puElqXTIGHG9JHqd70p94RVilWup/mKoLnzeIdbFDYHLuloCfdQ==",
|
|
10946
10922
|
"dev": true
|
|
10947
10923
|
},
|
|
10948
10924
|
"typedarray": {
|
|
@@ -10961,9 +10937,9 @@
|
|
|
10961
10937
|
}
|
|
10962
10938
|
},
|
|
10963
10939
|
"typescript": {
|
|
10964
|
-
"version": "4.6.
|
|
10965
|
-
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.
|
|
10966
|
-
"integrity": "sha512-
|
|
10940
|
+
"version": "4.6.3",
|
|
10941
|
+
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz",
|
|
10942
|
+
"integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==",
|
|
10967
10943
|
"dev": true
|
|
10968
10944
|
},
|
|
10969
10945
|
"ua-parser-js": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.235.
|
|
3
|
+
"version": "0.235.3",
|
|
4
4
|
"description": "Secure markdown renderer working on browsers for user input data.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"homepage": "https://github.com/falsandtru/securemark",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"semver": "^7.3.5",
|
|
64
64
|
"spica": "0.0.515",
|
|
65
65
|
"tsify": "^5.0.4",
|
|
66
|
-
"typed-dom": "0.0.
|
|
67
|
-
"typescript": "4.6.
|
|
66
|
+
"typed-dom": "0.0.250",
|
|
67
|
+
"typescript": "4.6.3",
|
|
68
68
|
"vinyl-buffer": "^1.0.1",
|
|
69
69
|
"vinyl-source-stream": "^2.0.0"
|
|
70
70
|
},
|
|
@@ -20,7 +20,7 @@ describe('Unit: parser/block/paragraph', () => {
|
|
|
20
20
|
assert.deepStrictEqual(inspect(parser('a\\ \n')), [['<p>a</p>'], '']);
|
|
21
21
|
assert.deepStrictEqual(inspect(parser('a\\\n')), [['<p>a</p>'], '']);
|
|
22
22
|
assert.deepStrictEqual(inspect(parser('a\\\nb')), [['<p>a<span class="linebreak"> </span>b</p>'], '']);
|
|
23
|
-
assert.deepStrictEqual(inspect(parser('a
b')), [['<p>a
|
|
23
|
+
assert.deepStrictEqual(inspect(parser('a
b')), [['<p>a b</p>'], '']);
|
|
24
24
|
assert.deepStrictEqual(inspect(parser('	
')), [['<p>&Tab;&NewLine;</p>'], '']);
|
|
25
25
|
assert.deepStrictEqual(inspect(parser('<wbr>')), [['<p><wbr></p>'], '']);
|
|
26
26
|
assert.deepStrictEqual(inspect(parser('<wbr>\n')), [['<p><wbr></p>'], '']);
|
|
@@ -9,7 +9,7 @@ import { unshift } from 'spica/array';
|
|
|
9
9
|
export const deletion: DeletionParser = lazy(() => creator(surround(
|
|
10
10
|
str('~~'),
|
|
11
11
|
some(union([
|
|
12
|
-
some(inline, blank(/\n?/,
|
|
12
|
+
some(inline, blank(/\n?/, '~~')),
|
|
13
13
|
open(/^\n?/, some(inline, '~'), true),
|
|
14
14
|
])),
|
|
15
15
|
str('~~'), false,
|
|
@@ -10,19 +10,19 @@ import { html, defrag } from 'typed-dom';
|
|
|
10
10
|
import { unshift } from 'spica/array';
|
|
11
11
|
|
|
12
12
|
const substrong: IntermediateParser<StrongParser> = lazy(() => some(union([
|
|
13
|
-
some(inline, blank('',
|
|
13
|
+
some(inline, blank('', '**')),
|
|
14
14
|
open(some(inline, '*'), inline),
|
|
15
15
|
])));
|
|
16
16
|
const subemphasis: IntermediateParser<EmphasisParser> = lazy(() => some(union([
|
|
17
17
|
strong,
|
|
18
|
-
some(inline, blank('',
|
|
18
|
+
some(inline, blank('', '*')),
|
|
19
19
|
open(some(inline, '*'), inline),
|
|
20
20
|
])));
|
|
21
21
|
|
|
22
22
|
export const emstrong: EmStrongParser = lazy(() => creator(surround(
|
|
23
23
|
str('***'),
|
|
24
24
|
startTight(some(union([
|
|
25
|
-
some(inline, blank('',
|
|
25
|
+
some(inline, blank('', '*')),
|
|
26
26
|
open(some(inline, '*'), inline),
|
|
27
27
|
]))),
|
|
28
28
|
str(/^\*{1,3}/), false,
|
|
@@ -14,7 +14,6 @@ describe('Unit: parser/inline/htmlentity', () => {
|
|
|
14
14
|
assert.deepStrictEqual(inspect(parser('& ;')), undefined);
|
|
15
15
|
assert.deepStrictEqual(inspect(parser('&\n;')), undefined);
|
|
16
16
|
assert.deepStrictEqual(inspect(parser('&a;')), [['<span class="invalid">&a;</span>'], '']);
|
|
17
|
-
assert.deepStrictEqual(inspect(parser('
')), undefined);
|
|
18
17
|
assert.deepStrictEqual(inspect(parser('&#;')), undefined);
|
|
19
18
|
assert.deepStrictEqual(inspect(parser('&#g;')), undefined);
|
|
20
19
|
assert.deepStrictEqual(inspect(parser('&#x;')), undefined);
|
|
@@ -36,6 +35,7 @@ describe('Unit: parser/inline/htmlentity', () => {
|
|
|
36
35
|
});
|
|
37
36
|
|
|
38
37
|
it('entity', () => {
|
|
38
|
+
assert.deepStrictEqual(inspect(parser('
')), [[' '], '']);
|
|
39
39
|
assert.deepStrictEqual(inspect(parser(' ')), [['\u00A0'], '']);
|
|
40
40
|
assert.deepStrictEqual(inspect(parser('&')), [['&'], '']);
|
|
41
41
|
assert.deepStrictEqual(inspect(parser('©')), [['©'], '']);
|
|
@@ -1,24 +1,31 @@
|
|
|
1
|
+
import { undefined } from 'spica/global';
|
|
1
2
|
import { HTMLEntityParser, UnsafeHTMLEntityParser } from '../inline';
|
|
2
3
|
import { union, validate, focus, creator, fmap } from '../../combinator';
|
|
3
4
|
import { html } from 'typed-dom';
|
|
5
|
+
import { reduce } from 'spica/memoize';
|
|
4
6
|
|
|
5
7
|
export const unsafehtmlentity: UnsafeHTMLEntityParser = creator(validate('&', focus(
|
|
6
|
-
/^&
|
|
7
|
-
|
|
8
|
-
parser.innerHTML = entity,
|
|
9
|
-
entity = parser.textContent!,
|
|
10
|
-
[[`${entity[0] !== '&' || entity.length === 1 ? '' : '\0'}${entity}`], '']
|
|
11
|
-
))(html('b')))));
|
|
8
|
+
/^&[0-9A-Za-z]+;/,
|
|
9
|
+
entity => [[parse(entity) ?? `\0${entity}`], ''])));
|
|
12
10
|
|
|
13
11
|
export const htmlentity: HTMLEntityParser = fmap(
|
|
14
12
|
union([unsafehtmlentity]),
|
|
15
|
-
([
|
|
16
|
-
|
|
13
|
+
([test]) => [
|
|
14
|
+
test[0] === '\0'
|
|
17
15
|
? html('span', {
|
|
18
16
|
class: 'invalid',
|
|
19
17
|
'data-invalid-syntax': 'htmlentity',
|
|
20
18
|
'data-invalid-type': 'syntax',
|
|
21
19
|
'data-invalid-description': 'Invalid HTML entity.',
|
|
22
|
-
},
|
|
23
|
-
:
|
|
20
|
+
}, test.slice(1))
|
|
21
|
+
: test,
|
|
24
22
|
]);
|
|
23
|
+
|
|
24
|
+
const parse = reduce((el => (entity: string): string | undefined => {
|
|
25
|
+
if (entity === '
') return ' ';
|
|
26
|
+
el.innerHTML = entity;
|
|
27
|
+
const text = el.textContent!;
|
|
28
|
+
return entity === text
|
|
29
|
+
? undefined
|
|
30
|
+
: text;
|
|
31
|
+
})(html('b')));
|
|
@@ -9,7 +9,7 @@ import { unshift } from 'spica/array';
|
|
|
9
9
|
export const insertion: InsertionParser = lazy(() => creator(surround(
|
|
10
10
|
str('++'),
|
|
11
11
|
some(union([
|
|
12
|
-
some(inline, blank(/\n?/,
|
|
12
|
+
some(inline, blank(/\n?/, '++')),
|
|
13
13
|
open(/^\n?/, some(inline, '+'), true),
|
|
14
14
|
])),
|
|
15
15
|
str('++'), false,
|
|
@@ -9,7 +9,7 @@ import { unshift } from 'spica/array';
|
|
|
9
9
|
export const mark: MarkParser = lazy(() => creator(surround(
|
|
10
10
|
str('=='),
|
|
11
11
|
startTight(some(union([
|
|
12
|
-
some(inline, blank('',
|
|
12
|
+
some(inline, blank('', '==')),
|
|
13
13
|
open(some(inline, '='), inline),
|
|
14
14
|
]))),
|
|
15
15
|
str('=='), false,
|
|
@@ -83,7 +83,7 @@ function attributes(texts: string[], rubies: string[]): Record<string, string> {
|
|
|
83
83
|
let attrs: Record<string, string> | undefined;
|
|
84
84
|
for (const ss of [texts, rubies]) {
|
|
85
85
|
for (let i = 0; i < ss.length; ++i) {
|
|
86
|
-
if (
|
|
86
|
+
if (ss[i].indexOf('\0') === -1) continue;
|
|
87
87
|
ss[i] = ss[i].replace(/\0/g, '');
|
|
88
88
|
attrs ??= {
|
|
89
89
|
class: 'invalid',
|
|
@@ -9,7 +9,7 @@ import { unshift } from 'spica/array';
|
|
|
9
9
|
export const strong: StrongParser = lazy(() => creator(surround(
|
|
10
10
|
str('**'),
|
|
11
11
|
startTight(some(union([
|
|
12
|
-
some(inline, blank('',
|
|
12
|
+
some(inline, blank('', '**')),
|
|
13
13
|
open(some(inline, '*'), inline),
|
|
14
14
|
])), '*'),
|
|
15
15
|
str('**'), false,
|
package/src/parser/util.ts
CHANGED
|
@@ -13,7 +13,7 @@ export function blank(prefix: '' | RegExp, suffix: string | RegExp): RegExp {
|
|
|
13
13
|
`^${
|
|
14
14
|
prefix && prefix.source
|
|
15
15
|
}(?:\\\s|[^\S\n]+|\n|&(?:${invisibleHTMLEntityNames.join('|')});|<wbr>)?${
|
|
16
|
-
typeof suffix === 'string' ? suffix : suffix.source
|
|
16
|
+
typeof suffix === 'string' ? suffix.replace(/[*+()\[\]]/g, '\\$&') : suffix.source
|
|
17
17
|
}`);
|
|
18
18
|
}
|
|
19
19
|
|