securemark 0.298.2 → 0.298.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/index.js +100 -93
- package/package.json +1 -1
- package/src/combinator/control/constraint/line.ts +1 -1
- package/src/combinator/control/manipulation/match.ts +1 -1
- package/src/combinator/data/delimiter.ts +42 -37
- package/src/combinator/data/parser/context.ts +4 -2
- package/src/combinator/data/parser/inits.ts +1 -1
- package/src/combinator/data/parser/sequence.ts +1 -1
- package/src/combinator/data/parser/some.ts +4 -3
- package/src/parser/api/bind.ts +6 -8
- package/src/parser/api/header.ts +1 -1
- package/src/parser/api/parse.ts +5 -6
- package/src/parser/block/codeblock.ts +1 -1
- package/src/parser/block/extension/fig.ts +1 -1
- package/src/parser/block/extension/figure.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/heading.ts +1 -1
- package/src/parser/block/mathblock.ts +1 -1
- package/src/parser/block.ts +4 -5
- package/src/parser/header.test.ts +1 -0
- package/src/parser/header.ts +3 -3
- package/src/parser/inline/autolink.ts +3 -3
- package/src/parser/inline/bracket.ts +5 -6
- package/src/parser/inline/html.test.ts +5 -1
- package/src/parser/inline/html.ts +61 -53
- package/src/parser/inline.ts +7 -1
- package/src/parser/processor/note.ts +1 -1
- package/src/parser/segment.ts +7 -6
- package/src/parser/source/escapable.ts +0 -1
- package/src/parser/source/line.ts +6 -4
- package/src/parser/source/text.ts +4 -5
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.298.
|
|
1
|
+
/*! securemark v0.298.3 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("Prism"), require("DOMPurify"));
|
|
@@ -2664,7 +2664,7 @@ function firstline(source, position) {
|
|
|
2664
2664
|
return i === -1 ? source.slice(position) : source.slice(position, i + 1);
|
|
2665
2665
|
}
|
|
2666
2666
|
exports.firstline = firstline;
|
|
2667
|
-
const emptyline = /[^\S\n]*(?:$|\n)/y;
|
|
2667
|
+
const emptyline = /[^\S\r\n]*(?:$|\r?\n)/y;
|
|
2668
2668
|
function isEmptyline(source, position) {
|
|
2669
2669
|
emptyline.lastIndex = position;
|
|
2670
2670
|
return source.length === position || source[position] === '\n' || emptyline.test(source);
|
|
@@ -2903,7 +2903,7 @@ exports.match = void 0;
|
|
|
2903
2903
|
const parser_1 = __webpack_require__(605);
|
|
2904
2904
|
const combinator_1 = __webpack_require__(3484);
|
|
2905
2905
|
function match(pattern, f) {
|
|
2906
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
2906
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
2907
2907
|
return (0, parser_1.failsafe)(input => {
|
|
2908
2908
|
const context = input;
|
|
2909
2909
|
const {
|
|
@@ -3229,10 +3229,24 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3229
3229
|
exports.tester = exports.matcher = exports.Delimiters = void 0;
|
|
3230
3230
|
const parser_1 = __webpack_require__(605);
|
|
3231
3231
|
const context_1 = __webpack_require__(5745);
|
|
3232
|
+
const indexes = new Map();
|
|
3233
|
+
function index(source) {
|
|
3234
|
+
let x = 0;
|
|
3235
|
+
for (let i = 0; i < source.length; ++i) {
|
|
3236
|
+
const c = source.charCodeAt(i);
|
|
3237
|
+
x = x ^ c << 1 || ~x ^ c << 1; // 16+1bit
|
|
3238
|
+
|
|
3239
|
+
x ^= x << 13; // shift <= 32-17bit
|
|
3240
|
+
x ^= x >>> 17;
|
|
3241
|
+
x ^= x << 15;
|
|
3242
|
+
}
|
|
3243
|
+
x >>>= 3;
|
|
3244
|
+
x &= ~0 >>> 32 - 4;
|
|
3245
|
+
return x;
|
|
3246
|
+
}
|
|
3232
3247
|
class Delimiters {
|
|
3233
3248
|
constructor() {
|
|
3234
|
-
this.
|
|
3235
|
-
this.map = new Map();
|
|
3249
|
+
this.memories = [];
|
|
3236
3250
|
this.delimiters = [];
|
|
3237
3251
|
this.stack = [];
|
|
3238
3252
|
this.states = [];
|
|
@@ -3241,18 +3255,14 @@ class Delimiters {
|
|
|
3241
3255
|
static signature(pattern) {
|
|
3242
3256
|
switch (typeof pattern) {
|
|
3243
3257
|
case 'undefined':
|
|
3244
|
-
return
|
|
3258
|
+
return 0;
|
|
3245
3259
|
case 'string':
|
|
3246
|
-
|
|
3247
|
-
const code = pattern.charCodeAt(0);
|
|
3248
|
-
return code;
|
|
3249
|
-
}
|
|
3250
|
-
return `s:${pattern}`;
|
|
3260
|
+
return index(`'${pattern}`);
|
|
3251
3261
|
case 'object':
|
|
3252
|
-
return
|
|
3262
|
+
return index(`/${pattern.source}`);
|
|
3253
3263
|
}
|
|
3254
3264
|
}
|
|
3255
|
-
static
|
|
3265
|
+
static tester(pattern, after) {
|
|
3256
3266
|
switch (typeof pattern) {
|
|
3257
3267
|
case 'undefined':
|
|
3258
3268
|
return () => undefined;
|
|
@@ -3264,15 +3274,7 @@ class Delimiters {
|
|
|
3264
3274
|
}
|
|
3265
3275
|
}
|
|
3266
3276
|
registry(signature) {
|
|
3267
|
-
|
|
3268
|
-
return this.tree[signature] ??= [];
|
|
3269
|
-
} else {
|
|
3270
|
-
const ds = this.map.get(signature);
|
|
3271
|
-
if (ds) return ds;
|
|
3272
|
-
const blank = [];
|
|
3273
|
-
this.map.set(signature, blank);
|
|
3274
|
-
return blank;
|
|
3275
|
-
}
|
|
3277
|
+
return this.memories[signature] ??= [];
|
|
3276
3278
|
}
|
|
3277
3279
|
push(delims) {
|
|
3278
3280
|
const {
|
|
@@ -3284,7 +3286,7 @@ class Delimiters {
|
|
|
3284
3286
|
for (let i = 0; i < delims.length; ++i) {
|
|
3285
3287
|
const {
|
|
3286
3288
|
signature,
|
|
3287
|
-
|
|
3289
|
+
tester,
|
|
3288
3290
|
precedence
|
|
3289
3291
|
} = delims[i];
|
|
3290
3292
|
const memory = this.registry(signature);
|
|
@@ -3293,8 +3295,7 @@ class Delimiters {
|
|
|
3293
3295
|
const delimiter = {
|
|
3294
3296
|
memory,
|
|
3295
3297
|
index,
|
|
3296
|
-
|
|
3297
|
-
matcher,
|
|
3298
|
+
tester,
|
|
3298
3299
|
precedence,
|
|
3299
3300
|
state: true
|
|
3300
3301
|
};
|
|
@@ -3302,9 +3303,10 @@ class Delimiters {
|
|
|
3302
3303
|
memory.push(delimiter);
|
|
3303
3304
|
stack.push(index);
|
|
3304
3305
|
} else {
|
|
3306
|
+
// 現状各優先順位は固定
|
|
3307
|
+
|
|
3305
3308
|
stack.push(-1);
|
|
3306
3309
|
}
|
|
3307
|
-
// 現状各優先順位は固定
|
|
3308
3310
|
}
|
|
3309
3311
|
}
|
|
3310
3312
|
pop(count) {
|
|
@@ -3349,7 +3351,7 @@ class Delimiters {
|
|
|
3349
3351
|
delimiters[indexes[i]].state = true;
|
|
3350
3352
|
}
|
|
3351
3353
|
}
|
|
3352
|
-
|
|
3354
|
+
test(input) {
|
|
3353
3355
|
const {
|
|
3354
3356
|
precedence
|
|
3355
3357
|
} = input;
|
|
@@ -3359,7 +3361,7 @@ class Delimiters {
|
|
|
3359
3361
|
for (let i = delimiters.length; i--;) {
|
|
3360
3362
|
const delimiter = delimiters[i];
|
|
3361
3363
|
if (delimiter.precedence <= precedence || !delimiter.state) continue;
|
|
3362
|
-
switch (delimiter.
|
|
3364
|
+
switch (delimiter.tester(input)) {
|
|
3363
3365
|
case true:
|
|
3364
3366
|
return true;
|
|
3365
3367
|
case false:
|
|
@@ -3373,7 +3375,7 @@ class Delimiters {
|
|
|
3373
3375
|
}
|
|
3374
3376
|
exports.Delimiters = Delimiters;
|
|
3375
3377
|
function matcher(pattern, advance, after) {
|
|
3376
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3378
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3377
3379
|
switch (typeof pattern) {
|
|
3378
3380
|
case 'string':
|
|
3379
3381
|
if (pattern === '') return () => new parser_1.List([new parser_1.Node(pattern)]);
|
|
@@ -3411,7 +3413,7 @@ function matcher(pattern, advance, after) {
|
|
|
3411
3413
|
}
|
|
3412
3414
|
exports.matcher = matcher;
|
|
3413
3415
|
function tester(pattern, advance, after) {
|
|
3414
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3416
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3415
3417
|
switch (typeof pattern) {
|
|
3416
3418
|
case 'string':
|
|
3417
3419
|
if (pattern === '') return () => new parser_1.List();
|
|
@@ -3690,12 +3692,14 @@ exports.constraint = exports.state = exports.precedence = exports.recursions = e
|
|
|
3690
3692
|
const alias_1 = __webpack_require__(5413);
|
|
3691
3693
|
const assign_1 = __webpack_require__(9888);
|
|
3692
3694
|
function reset(base, parser) {
|
|
3695
|
+
const clock = base.resources?.clock;
|
|
3696
|
+
const recursions = base.resources?.recursions;
|
|
3693
3697
|
return input => {
|
|
3694
3698
|
const context = input;
|
|
3695
3699
|
// @ts-expect-error
|
|
3696
3700
|
context.resources ??= {
|
|
3697
|
-
clock
|
|
3698
|
-
recursions:
|
|
3701
|
+
clock,
|
|
3702
|
+
recursions: recursions?.slice()
|
|
3699
3703
|
};
|
|
3700
3704
|
context.backtracks = {};
|
|
3701
3705
|
return parser(input);
|
|
@@ -3885,7 +3889,7 @@ function inits(parsers) {
|
|
|
3885
3889
|
let nodes;
|
|
3886
3890
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3887
3891
|
if (context.position === source.length) break;
|
|
3888
|
-
if (context.delimiters.
|
|
3892
|
+
if (context.delimiters.test(input)) break;
|
|
3889
3893
|
const result = parsers[i](input);
|
|
3890
3894
|
if (result === undefined) break;
|
|
3891
3895
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -3918,7 +3922,7 @@ function sequence(parsers) {
|
|
|
3918
3922
|
let nodes;
|
|
3919
3923
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
3920
3924
|
if (context.position === source.length) return;
|
|
3921
|
-
if (context.delimiters.
|
|
3925
|
+
if (context.delimiters.test(input)) return;
|
|
3922
3926
|
const result = parsers[i](input);
|
|
3923
3927
|
if (result === undefined) return;
|
|
3924
3928
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -3952,10 +3956,10 @@ function some(parser, delimiter, after, delimiters, limit = -1) {
|
|
|
3952
3956
|
delimiters = after;
|
|
3953
3957
|
after = undefined;
|
|
3954
3958
|
}
|
|
3955
|
-
const match = delimiter_1.Delimiters.
|
|
3959
|
+
const match = delimiter_1.Delimiters.tester(delimiter, after);
|
|
3956
3960
|
const delims = delimiters?.map(([delimiter, precedence]) => ({
|
|
3957
3961
|
signature: delimiter_1.Delimiters.signature(delimiter),
|
|
3958
|
-
|
|
3962
|
+
tester: delimiter_1.Delimiters.tester(delimiter),
|
|
3959
3963
|
precedence
|
|
3960
3964
|
}));
|
|
3961
3965
|
return input => {
|
|
@@ -3970,7 +3974,7 @@ function some(parser, delimiter, after, delimiters, limit = -1) {
|
|
|
3970
3974
|
// whileは数倍遅い
|
|
3971
3975
|
for (const len = source.length; context.position < len;) {
|
|
3972
3976
|
if (match(input)) break;
|
|
3973
|
-
if (context.delimiters.
|
|
3977
|
+
if (context.delimiters.test(input)) break;
|
|
3974
3978
|
const result = parser(input);
|
|
3975
3979
|
if (result === undefined) break;
|
|
3976
3980
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -4153,7 +4157,6 @@ const context_1 = __webpack_require__(8669);
|
|
|
4153
4157
|
const parser_1 = __webpack_require__(605);
|
|
4154
4158
|
const segment_1 = __webpack_require__(3967);
|
|
4155
4159
|
const block_1 = __webpack_require__(7099);
|
|
4156
|
-
const normalize_1 = __webpack_require__(4490);
|
|
4157
4160
|
const header_1 = __webpack_require__(3652);
|
|
4158
4161
|
const figure_1 = __webpack_require__(1657);
|
|
4159
4162
|
const note_1 = __webpack_require__(165);
|
|
@@ -4179,13 +4182,12 @@ function bind(target, settings) {
|
|
|
4179
4182
|
function* parse(source) {
|
|
4180
4183
|
if (settings.chunk && revision) throw new Error('Chunks cannot be updated');
|
|
4181
4184
|
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
4182
|
-
source = (0, normalize_1.normalize)(source);
|
|
4183
4185
|
// @ts-expect-error
|
|
4184
4186
|
context.url = url ? new url_1.ReadonlyURL(url) : undefined;
|
|
4185
4187
|
const rev = revision = Symbol();
|
|
4186
4188
|
const sourceSegments = [];
|
|
4187
4189
|
const sourceSegmentAttrs = [];
|
|
4188
|
-
for (const [seg, attr] of (0, segment_1.segment)(source)) {
|
|
4190
|
+
for (const [seg, attr] of (0, segment_1.segment)(source, !context.local)) {
|
|
4189
4191
|
sourceSegments.push(seg);
|
|
4190
4192
|
sourceSegmentAttrs.push(attr);
|
|
4191
4193
|
yield {
|
|
@@ -4210,14 +4212,14 @@ function bind(target, settings) {
|
|
|
4210
4212
|
// @ts-expect-error
|
|
4211
4213
|
context.header = true;
|
|
4212
4214
|
for (; index < sourceSegments.length - last; ++index) {
|
|
4213
|
-
const
|
|
4215
|
+
const seg = sourceSegments[index];
|
|
4214
4216
|
context.segment = sourceSegmentAttrs[index] | 1 /* Segment.write */;
|
|
4215
|
-
const es = (0, block_1.block)((0, parser_1.input)(
|
|
4217
|
+
const es = (0, block_1.block)((0, parser_1.input)(seg, new context_1.Context(context))).foldl((acc, {
|
|
4216
4218
|
value
|
|
4217
|
-
}) => void acc.push(value) || acc, [])
|
|
4219
|
+
}) => void acc.push(value) || acc, []);
|
|
4218
4220
|
// @ts-expect-error
|
|
4219
4221
|
context.header = false;
|
|
4220
|
-
blocks.length === index ? blocks.push([
|
|
4222
|
+
blocks.length === index ? blocks.push([seg, es, url]) : blocks.splice(index, 0, [seg, es, url]);
|
|
4221
4223
|
if (es.length === 0) continue;
|
|
4222
4224
|
// All deletion processes always run after all addition processes have done.
|
|
4223
4225
|
// Therefore any `base` node will never be unavailable by deletions until all the dependent `el` nodes are added.
|
|
@@ -4397,7 +4399,7 @@ function header(source) {
|
|
|
4397
4399
|
exports.header = header;
|
|
4398
4400
|
function headers(source) {
|
|
4399
4401
|
const [el] = parse(source);
|
|
4400
|
-
return el?.textContent.trimEnd().slice(el.firstChild.firstChild.textContent.length).split(
|
|
4402
|
+
return el?.textContent.trimEnd().slice(el.firstChild.firstChild.textContent.length).split(/\r?\n/) ?? [];
|
|
4401
4403
|
}
|
|
4402
4404
|
exports.headers = headers;
|
|
4403
4405
|
function parse(source) {
|
|
@@ -4505,7 +4507,6 @@ const parser_1 = __webpack_require__(605);
|
|
|
4505
4507
|
const context_1 = __webpack_require__(8669);
|
|
4506
4508
|
const segment_1 = __webpack_require__(3967);
|
|
4507
4509
|
const block_1 = __webpack_require__(7099);
|
|
4508
|
-
const normalize_1 = __webpack_require__(4490);
|
|
4509
4510
|
const header_1 = __webpack_require__(3652);
|
|
4510
4511
|
const figure_1 = __webpack_require__(1657);
|
|
4511
4512
|
const note_1 = __webpack_require__(165);
|
|
@@ -4513,7 +4514,6 @@ const url_1 = __webpack_require__(1904);
|
|
|
4513
4514
|
const dom_1 = __webpack_require__(394);
|
|
4514
4515
|
function parse(source, options = {}, context) {
|
|
4515
4516
|
const url = (0, header_1.headers)(source).find(field => field.toLowerCase().startsWith('url:'))?.slice(4).trim() ?? '';
|
|
4516
|
-
source = !context ? (0, normalize_1.normalize)(source) : source;
|
|
4517
4517
|
context = new context_1.Context({
|
|
4518
4518
|
host: options.host ?? context?.host ?? new url_1.ReadonlyURL(location.pathname, location.origin),
|
|
4519
4519
|
url: url ? new url_1.ReadonlyURL(url) : context?.url,
|
|
@@ -4527,13 +4527,15 @@ function parse(source, options = {}, context) {
|
|
|
4527
4527
|
const node = (0, dom_1.frag)();
|
|
4528
4528
|
// @ts-expect-error
|
|
4529
4529
|
context.header = true;
|
|
4530
|
-
for (const [seg, attr] of (0, segment_1.segment)(source)) {
|
|
4530
|
+
for (const [seg, attr] of (0, segment_1.segment)(source, !context.local)) {
|
|
4531
4531
|
context.segment = attr | 1 /* Segment.write */;
|
|
4532
|
-
|
|
4532
|
+
const es = (0, block_1.block)((0, parser_1.input)(seg, new context_1.Context(context))).foldl((acc, {
|
|
4533
4533
|
value
|
|
4534
|
-
}) => void acc.push(value) || acc, [])
|
|
4534
|
+
}) => void acc.push(value) || acc, []);
|
|
4535
4535
|
// @ts-expect-error
|
|
4536
4536
|
context.header = false;
|
|
4537
|
+
if (es.length === 0) continue;
|
|
4538
|
+
node.append(...es);
|
|
4537
4539
|
}
|
|
4538
4540
|
if (options.test) return node;
|
|
4539
4541
|
for (const _ of (0, figure_1.figure)(node, options.notes, context));
|
|
@@ -4601,8 +4603,7 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4601
4603
|
// バックトラックのせいで文字数制限を受けないようにする。
|
|
4602
4604
|
clock: segment_1.MAX_SEGMENT_SIZE * 6 + 1,
|
|
4603
4605
|
recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.annotation */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
|
|
4604
|
-
}
|
|
4605
|
-
backtracks: {}
|
|
4606
|
+
}
|
|
4606
4607
|
}, error((0, combinator_1.union)([source_1.emptysegment, input => {
|
|
4607
4608
|
const {
|
|
4608
4609
|
source,
|
|
@@ -4618,8 +4619,8 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4618
4619
|
case 10 /* Segment.figure */:
|
|
4619
4620
|
return (0, figure_1.figure)(input);
|
|
4620
4621
|
}
|
|
4621
|
-
const
|
|
4622
|
-
switch (
|
|
4622
|
+
const char = source[position];
|
|
4623
|
+
switch (char) {
|
|
4623
4624
|
case "\u0007" /* Command.Error */:
|
|
4624
4625
|
throw new Error((0, combinator_1.firstline)(source, position + 1).trimEnd());
|
|
4625
4626
|
case '=':
|
|
@@ -4662,11 +4663,11 @@ exports.block = (0, combinator_1.reset)({
|
|
|
4662
4663
|
case '(':
|
|
4663
4664
|
return (0, olist_1.olist)(input);
|
|
4664
4665
|
default:
|
|
4665
|
-
if ('0' <=
|
|
4666
|
+
if ('0' <= char && char <= '9') return (0, olist_1.olist)(input);
|
|
4666
4667
|
}
|
|
4667
4668
|
}, paragraph_1.paragraph])));
|
|
4668
4669
|
function error(parser) {
|
|
4669
|
-
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}[^\n]*\n`);
|
|
4670
|
+
const reg = new RegExp(String.raw`^${"\u0007" /* Command.Error */}[^\r\n]*\r?\n`);
|
|
4670
4671
|
return (0, combinator_1.recover)(parser, ({
|
|
4671
4672
|
source,
|
|
4672
4673
|
position,
|
|
@@ -4741,7 +4742,7 @@ const combinator_1 = __webpack_require__(3484);
|
|
|
4741
4742
|
const autolink_1 = __webpack_require__(1671);
|
|
4742
4743
|
const util_1 = __webpack_require__(4992);
|
|
4743
4744
|
const dom_1 = __webpack_require__(394);
|
|
4744
|
-
const opener = /(`{3,})(?!`)([^\n]*)(?:$|\n)/y;
|
|
4745
|
+
const opener = /(`{3,})(?!`)([^\r\n]*)(?:$|\r?\n)/y;
|
|
4745
4746
|
const language = /^[0-9a-z]+(?:-[a-z][0-9a-z]*)*$/i;
|
|
4746
4747
|
exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300)));
|
|
4747
4748
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
|
|
@@ -4972,7 +4973,7 @@ const table_1 = __webpack_require__(3646);
|
|
|
4972
4973
|
const blockquote_1 = __webpack_require__(5885);
|
|
4973
4974
|
const placeholder_1 = __webpack_require__(4091);
|
|
4974
4975
|
const inline_1 = __webpack_require__(7973);
|
|
4975
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]), true, 8 /* Segment.fig */);
|
|
4976
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.close)(label_1.segment, /(?!\S).*\r?\n/y)), (0, combinator_1.union)([codeblock_1.segment, mathblock_1.segment, table_1.segment, blockquote_1.segment, placeholder_1.segment, (0, combinator_1.some)(source_1.contentline)])]), true, 8 /* Segment.fig */);
|
|
4976
4977
|
exports.fig = (0, combinator_1.block)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.verify)((0, combinator_1.convert)((source, context) => {
|
|
4977
4978
|
// Bug: TypeScript
|
|
4978
4979
|
const fence = (/^[^\n]*\n!?>+ /.test(source) && source.match(/^~{3,}(?=[^\S\n]*$)/gm) || []).reduce((max, fence) => fence > max ? fence : max, '~~') + '~';
|
|
@@ -5046,7 +5047,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5046
5047
|
const util_1 = __webpack_require__(4992);
|
|
5047
5048
|
const memoize_1 = __webpack_require__(6925);
|
|
5048
5049
|
const dom_1 = __webpack_require__(394);
|
|
5049
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure )?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\n]*(?:$|\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
|
|
5050
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.match)(/(~{3,})(?:figure )?(?=\[?\$)/y, (0, memoize_1.memoize)(([, fence], closer = new RegExp(String.raw`${fence}[^\S\r\n]*(?:$|\r?\n)`, 'y')) => (0, combinator_1.close)((0, combinator_1.sequence)([source_1.contentline, (0, combinator_1.inits)([
|
|
5050
5051
|
// All parsers which can include closing terms.
|
|
5051
5052
|
(0, combinator_1.union)([codeblock_1.segment_, mathblock_1.segment_, table_2.segment_, blockquote_1.segment, placeholder_1.segment_, (0, combinator_1.some)(source_1.contentline, closer)]), source_1.emptyline, (0, combinator_1.union)([source_1.emptyline, (0, combinator_1.some)(source_1.contentline, closer)])])]), closer), ([, fence]) => fence.length - 1, [], 2 ** 4 - 1)), true, 10 /* Segment.figure */);
|
|
5052
5053
|
exports.figure = (0, combinator_1.block)((0, combinator_1.fallback)((0, combinator_1.rewrite)(exports.segment, (0, combinator_1.fmap)((0, combinator_1.convert)(source => source.slice(source.match(/^~+(?:\w+\s+)?/)[0].length, source.trimEnd().lastIndexOf('\n')), (0, combinator_1.sequence)([(0, combinator_1.line)((0, combinator_1.sequence)([label_1.label, (0, source_1.str)(/(?!\S).*\n/y)])), (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([ulist_1.ulist, olist_1.olist, table_1.table, codeblock_1.codeblock, mathblock_1.mathblock, example_1.example, table_2.table, blockquote_1.blockquote, placeholder_1.placeholder, (0, combinator_1.line)(inline_1.media), (0, combinator_1.line)(inline_1.lineshortmedia)])), source_1.emptyline, (0, combinator_1.block)((0, visibility_1.visualize)((0, visibility_1.trimBlank)((0, combinator_1.some)(inline_1.inline))))])])), nodes => {
|
|
@@ -5156,7 +5157,7 @@ exports.message = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_
|
|
|
5156
5157
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('section', {
|
|
5157
5158
|
class: `message`,
|
|
5158
5159
|
'data-type': type
|
|
5159
|
-
}, [...(0, segment_1.segment)(body)].reduce((acc, [seg]) => (0, array_1.push)(acc, (0, util_1.unwrap)(content((0, parser_1.subinput)(seg, context)))), [(0, dom_1.html)('h1', title(type))])))]);
|
|
5160
|
+
}, [...(0, segment_1.segment)(body, false)].reduce((acc, [seg]) => (0, array_1.push)(acc, (0, util_1.unwrap)(content((0, parser_1.subinput)(seg, context)))), [(0, dom_1.html)('h1', title(type))])))]);
|
|
5160
5161
|
}));
|
|
5161
5162
|
function title(type) {
|
|
5162
5163
|
switch (type) {
|
|
@@ -5187,7 +5188,7 @@ const parser_1 = __webpack_require__(605);
|
|
|
5187
5188
|
const combinator_1 = __webpack_require__(3484);
|
|
5188
5189
|
const util_1 = __webpack_require__(4992);
|
|
5189
5190
|
const dom_1 = __webpack_require__(394);
|
|
5190
|
-
const opener = /(~{3,})(?!~)[^\n]*(?:$|\n)/y;
|
|
5191
|
+
const opener = /(~{3,})(?!~)[^\r\n]*(?:$|\r?\n)/y;
|
|
5191
5192
|
exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300)));
|
|
5192
5193
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
|
|
5193
5194
|
exports.placeholder = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, Infinity), nodes => {
|
|
@@ -5220,7 +5221,7 @@ const visibility_1 = __webpack_require__(6364);
|
|
|
5220
5221
|
const alias_1 = __webpack_require__(5413);
|
|
5221
5222
|
const array_1 = __webpack_require__(6876);
|
|
5222
5223
|
const dom_1 = __webpack_require__(394);
|
|
5223
|
-
const opener = /(~{3,})table(?:\/(\S+))?(?!\S)([^\n]*)(?:$|\n)/y;
|
|
5224
|
+
const opener = /(~{3,})table(?:\/(\S+))?(?!\S)([^\r\n]*)(?:$|\r?\n)/y;
|
|
5224
5225
|
exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000)));
|
|
5225
5226
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 10000, false)), false);
|
|
5226
5227
|
exports.table = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 10000),
|
|
@@ -5477,7 +5478,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
5477
5478
|
const visibility_1 = __webpack_require__(6364);
|
|
5478
5479
|
const util_1 = __webpack_require__(4992);
|
|
5479
5480
|
const dom_1 = __webpack_require__(394);
|
|
5480
|
-
exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\n]*(?:\n#+(?=$|
|
|
5481
|
+
exports.segment = (0, combinator_1.block)((0, combinator_1.focus)(/#+ +\S[^\r\n]*(?:\r?\n#+(?=$| |\r?\n)[^\r\n]*)*(?:$|\r?\n)/y, input => {
|
|
5481
5482
|
const context = input;
|
|
5482
5483
|
const {
|
|
5483
5484
|
source,
|
|
@@ -5554,7 +5555,7 @@ const parser_1 = __webpack_require__(605);
|
|
|
5554
5555
|
const combinator_1 = __webpack_require__(3484);
|
|
5555
5556
|
const util_1 = __webpack_require__(4992);
|
|
5556
5557
|
const dom_1 = __webpack_require__(394);
|
|
5557
|
-
const opener = /(\${2,})(?!\$)([^\n]*)(?:$|\n)/y;
|
|
5558
|
+
const opener = /(\${2,})(?!\$)([^\r\n]*)(?:$|\r?\n)/y;
|
|
5558
5559
|
exports.segment = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300)));
|
|
5559
5560
|
exports.segment_ = (0, combinator_1.block)((0, combinator_1.clear)((0, combinator_1.fence)(opener, 300, false)), false);
|
|
5560
5561
|
exports.mathblock = (0, combinator_1.block)((0, combinator_1.fmap)((0, combinator_1.fence)(opener, 300),
|
|
@@ -6079,7 +6080,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6079
6080
|
const util_1 = __webpack_require__(4992);
|
|
6080
6081
|
const normalize_1 = __webpack_require__(4490);
|
|
6081
6082
|
const dom_1 = __webpack_require__(394);
|
|
6082
|
-
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\n]*\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\n]*\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1[^\S\n]*(?:$|\n)/yi, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
6083
|
+
exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^\S\r\n]*\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(context => context.header, (0, combinator_1.focus)(/(---+)[^\S\r\n]*\r?\n(?:[a-z][0-9a-z]*(?:-[0-9a-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1[^\S\r\n]*(?:$|\r?\n)/yi, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Node((0, dom_1.html)('aside', {
|
|
6083
6084
|
class: 'header'
|
|
6084
6085
|
}, [(0, dom_1.html)('details', {
|
|
6085
6086
|
open: ''
|
|
@@ -6094,7 +6095,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+[^
|
|
|
6094
6095
|
translate: 'no',
|
|
6095
6096
|
...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
|
|
6096
6097
|
}, (0, normalize_1.normalize)(source.slice(position))))]);
|
|
6097
|
-
}])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\n]*\n/y))])));
|
|
6098
|
+
}])), (0, combinator_1.clear)((0, source_1.str)(/[^\S\r\n]*\r?\n/y))])));
|
|
6098
6099
|
const field = (0, combinator_1.line)(({
|
|
6099
6100
|
source,
|
|
6100
6101
|
position
|
|
@@ -6181,7 +6182,8 @@ exports.inline = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
6181
6182
|
case '{':
|
|
6182
6183
|
return (0, bracket_1.bracket)(input);
|
|
6183
6184
|
case '<':
|
|
6184
|
-
return (0, html_1.html)(input);
|
|
6185
|
+
if (isAlphabet(source[position + 1])) return (0, html_1.html)(input);
|
|
6186
|
+
break;
|
|
6185
6187
|
case '$':
|
|
6186
6188
|
if (source[position + 1] === '{') return (0, math_1.math)(input);
|
|
6187
6189
|
return (0, label_1.label)(input) || (0, math_1.math)(input);
|
|
@@ -6253,6 +6255,9 @@ Object.defineProperty(exports, "lineshortmedia", ({
|
|
|
6253
6255
|
return shortmedia_1.lineshortmedia;
|
|
6254
6256
|
}
|
|
6255
6257
|
}));
|
|
6258
|
+
function isAlphabet(char) {
|
|
6259
|
+
return 'a' <= char && char <= 'z';
|
|
6260
|
+
}
|
|
6256
6261
|
|
|
6257
6262
|
/***/ },
|
|
6258
6263
|
|
|
@@ -6429,8 +6434,8 @@ exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.state)(~1 /* St
|
|
|
6429
6434
|
position
|
|
6430
6435
|
} = input;
|
|
6431
6436
|
if (position === source.length) return;
|
|
6432
|
-
const
|
|
6433
|
-
switch (
|
|
6437
|
+
const char = source[position];
|
|
6438
|
+
switch (char) {
|
|
6434
6439
|
case '@':
|
|
6435
6440
|
return (0, account_1.account)(input);
|
|
6436
6441
|
case '#':
|
|
@@ -6456,7 +6461,7 @@ exports.autolink = (0, combinator_1.lazy)(() => (0, combinator_1.state)(~1 /* St
|
|
|
6456
6461
|
}
|
|
6457
6462
|
return (0, url_1.url)(input) || (0, email_1.email)(input);
|
|
6458
6463
|
default:
|
|
6459
|
-
if ((0, text_1.isAlphanumeric)(
|
|
6464
|
+
if ((0, text_1.isAlphanumeric)(char)) return (0, email_1.email)(input);
|
|
6460
6465
|
}
|
|
6461
6466
|
}));
|
|
6462
6467
|
|
|
@@ -6667,8 +6672,8 @@ const link_1 = __webpack_require__(3628);
|
|
|
6667
6672
|
const source_1 = __webpack_require__(8745);
|
|
6668
6673
|
const util_1 = __webpack_require__(4992);
|
|
6669
6674
|
const dom_1 = __webpack_require__(394);
|
|
6670
|
-
exports.indexA =
|
|
6671
|
-
const indexF = new RegExp(exports.indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)), '
|
|
6675
|
+
exports.indexA = /^[0-9A-Za-z]+(?:(?:[.-]|, )[0-9A-Za-z]+)*$/;
|
|
6676
|
+
const indexF = new RegExp(exports.indexA.source.replace(', ', '[,、]').replace(/[09AZaz.]|\-(?!\w)/g, c => String.fromCodePoint(c.codePointAt(0) + 0xFEE0)), '');
|
|
6672
6677
|
function bracketname(context, syntax, opener, closer) {
|
|
6673
6678
|
const {
|
|
6674
6679
|
source,
|
|
@@ -6677,7 +6682,7 @@ function bracketname(context, syntax, opener, closer) {
|
|
|
6677
6682
|
linebreak
|
|
6678
6683
|
} = context;
|
|
6679
6684
|
syntax.lastIndex = position - range + opener;
|
|
6680
|
-
return range - opener - closer === 0 || linebreak === 0 && range - opener - closer <= 16 && syntax.test(source
|
|
6685
|
+
return range - opener - closer === 0 || linebreak === 0 && range - opener - closer <= 16 && syntax.test(source.slice(position - range + opener, position - closer)) ? 'paren' : 'bracket';
|
|
6681
6686
|
}
|
|
6682
6687
|
exports.bracketname = bracketname;
|
|
6683
6688
|
exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input => {
|
|
@@ -7283,7 +7288,7 @@ exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
|
|
|
7283
7288
|
Object.defineProperty(exports, "__esModule", ({
|
|
7284
7289
|
value: true
|
|
7285
7290
|
}));
|
|
7286
|
-
exports.attributes = exports.attribute = exports.html = void 0;
|
|
7291
|
+
exports.TAGS = exports.attributes = exports.attribute = exports.html = void 0;
|
|
7287
7292
|
const parser_1 = __webpack_require__(605);
|
|
7288
7293
|
const combinator_1 = __webpack_require__(3484);
|
|
7289
7294
|
const inline_1 = __webpack_require__(7973);
|
|
@@ -7301,16 +7306,16 @@ const attrspecs = {
|
|
|
7301
7306
|
};
|
|
7302
7307
|
Object.setPrototypeOf(attrspecs, null);
|
|
7303
7308
|
Object.values(attrspecs).forEach(o => Object.setPrototypeOf(o, null));
|
|
7304
|
-
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.
|
|
7309
|
+
exports.html = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)(
|
|
7305
7310
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7306
|
-
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context), as.head.value === '<wbr' ? 1 /* Flag.blank */ : 0 /* Flag.none */)]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${TAGS.join('|')})(?=[ >])`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.precedence)(9, (0, combinator_1.some)(exports.attribute)), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
|
|
7311
|
+
(0, source_1.str)(/<(?:area|base|br|col|embed|hr|img|input|link|meta|source|track|wbr)(?=[ >])/y), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context), as.head.value === '<wbr' ? 1 /* Flag.blank */ : 0 /* Flag.none */)]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))])), (0, combinator_1.match)(new RegExp(String.raw`<(${exports.TAGS.join('|')})(?=[ >])`, 'y'), (0, memoize_1.memoize)(([, tag]) => (0, combinator_1.surround)((0, combinator_1.surround)((0, source_1.str)(`<${tag}`), (0, combinator_1.precedence)(9, (0, combinator_1.some)(exports.attribute)), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs]) => as.import(bs).import(cs), ([as, bs = new parser_1.List()]) => as.import(bs)),
|
|
7307
7312
|
// 不可視のHTML構造が可視構造を変化させるべきでない。
|
|
7308
7313
|
// 可視のHTMLは優先度変更を検討する。
|
|
7309
7314
|
// このため`<>`記号は将来的に共通構造を変化させる可能性があり
|
|
7310
7315
|
// 共通構造を変化させない非構造文字列としては依然としてエスケープを要する。
|
|
7311
|
-
(0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag,
|
|
7316
|
+
(0, combinator_1.precedence)(0, (0, combinator_1.recursion)(3 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', `</${tag}>`)), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, `</${tag}>`), true)])))), (0, source_1.str)(`</${tag}>`), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, cs, context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(tag, true, [...(0, util_1.unwrap)(as)], bs, new parser_1.List(), context))])), ([, tag]) => tag2index(tag), Array(exports.TAGS.length))), (0, combinator_1.surround)(
|
|
7312
7317
|
// https://html.spec.whatwg.org/multipage/syntax.html#void-elements
|
|
7313
|
-
(0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))]))
|
|
7318
|
+
(0, source_1.str)(/<[a-z]+(?=[ >])/yi), (0, combinator_1.precedence)(9, (0, combinator_1.some)((0, combinator_1.union)([exports.attribute]))), (0, combinator_1.open)((0, source_1.str)(/ ?/y), (0, source_1.str)('>'), true), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs).import(cs))], new parser_1.List(), new parser_1.List(), context))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node(elem(as.head.value.slice(1), false, [...(0, util_1.unwrap)(as.import(bs))], new parser_1.List(), new parser_1.List(), context))]))]));
|
|
7314
7319
|
exports.attribute = (0, combinator_1.union)([(0, source_1.str)(/ [a-z]+(?:-[a-z]+)*(?:="(?:\\[^\n]|[^\\\n"])*")?(?=[ >])/yi), (0, source_1.str)(/ [^\s<>]+/y)]);
|
|
7315
7320
|
function elem(tag, content, as, bs, cs, context) {
|
|
7316
7321
|
if (!tags.includes(tag)) return ielem('tag', `Invalid HTML tag name "${tag}"`, context);
|
|
@@ -7362,7 +7367,8 @@ function attributes(syntax, spec, params) {
|
|
|
7362
7367
|
exports.attributes = attributes;
|
|
7363
7368
|
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
7364
7369
|
// [...document.querySelectorAll('tbody > tr > td:first-child')].map(el => el.textContent.slice(1, -1))
|
|
7365
|
-
|
|
7370
|
+
exports.TAGS = ["html", "base", "head", "link", "meta", "style", "title", "body", "address", "article", "aside", "footer", "header", "h1", "h2", "h3", "h4", "h5", "h6", "hgroup", "main", "nav", "section", "blockquote", "dd", "div", "dl", "dt", "figcaption", "figure", "hr", "li", "menu", "ol", "p", "pre", "ul", "a", "abbr", "b", "bdi", "bdo", "br", "cite", "code", "data", "dfn", "em", "i", "kbd", "mark", "q", "rp", "rt", "ruby", "s", "samp", "small", "span", "strong", "sub", "sup", "time", "u", "var", "wbr", "area", "audio", "img", "map", "track", "video", "embed", "iframe", "object", "picture", "portal", "source", "svg", "math", "canvas", "noscript", "script", "del", "ins", "caption", "col", "colgroup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "button", "datalist", "fieldset", "form", "input", "label", "legend", "meter", "optgroup", "option", "output", "progress", "select", "textarea", "details", "dialog", "summary", "slot", "template", "acronym", "applet", "bgsound", "big", "blink", "center", "content", "dir", "font", "frame", "frameset", "image", "keygen", "marquee", "menuitem", "nobr", "noembed", "noframes", "param", "plaintext", "rb", "rtc", "shadow", "spacer", "strike", "tt", "xmp"];
|
|
7371
|
+
const tag2index = eval(['tag => {', 'switch(tag){', exports.TAGS.map((tag, i) => `case '${tag}':return ${i};`).join(''), 'default: throw new Error();', '}', '}'].join(''));
|
|
7366
7372
|
|
|
7367
7373
|
/***/ },
|
|
7368
7374
|
|
|
@@ -8421,6 +8427,7 @@ const codeblock_1 = __webpack_require__(9194);
|
|
|
8421
8427
|
const mathblock_1 = __webpack_require__(4903);
|
|
8422
8428
|
const extension_1 = __webpack_require__(6193);
|
|
8423
8429
|
const source_1 = __webpack_require__(8745);
|
|
8430
|
+
const api_1 = __webpack_require__(5886);
|
|
8424
8431
|
exports.MAX_SEGMENT_SIZE = 100_000; // 100,000 bytes (Max value size of FDB)
|
|
8425
8432
|
exports.MAX_INPUT_SIZE = exports.MAX_SEGMENT_SIZE * 10;
|
|
8426
8433
|
const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptysegment, exports.MAX_SEGMENT_SIZE + 1), input => {
|
|
@@ -8446,8 +8453,8 @@ const parser = (0, combinator_1.union)([(0, combinator_1.some)(source_1.emptyseg
|
|
|
8446
8453
|
return (0, heading_1.segment)(input);
|
|
8447
8454
|
}
|
|
8448
8455
|
}, (0, combinator_1.some)(source_1.contentline, exports.MAX_SEGMENT_SIZE + 1)]);
|
|
8449
|
-
function* segment(source) {
|
|
8450
|
-
if (!validate(source, exports.MAX_INPUT_SIZE)) return yield [`${"\u0007" /* Command.Error */}Too large input over ${exports.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`, 0 /* Segment.unknown */];
|
|
8456
|
+
function* segment(source, initial = true) {
|
|
8457
|
+
if (initial && !validate(source, exports.MAX_INPUT_SIZE)) return yield [`${"\u0007" /* Command.Error */}Too large input over ${exports.MAX_INPUT_SIZE.toLocaleString('en')} bytes.\n${source.slice(0, 1001)}`, 0 /* Segment.unknown */];
|
|
8451
8458
|
for (let position = 0; position < source.length;) {
|
|
8452
8459
|
const context = new context_1.Context({
|
|
8453
8460
|
source,
|
|
@@ -8460,13 +8467,13 @@ function* segment(source) {
|
|
|
8460
8467
|
position = context.position;
|
|
8461
8468
|
for (let i = 0; i < segs.length; ++i) {
|
|
8462
8469
|
const seg = segs[i];
|
|
8463
|
-
validate(seg, exports.MAX_SEGMENT_SIZE) ? yield [
|
|
8470
|
+
initial && !validate(seg, exports.MAX_SEGMENT_SIZE) ? yield [`${"\u0007" /* Command.Error */}Too large segment over ${exports.MAX_SEGMENT_SIZE.toLocaleString('en')} bytes.\n${seg}`, 0 /* Segment.unknown */] : yield [initial ? (0, api_1.normalize)(seg) : seg, context.segment];
|
|
8464
8471
|
}
|
|
8465
8472
|
}
|
|
8466
8473
|
}
|
|
8467
8474
|
exports.segment = segment;
|
|
8468
8475
|
function validate(source, size) {
|
|
8469
|
-
return source.length <= size /
|
|
8476
|
+
return source.length <= size / 2 || source.length <= size && new Blob([source]).size <= size;
|
|
8470
8477
|
}
|
|
8471
8478
|
exports.validate = validate;
|
|
8472
8479
|
|
|
@@ -8592,7 +8599,6 @@ const escsource = context => {
|
|
|
8592
8599
|
return new parser_1.List([new parser_1.Node(source.slice(position, position + 2))]);
|
|
8593
8600
|
}
|
|
8594
8601
|
case '\r':
|
|
8595
|
-
(0, combinator_1.consume)(-1, context);
|
|
8596
8602
|
return new parser_1.List();
|
|
8597
8603
|
case '\n':
|
|
8598
8604
|
context.linebreak ||= source.length - position;
|
|
@@ -8632,7 +8638,7 @@ const anyline = input => {
|
|
|
8632
8638
|
return new parser_1.List();
|
|
8633
8639
|
};
|
|
8634
8640
|
exports.anyline = anyline;
|
|
8635
|
-
const regEmptyline = /[^\S\n]*(?:$|\n)/y;
|
|
8641
|
+
const regEmptyline = /[^\S\r\n]*(?:$|\r?\n)/y;
|
|
8636
8642
|
const emptyline = input => {
|
|
8637
8643
|
const context = input;
|
|
8638
8644
|
const {
|
|
@@ -8667,12 +8673,13 @@ const emptysegment = input => {
|
|
|
8667
8673
|
};
|
|
8668
8674
|
exports.emptysegment = emptysegment;
|
|
8669
8675
|
function eoel(source, position) {
|
|
8670
|
-
|
|
8676
|
+
const char = source[position];
|
|
8677
|
+
if (char === '\n' || char === '\r' && source[position + 1] === '\n') return position + 1;
|
|
8671
8678
|
regEmptyline.lastIndex = position;
|
|
8672
8679
|
regEmptyline.test(source);
|
|
8673
8680
|
return regEmptyline.lastIndex || position;
|
|
8674
8681
|
}
|
|
8675
|
-
const regContentline = /[^\S\n]*\S[^\n]*(?:$|\n)/y;
|
|
8682
|
+
const regContentline = /[^\S\r\n]*\S[^\r\n]*(?:$|\r?\n)/y;
|
|
8676
8683
|
const contentline = input => {
|
|
8677
8684
|
const context = input;
|
|
8678
8685
|
const {
|
|
@@ -8680,7 +8687,8 @@ const contentline = input => {
|
|
|
8680
8687
|
position
|
|
8681
8688
|
} = context;
|
|
8682
8689
|
if (position === source.length) return;
|
|
8683
|
-
|
|
8690
|
+
const char = source[position];
|
|
8691
|
+
if (char === '\n' || char === '\r' && source[position + 1] === '\n') return;
|
|
8684
8692
|
regContentline.lastIndex = position;
|
|
8685
8693
|
regContentline.test(source);
|
|
8686
8694
|
const i = regContentline.lastIndex;
|
|
@@ -8764,7 +8772,6 @@ const text = input => {
|
|
|
8764
8772
|
return new parser_1.List([new parser_1.Node(source.slice(position + 1, context.position))]);
|
|
8765
8773
|
}
|
|
8766
8774
|
case '\r':
|
|
8767
|
-
(0, combinator_1.consume)(-1, context);
|
|
8768
8775
|
return new parser_1.List();
|
|
8769
8776
|
case '\n':
|
|
8770
8777
|
context.linebreak ||= source.length - position;
|
|
@@ -8883,8 +8890,8 @@ function isAlphanumeric(char) {
|
|
|
8883
8890
|
exports.isAlphanumeric = isAlphanumeric;
|
|
8884
8891
|
function seek(source, position, state) {
|
|
8885
8892
|
for (let i = position + 1; i < source.length; ++i) {
|
|
8886
|
-
const
|
|
8887
|
-
switch (
|
|
8893
|
+
const char = source[i];
|
|
8894
|
+
switch (char) {
|
|
8888
8895
|
case '\\':
|
|
8889
8896
|
case '!':
|
|
8890
8897
|
case '$':
|
|
@@ -8916,10 +8923,10 @@ function seek(source, position, state) {
|
|
|
8916
8923
|
case '+':
|
|
8917
8924
|
case '~':
|
|
8918
8925
|
case '=':
|
|
8919
|
-
if (source[i + 1] ===
|
|
8926
|
+
if (source[i + 1] === char) return i;
|
|
8920
8927
|
continue;
|
|
8921
8928
|
case '/':
|
|
8922
|
-
if (source[i + 1] ===
|
|
8929
|
+
if (source[i + 1] === char && source[i + 2] === char) return i;
|
|
8923
8930
|
continue;
|
|
8924
8931
|
case '%':
|
|
8925
8932
|
if (source[i + 1] === ']' && isWhitespace(source[i - 1], true)) return i;
|