securemark 0.263.0 → 0.263.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 +4 -0
- package/dist/index.js +630 -653
- package/index.ts +0 -1
- package/package.json +9 -9
- package/src/combinator/control/constraint/block.ts +1 -2
- package/src/combinator/control/constraint/contract.ts +3 -3
- package/src/combinator/control/constraint/line.ts +1 -2
- package/src/combinator/control/manipulation/indent.ts +0 -1
- package/src/combinator/control/manipulation/match.ts +1 -2
- package/src/combinator/control/manipulation/scope.ts +3 -4
- package/src/combinator/control/manipulation/surround.ts +1 -2
- package/src/combinator/control/monad/bind.ts +2 -3
- package/src/combinator/data/parser/context.ts +0 -1
- package/src/combinator/data/parser/inits.ts +1 -2
- package/src/combinator/data/parser/sequence.ts +1 -2
- package/src/combinator/data/parser/some.ts +1 -2
- package/src/combinator/data/parser/union.ts +4 -12
- package/src/parser/api/bind.ts +0 -1
- package/src/parser/api/parse.ts +0 -1
- package/src/parser/block/codeblock.ts +0 -1
- package/src/parser/block/extension/figure.ts +0 -1
- package/src/parser/block/extension/table.ts +0 -1
- package/src/parser/block/mathblock.ts +0 -1
- package/src/parser/block/olist.ts +0 -1
- package/src/parser/block.ts +0 -1
- package/src/parser/inline/annotation.ts +0 -1
- package/src/parser/inline/bracket.ts +0 -1
- package/src/parser/inline/extension/index.ts +0 -1
- package/src/parser/inline/extension/indexee.ts +0 -1
- package/src/parser/inline/extension/label.ts +0 -1
- package/src/parser/inline/html.ts +0 -1
- package/src/parser/inline/htmlentity.ts +0 -1
- package/src/parser/inline/link.ts +0 -1
- package/src/parser/inline/media.ts +0 -1
- package/src/parser/inline/reference.ts +0 -1
- package/src/parser/inline/ruby.ts +0 -1
- package/src/parser/inline/template.ts +0 -1
- package/src/parser/processor/figure.ts +0 -1
- package/src/parser/processor/footnote.ts +0 -1
- package/src/parser/segment.ts +0 -1
- package/src/parser/source/line.ts +0 -1
- package/src/parser/source/str.ts +0 -1
- package/src/parser/source/text.ts +0 -1
- package/src/parser/visibility.ts +0 -1
- package/src/renderer/render/math.ts +0 -1
- package/src/renderer/render/media/image.ts +0 -1
- package/src/renderer/render/media/twitter.ts +0 -1
- package/src/renderer/render/media/video.ts +0 -1
- package/src/renderer/render/media/youtube.ts +0 -1
- package/src/renderer/render.ts +0 -1
- package/src/util/quote.ts +0 -1
- package/src/util/scope.ts +0 -2
- package/src/util/toc.ts +0 -1
- package/webpack.config.js +1 -1
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "securemark",
|
|
3
|
-
"version": "0.263.
|
|
3
|
+
"version": "0.263.1",
|
|
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",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"@types/dompurify": "2.3.4",
|
|
32
32
|
"@types/jquery": "3.5.14",
|
|
33
33
|
"@types/mathjax": "0.0.37",
|
|
34
|
-
"@types/mocha": "
|
|
34
|
+
"@types/mocha": "10.0.0",
|
|
35
35
|
"@types/power-assert": "1.5.8",
|
|
36
36
|
"@types/prismjs": "1.26.0",
|
|
37
|
-
"@typescript-eslint/parser": "^5.
|
|
37
|
+
"@typescript-eslint/parser": "^5.39.0",
|
|
38
38
|
"babel-loader": "^8.2.5",
|
|
39
39
|
"babel-plugin-unassert": "^3.2.0",
|
|
40
40
|
"concurrently": "^7.4.0",
|
|
41
|
-
"eslint": "^8.
|
|
41
|
+
"eslint": "^8.25.0",
|
|
42
42
|
"eslint-plugin-redos": "^4.4.1",
|
|
43
43
|
"eslint-webpack-plugin": "^3.2.0",
|
|
44
44
|
"glob": "^8.0.3",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"karma-mocha": "^2.0.1",
|
|
50
50
|
"karma-power-assert": "^1.0.0",
|
|
51
51
|
"mocha": "^10.0.0",
|
|
52
|
-
"npm-check-updates": "^16.3.
|
|
53
|
-
"semver": "^7.3.
|
|
54
|
-
"spica": "0.0.
|
|
52
|
+
"npm-check-updates": "^16.3.10",
|
|
53
|
+
"semver": "^7.3.8",
|
|
54
|
+
"spica": "0.0.656",
|
|
55
55
|
"ts-loader": "^9.4.1",
|
|
56
|
-
"typed-dom": "^0.0.
|
|
57
|
-
"typescript": "4.8.
|
|
56
|
+
"typed-dom": "^0.0.312",
|
|
57
|
+
"typescript": "4.8.4",
|
|
58
58
|
"webpack": "^5.74.0",
|
|
59
59
|
"webpack-cli": "^4.10.0",
|
|
60
60
|
"webpack-merge": "^5.8.0"
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, exec } from '../../data/parser';
|
|
3
2
|
import { Memo } from '../../data/parser/context/memo';
|
|
4
3
|
import { firstline, isEmpty } from './line';
|
|
@@ -10,7 +9,7 @@ export function block<T>(parser: Parser<T>, separation = true): Parser<T> {
|
|
|
10
9
|
if (source === '') return;
|
|
11
10
|
context.memo ??= new Memo();
|
|
12
11
|
const result = parser({ source, context });
|
|
13
|
-
if (
|
|
12
|
+
if (result === undefined) return;
|
|
14
13
|
const rest = exec(result);
|
|
15
14
|
if (separation && !isEmpty(firstline(rest))) return;
|
|
16
15
|
assert(rest === '' || source[source.length - rest.length - 1] === '\n');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'spica/global';
|
|
2
2
|
import { isArray } from 'spica/alias';
|
|
3
3
|
import { Parser, Ctx, Tree, Context, eval, exec, check } from '../../data/parser';
|
|
4
4
|
|
|
@@ -27,7 +27,7 @@ export function validate<T>(patterns: string | RegExp | (string | RegExp)[], has
|
|
|
27
27
|
if (!match(source)) return;
|
|
28
28
|
const result = parser!({ source, context });
|
|
29
29
|
assert(check(source, result));
|
|
30
|
-
if (
|
|
30
|
+
if (result === undefined) return;
|
|
31
31
|
assert(exec(result).length < source.length);
|
|
32
32
|
return exec(result).length < source.length
|
|
33
33
|
? result
|
|
@@ -42,7 +42,7 @@ export function verify<T>(parser: Parser<T>, cond: (results: readonly T[], rest:
|
|
|
42
42
|
if (source === '') return;
|
|
43
43
|
const result = parser({ source, context });
|
|
44
44
|
assert(check(source, result));
|
|
45
|
-
if (
|
|
45
|
+
if (result === undefined) return;
|
|
46
46
|
if (!cond(eval(result), exec(result), context)) return;
|
|
47
47
|
assert(exec(result).length < source.length);
|
|
48
48
|
return exec(result).length < source.length
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, eval, exec, check } from '../../data/parser';
|
|
3
2
|
import { Memo } from '../../data/parser/context/memo';
|
|
4
3
|
|
|
@@ -14,7 +13,7 @@ export function line<T>(parser: Parser<T>): Parser<T> {
|
|
|
14
13
|
const result = parser({ source: line, context });
|
|
15
14
|
assert(check(line, result));
|
|
16
15
|
context.offset -= source.length - line.length;
|
|
17
|
-
if (
|
|
16
|
+
if (result === undefined) return;
|
|
18
17
|
return isEmpty(exec(result))
|
|
19
18
|
? [eval(result), source.slice(line.length)]
|
|
20
19
|
: undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, exec, check } from '../../data/parser';
|
|
3
2
|
|
|
4
3
|
export function match<P extends Parser<unknown>>(pattern: RegExp, f: (matched: RegExpMatchArray) => P): P;
|
|
@@ -11,7 +10,7 @@ export function match<T>(pattern: RegExp, f: (matched: RegExpMatchArray) => Pars
|
|
|
11
10
|
assert(source.startsWith(param[0]));
|
|
12
11
|
const result = f(param)({ source, context });
|
|
13
12
|
assert(check(source, result, false));
|
|
14
|
-
if (
|
|
13
|
+
if (result === undefined) return;
|
|
15
14
|
return exec(result).length < source.length && exec(result).length <= source.length
|
|
16
15
|
? result
|
|
17
16
|
: undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, Context, eval, exec, check } from '../../data/parser';
|
|
3
2
|
|
|
4
3
|
export function focus<P extends Parser<unknown>>(scope: string | RegExp, parser: P): P;
|
|
@@ -18,7 +17,7 @@ export function focus<T>(scope: string | RegExp, parser: Parser<T>): Parser<T> {
|
|
|
18
17
|
const result = parser({ source: src, context });
|
|
19
18
|
assert(check(src, result));
|
|
20
19
|
context.offset -= source.length - src.length;
|
|
21
|
-
if (
|
|
20
|
+
if (result === undefined) return;
|
|
22
21
|
assert(exec(result).length < src.length);
|
|
23
22
|
return exec(result).length < src.length
|
|
24
23
|
? [eval(result), exec(result) + source.slice(src.length)]
|
|
@@ -38,7 +37,7 @@ export function rewrite<T>(scope: Parser<unknown>, parser: Parser<T>): Parser<T>
|
|
|
38
37
|
const res1 = scope({ source, context });
|
|
39
38
|
assert(check(source, res1));
|
|
40
39
|
context.memo = memo;
|
|
41
|
-
if (
|
|
40
|
+
if (res1 === undefined || exec(res1).length >= source.length) return;
|
|
42
41
|
const src = source.slice(0, source.length - exec(res1).length);
|
|
43
42
|
assert(src !== '');
|
|
44
43
|
assert(source.startsWith(src));
|
|
@@ -47,7 +46,7 @@ export function rewrite<T>(scope: Parser<unknown>, parser: Parser<T>): Parser<T>
|
|
|
47
46
|
const res2 = parser({ source: src, context });
|
|
48
47
|
assert(check(src, res2));
|
|
49
48
|
context.offset -= source.length - src.length;
|
|
50
|
-
if (
|
|
49
|
+
if (res2 === undefined) return;
|
|
51
50
|
assert(exec(res2) === '');
|
|
52
51
|
return exec(res2).length < src.length
|
|
53
52
|
? [eval(res2), exec(res2) + exec(res1)]
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, Input, Result, Ctx, Tree, Context, SubParsers, SubTree, IntermediateParser, eval, exec, check } from '../../data/parser';
|
|
3
2
|
import { fmap } from '../monad/fmap';
|
|
4
3
|
import { unshift, push } from 'spica/array';
|
|
@@ -43,7 +42,7 @@ export function surround<T>(
|
|
|
43
42
|
if (lmr_ === '') return;
|
|
44
43
|
const res1 = opener({ source: lmr_, context });
|
|
45
44
|
assert(check(lmr_, res1, false));
|
|
46
|
-
if (
|
|
45
|
+
if (res1 === undefined) return;
|
|
47
46
|
const rl = eval(res1);
|
|
48
47
|
const mr_ = exec(res1);
|
|
49
48
|
const res2 = mr_ !== '' ? parser({ source: mr_, context }) : undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, Result, Ctx, Tree, Context, SubParsers, SubTree, IntermediateParser, eval, exec, check } from '../../data/parser';
|
|
3
2
|
|
|
4
3
|
export function bind<P extends Parser<unknown>>(parser: IntermediateParser<P>, f: (nodes: SubTree<P>[], rest: string, context: Context<P>) => Result<Tree<P>, Context<P>, SubParsers<P>>): P;
|
|
@@ -11,11 +10,11 @@ export function bind<T, U>(parser: Parser<T>, f: (nodes: T[], rest: string, cont
|
|
|
11
10
|
if (source === '') return;
|
|
12
11
|
const res1 = parser({ source, context });
|
|
13
12
|
assert(check(source, res1));
|
|
14
|
-
if (
|
|
13
|
+
if (res1 === undefined) return;
|
|
15
14
|
const res2 = f(eval(res1), exec(res1), context);
|
|
16
15
|
assert(check(source, res2));
|
|
17
16
|
assert(check(exec(res1), res2, false));
|
|
18
|
-
if (
|
|
17
|
+
if (res2 === undefined) return;
|
|
19
18
|
return exec(res2).length <= exec(res1).length
|
|
20
19
|
? res2
|
|
21
20
|
: undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, Ctx, Tree, Context, SubParsers, SubTree, eval, exec, check } from '../parser';
|
|
3
2
|
import { push } from 'spica/array';
|
|
4
3
|
|
|
@@ -14,7 +13,7 @@ export function inits<T, D extends Parser<T>[]>(parsers: D, resume?: (nodes: T[]
|
|
|
14
13
|
if (context.delimiters?.match(rest, context.precedence)) break;
|
|
15
14
|
const result = parsers[i]({ source: rest, context });
|
|
16
15
|
assert(check(rest, result));
|
|
17
|
-
if (
|
|
16
|
+
if (result === undefined) break;
|
|
18
17
|
nodes = nodes
|
|
19
18
|
? push(nodes, eval(result))
|
|
20
19
|
: eval(result);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, Ctx, Tree, Context, SubParsers, SubTree, eval, exec, check } from '../parser';
|
|
3
2
|
import { push } from 'spica/array';
|
|
4
3
|
|
|
@@ -14,7 +13,7 @@ export function sequence<T, D extends Parser<T>[]>(parsers: D, resume?: (nodes:
|
|
|
14
13
|
if (context.delimiters?.match(rest, context.precedence)) return;
|
|
15
14
|
const result = parsers[i]({ source: rest, context });
|
|
16
15
|
assert(check(rest, result));
|
|
17
|
-
if (
|
|
16
|
+
if (result === undefined) return;
|
|
18
17
|
nodes = nodes
|
|
19
18
|
? push(nodes, eval(result))
|
|
20
19
|
: eval(result);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, eval, exec, check } from '../parser';
|
|
3
2
|
import { Delimiters } from './context/delimiter';
|
|
4
3
|
import { unshift, push } from 'spica/array';
|
|
@@ -30,7 +29,7 @@ export function some<T>(parser: Parser<T>, end?: string | RegExp | number, delim
|
|
|
30
29
|
if (context.delimiters?.match(rest, context.precedence)) break;
|
|
31
30
|
const result = parser({ source: rest, context });
|
|
32
31
|
assert.doesNotThrow(() => limit < 0 && check(rest, result));
|
|
33
|
-
if (
|
|
32
|
+
if (result === undefined) break;
|
|
34
33
|
nodes = nodes
|
|
35
34
|
? nodes.length < eval(result).length
|
|
36
35
|
? unshift(nodes, eval(result))
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { Parser, Ctx, Tree, Context, SubParsers, SubTree } from '../parser';
|
|
3
2
|
|
|
4
3
|
export function union<P extends Parser<unknown>>(parsers: SubParsers<P>): SubTree<P> extends Tree<P> ? P : Parser<SubTree<P>, Context<P>, SubParsers<P>>;
|
|
@@ -9,17 +8,10 @@ export function union<T, D extends Parser<T>[]>(parsers: D): Parser<T, Ctx, D> {
|
|
|
9
8
|
return () => undefined;
|
|
10
9
|
case 1:
|
|
11
10
|
return parsers[0];
|
|
12
|
-
case 2:
|
|
13
|
-
return input => parsers[0](input) ?? parsers[1](input);
|
|
14
|
-
case 3:
|
|
15
|
-
return input => parsers[0](input) ?? parsers[1](input) ?? parsers[2](input);
|
|
16
11
|
default:
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (result) return result;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
12
|
+
return eval([
|
|
13
|
+
'input =>',
|
|
14
|
+
parsers.map((_, i) => `|| parsers[${i}](input)`).join('').slice(2),
|
|
15
|
+
].join(''));
|
|
24
16
|
}
|
|
25
17
|
}
|
package/src/parser/api/bind.ts
CHANGED
package/src/parser/api/parse.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { ExtensionParser } from '../../block';
|
|
3
2
|
import { union, inits, sequence, some, state, block, line, fence, rewrite, close, match, convert, trimEnd, fallback, fmap } from '../../../combinator';
|
|
4
3
|
import { str, contentline, emptyline } from '../../source';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined } from 'spica/global';
|
|
2
1
|
import { OListParser } from '../block';
|
|
3
2
|
import { Parser } from '../../combinator/data/parser';
|
|
4
3
|
import { union, inits, subsequence, some, creation, state, block, line, validate, indent, focus, rewrite, open, match, fallback, lazy, fmap } from '../../combinator';
|
package/src/parser/block.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { undefined, location } from 'spica/global';
|
|
2
1
|
import { MediaParser } from '../inline';
|
|
3
2
|
import { union, inits, tails, some, syntax, creation, precedence, constraint, validate, verify, surround, open, dup, lazy, fmap, bind } from '../../combinator';
|
|
4
3
|
import { unsafelink, uri, option as linkoption, resolve } from './link';
|
package/src/parser/segment.ts
CHANGED
package/src/parser/source/str.ts
CHANGED
package/src/parser/visibility.ts
CHANGED
package/src/renderer/render.ts
CHANGED
package/src/util/quote.ts
CHANGED
package/src/util/scope.ts
CHANGED
package/src/util/toc.ts
CHANGED
package/webpack.config.js
CHANGED
|
@@ -6,7 +6,7 @@ const { mergeWithRules } = require('webpack-merge');
|
|
|
6
6
|
const ESLintPlugin = require('eslint-webpack-plugin');
|
|
7
7
|
const pkg = require('./package.json');
|
|
8
8
|
|
|
9
|
-
shell('rm -rf coverage');
|
|
9
|
+
shell('rm -rf dist coverage');
|
|
10
10
|
|
|
11
11
|
module.exports = env => {
|
|
12
12
|
const merge = mergeWithRules({
|