securemark 0.260.3 → 0.260.4
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
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.260.
|
|
1
|
+
/*! securemark v0.260.4 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("DOMPurify"), require("Prism"));
|
|
@@ -3209,14 +3209,14 @@ class Memo {
|
|
|
3209
3209
|
}
|
|
3210
3210
|
|
|
3211
3211
|
get(position, syntax, state) {
|
|
3212
|
-
//console.log('get', position
|
|
3212
|
+
//console.log('get', position, syntax, state, this.memory[position - 1]?.[`${syntax}:${state}`]);;
|
|
3213
3213
|
const cache = this.memory[position - 1]?.[`${syntax}:${state}`];
|
|
3214
3214
|
return cache?.length === 2 ? [cache[0].slice(), cache[1]] : cache;
|
|
3215
3215
|
}
|
|
3216
3216
|
|
|
3217
3217
|
set(position, syntax, state, nodes, offset) {
|
|
3218
3218
|
const record = this.memory[position - 1] ??= {};
|
|
3219
|
-
record[`${syntax}:${state}`] = nodes ? [nodes.slice(), offset] : []; //console.log('set', position
|
|
3219
|
+
record[`${syntax}:${state}`] = nodes ? [nodes.slice(), offset] : []; //console.log('set', position, syntax, state, record[`${syntax}:${state}`]);
|
|
3220
3220
|
}
|
|
3221
3221
|
|
|
3222
3222
|
clear(position) {
|
|
@@ -3224,7 +3224,7 @@ class Memo {
|
|
|
3224
3224
|
|
|
3225
3225
|
for (let i = position, len = memory.length; i < len; ++i) {
|
|
3226
3226
|
memory.pop();
|
|
3227
|
-
} //console.log('clear', position +
|
|
3227
|
+
} //console.log('clear', position + 1);
|
|
3228
3228
|
|
|
3229
3229
|
}
|
|
3230
3230
|
|
|
@@ -6707,8 +6707,8 @@ const array_1 = __webpack_require__(8112); // Don't use the symbols already used
|
|
|
6707
6707
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
6708
6708
|
|
|
6709
6709
|
|
|
6710
|
-
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, combinator_1.syntax)(
|
|
6711
|
-
/* Syntax.
|
|
6710
|
+
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(['[:', '[^'], (0, combinator_1.surround)((0, source_1.str)(/^\[[:^]/), (0, combinator_1.syntax)(512
|
|
6711
|
+
/* Syntax.placeholder */
|
|
6712
6712
|
, 2, 1, 0
|
|
6713
6713
|
/* State.none */
|
|
6714
6714
|
, (0, visibility_1.startTight)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[/^\\?\n/, 9], [']', 2]]))), (0, source_1.str)(']'), false, ([as, bs], rest) => [[(0, dom_1.html)('span', {
|
|
@@ -6958,7 +6958,7 @@ function parse(content, params, rest, context) {
|
|
|
6958
6958
|
content = (0, dom_1.defrag)(content);
|
|
6959
6959
|
|
|
6960
6960
|
for (let source = (0, util_1.stringify)(content); source;) {
|
|
6961
|
-
if (/^[a-z][0-9a-z]*(?:[-.][0-9a-z]+)
|
|
6961
|
+
if (/^[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i.test(source)) return;
|
|
6962
6962
|
const result = autolink({
|
|
6963
6963
|
source,
|
|
6964
6964
|
context
|
|
@@ -7044,12 +7044,12 @@ exports.resolve = resolve;
|
|
|
7044
7044
|
|
|
7045
7045
|
function decode(uri) {
|
|
7046
7046
|
if (!uri.includes('%')) return uri;
|
|
7047
|
-
const origin = uri.match(/^[a-z](?:[-.](?=\w)|[0-9a-z])
|
|
7047
|
+
const origin = uri.match(/^[a-z](?:[-.](?=\w)|[0-9a-z])*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i)?.[0] ?? '';
|
|
7048
7048
|
|
|
7049
7049
|
try {
|
|
7050
7050
|
let path = (0, global_1.decodeURI)(uri.slice(origin.length));
|
|
7051
7051
|
|
|
7052
|
-
if (!origin && /^[a-z](?:[-.](?=\w)|[0-9a-z])
|
|
7052
|
+
if (!origin && /^[a-z](?:[-.](?=\w)|[0-9a-z])*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i.test(path)) {
|
|
7053
7053
|
path = uri.slice(origin.length);
|
|
7054
7054
|
}
|
|
7055
7055
|
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ export class Memo {
|
|
|
8
8
|
syntax: number,
|
|
9
9
|
state: number,
|
|
10
10
|
): readonly [any[], number] | readonly [] | undefined {
|
|
11
|
-
//console.log('get', position
|
|
11
|
+
//console.log('get', position, syntax, state, this.memory[position - 1]?.[`${syntax}:${state}`]);;
|
|
12
12
|
const cache = this.memory[position - 1]?.[`${syntax}:${state}`];
|
|
13
13
|
return cache?.length === 2
|
|
14
14
|
? [cache[0].slice(), cache[1]]
|
|
@@ -26,13 +26,13 @@ export class Memo {
|
|
|
26
26
|
record[`${syntax}:${state}`] = nodes
|
|
27
27
|
? [nodes.slice(), offset]
|
|
28
28
|
: [];
|
|
29
|
-
//console.log('set', position
|
|
29
|
+
//console.log('set', position, syntax, state, record[`${syntax}:${state}`]);
|
|
30
30
|
}
|
|
31
31
|
public clear(position: number): void {
|
|
32
32
|
const memory = this.memory;
|
|
33
33
|
for (let i = position, len = memory.length; i < len; ++i) {
|
|
34
34
|
memory.pop();
|
|
35
35
|
}
|
|
36
|
-
//console.log('clear', position +
|
|
36
|
+
//console.log('clear', position + 1);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
@@ -13,7 +13,7 @@ import { unshift } from 'spica/array';
|
|
|
13
13
|
|
|
14
14
|
export const placeholder: ExtensionParser.PlaceholderParser = lazy(() => validate(['[:', '[^'], surround(
|
|
15
15
|
str(/^\[[:^]/),
|
|
16
|
-
syntax(Syntax.
|
|
16
|
+
syntax(Syntax.placeholder, 2, 1, State.none,
|
|
17
17
|
startTight(some(union([inline]), ']', [[/^\\?\n/, 9], [']', 2]]))),
|
|
18
18
|
str(']'), false,
|
|
19
19
|
([as, bs], rest) => [[
|
|
@@ -29,6 +29,8 @@ describe('Unit: parser/inline/link', () => {
|
|
|
29
29
|
assert.deepStrictEqual(inspect(parser('{http://a%C3%A1}')), [['<a class="url" href="http://a%C3%A1" target="_blank">http://a%C3%A1</a>'], '']);
|
|
30
30
|
assert.deepStrictEqual(inspect(parser('[http://á]{http://evil}')), undefined);
|
|
31
31
|
assert.deepStrictEqual(inspect(parser('[xxx://á]{http://evil}')), undefined);
|
|
32
|
+
assert.deepStrictEqual(inspect(parser('[mailto:á]{http://evil}')), undefined);
|
|
33
|
+
assert.deepStrictEqual(inspect(parser('[file:///]{http://evil}')), undefined);
|
|
32
34
|
assert.deepStrictEqual(inspect(parser('[.http://á]{http://evil}')), undefined);
|
|
33
35
|
assert.deepStrictEqual(inspect(parser('[0987654321]{tel:1234567890}')), undefined);
|
|
34
36
|
assert.deepStrictEqual(inspect(parser('[1234567890-]{tel:1234567890}')), undefined);
|
|
@@ -88,7 +88,7 @@ function parse(
|
|
|
88
88
|
if (content.length !== 0 && trimNode(content).length === 0) return;
|
|
89
89
|
content = defrag(content);
|
|
90
90
|
for (let source = stringify(content); source;) {
|
|
91
|
-
if (/^[a-z][0-9a-z]*(?:[-.][0-9a-z]+)
|
|
91
|
+
if (/^[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i.test(source)) return;
|
|
92
92
|
const result = autolink({ source, context });
|
|
93
93
|
if (typeof eval(result, [])[0] === 'object') return;
|
|
94
94
|
source = exec(result, '');
|
|
@@ -202,10 +202,10 @@ export function resolve(uri: string, host: URL | Location, source: URL | Locatio
|
|
|
202
202
|
|
|
203
203
|
function decode(uri: string): string {
|
|
204
204
|
if (!uri.includes('%')) return uri;
|
|
205
|
-
const origin = uri.match(/^[a-z](?:[-.](?=\w)|[0-9a-z])
|
|
205
|
+
const origin = uri.match(/^[a-z](?:[-.](?=\w)|[0-9a-z])*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i)?.[0] ?? '';
|
|
206
206
|
try {
|
|
207
207
|
let path = decodeURI(uri.slice(origin.length));
|
|
208
|
-
if (!origin && /^[a-z](?:[-.](?=\w)|[0-9a-z])
|
|
208
|
+
if (!origin && /^[a-z](?:[-.](?=\w)|[0-9a-z])*:(?:\/{0,2}[^/?#\s]+|\/\/(?=[/]))/i.test(path)) {
|
|
209
209
|
path = uri.slice(origin.length);
|
|
210
210
|
}
|
|
211
211
|
uri = origin + path;
|