@limetech/lime-elements 40.5.2 → 40.5.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 +14 -0
- package/dist/cjs/{_baseEach-Bygi-un6.js → _baseForOwn-8jMPwf3X.js} +1 -43
- package/dist/cjs/{_baseIsEqual-CQZKiKbe.js → _baseIsEqual-zzV9DKMv.js} +0 -1
- package/dist/cjs/{_baseIteratee-DDklwtn9.js → _baseIteratee-BIMRm4nq.js} +1 -3
- package/dist/cjs/_baseSet-DykMx7uF.js +92 -0
- package/dist/cjs/_getPrototype-CCLHkBHj.js +8 -0
- package/dist/cjs/{cloneDeep-hE40Q8aw.js → cloneDeep-D2immmwT.js} +16 -160
- package/dist/cjs/{difference-B543MGsY.js → isArrayLikeObject-U2Ddbw4n.js} +5 -93
- package/dist/cjs/{isEqual-Cd9J8a5-.js → isEqual-D3eFkhqd.js} +1 -1
- package/dist/cjs/limel-action-bar_3.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip-set.cjs.entry.js +2 -2
- package/dist/cjs/limel-dialog.cjs.entry.js +2 -2
- package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +45 -6
- package/dist/cjs/limel-file-viewer.cjs.entry.js +510 -70
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +73 -11
- package/dist/cjs/limel-form.cjs.entry.js +1857 -1919
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +326 -262
- package/dist/cjs/limel-tab-bar.cjs.entry.js +83 -4
- package/dist/cjs/limel-table.cjs.entry.js +598 -199
- package/dist/collection/components/action-bar/action-bar-item/action-bar-item.css +1 -1
- package/dist/collection/components/form/fields/schema-field.js +8 -0
- package/dist/collection/components/form/form.js +1 -0
- package/dist/collection/components/form/form.test-schemas.js +47 -0
- package/dist/collection/components/form/templates/array-field-collapsible-item.js +38 -11
- package/dist/collection/components/table/table.css +1 -2
- package/dist/esm/{_baseEach-lvj-g1Zj.js → _baseForOwn-D5j7fHlv.js} +2 -42
- package/dist/esm/{_baseIsEqual-B6bIeexY.js → _baseIsEqual-CyF4P8uM.js} +2 -2
- package/dist/esm/{_baseIteratee-CEZRuq23.js → _baseIteratee-CpbczHY1.js} +3 -3
- package/dist/esm/_baseSet-Cw2IE6ZF.js +89 -0
- package/dist/esm/_getPrototype-B0kMNv1F.js +6 -0
- package/dist/esm/{_getTag-CMJL-6hk.js → _getTag-BiAaLWvH.js} +1 -1
- package/dist/esm/{cloneDeep-CL7UD3mR.js → cloneDeep-DAbOtbs8.js} +18 -154
- package/dist/esm/{difference-DND5tWiA.js → isArrayLikeObject-CJB8HbtH.js} +7 -91
- package/dist/esm/{isEmpty-DHgukT5k.js → isEmpty-BGVZ12Ea.js} +1 -1
- package/dist/esm/{isEqual-4tbMaaf_.js → isEqual-CE83yS8T.js} +1 -1
- package/dist/esm/limel-action-bar_3.entry.js +1 -1
- package/dist/esm/limel-chip-set.entry.js +3 -3
- package/dist/esm/limel-chip_2.entry.js +2 -2
- package/dist/esm/limel-dialog.entry.js +3 -3
- package/dist/esm/limel-file-dropzone_2.entry.js +45 -6
- package/dist/esm/limel-file-viewer.entry.js +510 -70
- package/dist/esm/limel-flatpickr-adapter.entry.js +69 -7
- package/dist/esm/limel-form.entry.js +1854 -1916
- package/dist/esm/limel-prosemirror-adapter.entry.js +327 -263
- package/dist/esm/limel-tab-bar.entry.js +83 -4
- package/dist/esm/limel-table.entry.js +595 -196
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-05afb316.entry.js +1 -0
- package/dist/lime-elements/p-0fba64eb.entry.js +16 -0
- package/dist/lime-elements/p-10594468.entry.js +1 -0
- package/dist/lime-elements/p-19344984.entry.js +13 -0
- package/dist/lime-elements/p-26c5c6b9.entry.js +1 -0
- package/dist/lime-elements/{p-11a96a8c.entry.js → p-36ce4fbc.entry.js} +1 -1
- package/dist/lime-elements/{p-955292eb.entry.js → p-4aae63bd.entry.js} +1 -1
- package/dist/lime-elements/{p-b8c76487.entry.js → p-5d974afa.entry.js} +1 -1
- package/dist/lime-elements/p-B6-3WXAv.js +1 -0
- package/dist/lime-elements/p-BQeIv4aA.js +1 -0
- package/dist/lime-elements/p-BY5NjPj8.js +1 -0
- package/dist/lime-elements/p-COdirXg1.js +1 -0
- package/dist/lime-elements/p-CW2-jhzP.js +1 -0
- package/dist/lime-elements/p-D2VFSWDU.js +1 -0
- package/dist/lime-elements/{p-D4RdItCq.js → p-DK0pjX-Y.js} +1 -1
- package/dist/lime-elements/p-ORUNaKm-.js +1 -0
- package/dist/lime-elements/{p-5b371d6b.entry.js → p-a71f6e87.entry.js} +4 -4
- package/dist/lime-elements/p-cef66e53.entry.js +1 -0
- package/dist/lime-elements/{p-02812dc8.entry.js → p-d3bd4b80.entry.js} +1 -1
- package/dist/lime-elements/p-nVemxylR.js +1 -0
- package/dist/lime-elements/p-pk5KIdKH.js +1 -0
- package/dist/types/components/form/form.test-schemas.d.ts +3 -0
- package/dist/types/components/form/templates/array-field-collapsible-item.d.ts +0 -1
- package/package.json +11 -11
- package/dist/cjs/_getAllKeysIn-BJsgUTAt.js +0 -119
- package/dist/cjs/_isIterateeCall-BUGt9SrH.js +0 -73
- package/dist/cjs/pickBy-D-X6S5kg.js +0 -201
- package/dist/esm/_getAllKeysIn-kT3KizYN.js +0 -114
- package/dist/esm/_isIterateeCall-Bb4gUZLK.js +0 -70
- package/dist/esm/pickBy-C4C3CM4m.js +0 -195
- package/dist/lime-elements/p-1e085bbe.entry.js +0 -13
- package/dist/lime-elements/p-56bkn1D-.js +0 -1
- package/dist/lime-elements/p-67f02b69.entry.js +0 -1
- package/dist/lime-elements/p-867681aa.entry.js +0 -1
- package/dist/lime-elements/p-9d3437ac.entry.js +0 -16
- package/dist/lime-elements/p-B8yl2MCT.js +0 -1
- package/dist/lime-elements/p-BAR6am-7.js +0 -1
- package/dist/lime-elements/p-BE1Efiuj.js +0 -1
- package/dist/lime-elements/p-BsX7ma3n.js +0 -1
- package/dist/lime-elements/p-CR7u-m0b.js +0 -1
- package/dist/lime-elements/p-CVzgpz9P.js +0 -1
- package/dist/lime-elements/p-D8H5afYg.js +0 -1
- package/dist/lime-elements/p-DtrvybFR.js +0 -1
- package/dist/lime-elements/p-f309ceb8.entry.js +0 -1
- package/dist/lime-elements/p-f3c108c9.entry.js +0 -1
- package/dist/lime-elements/p-mmkVLOjW.js +0 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-Bnc9lzk2.js';
|
|
2
2
|
import { L as LevelMapping, E as EditorMenuTypes, i as isInlineImageTag, M as MouseButtons, e as editorMenuTypesArray } from './types-C_Yu8dOg.js';
|
|
3
3
|
import { g as getLinkAttributes, m as markdownToHTML, s as sanitizeHTML } from './markdown-parser-DrxxGLF5.js';
|
|
4
|
-
import {
|
|
4
|
+
import { c as cloneDeep } from './cloneDeep-DAbOtbs8.js';
|
|
5
5
|
import { t as translate } from './translations-DMtX4tTX.js';
|
|
6
6
|
import { c as decodeHTML, e as decodeHTMLStrict } from './index-CbciMfiU.js';
|
|
7
7
|
import { c as createRandomString } from './random-string-JbKhhoXs.js';
|
|
8
8
|
import { i as isItem } from './is-item-CrvUOVvg.js';
|
|
9
9
|
import { c as createFileInfo } from './files-DnkFEKoB.js';
|
|
10
|
-
import { i as isEqual } from './isEqual-
|
|
10
|
+
import { i as isEqual } from './isEqual-CE83yS8T.js';
|
|
11
11
|
import { d as debounce } from './debounce-B67JMchz.js';
|
|
12
12
|
import './_commonjsHelpers-B85MJLTf.js';
|
|
13
|
-
import './_baseIsEqual-
|
|
13
|
+
import './_baseIsEqual-CyF4P8uM.js';
|
|
14
14
|
import './eq-CZ30nDJE.js';
|
|
15
|
-
import './_getTag-
|
|
15
|
+
import './_getTag-BiAaLWvH.js';
|
|
16
16
|
import './isObject-BJQylLSL.js';
|
|
17
17
|
import './isObjectLike-oiMYqRQ0.js';
|
|
18
18
|
import './isArrayLike-CyVGB489.js';
|
|
@@ -22,7 +22,7 @@ import './isArray-B8VKuhvH.js';
|
|
|
22
22
|
import './_isIndex-B--C3qwe.js';
|
|
23
23
|
import './_assignValue-CEFvyZxO.js';
|
|
24
24
|
import './_defineProperty-C69Btzid.js';
|
|
25
|
-
import './
|
|
25
|
+
import './_getPrototype-B0kMNv1F.js';
|
|
26
26
|
import './language-C3hECvXE.js';
|
|
27
27
|
import './file-metadata-BHzkIH4g.js';
|
|
28
28
|
import './icons-Bu_YRgCL.js';
|
|
@@ -680,7 +680,6 @@ class Mark {
|
|
|
680
680
|
if (!type)
|
|
681
681
|
throw new RangeError(`There is no mark type ${json.type} in this schema`);
|
|
682
682
|
let mark = type.create(json.attrs);
|
|
683
|
-
type.checkAttrs(mark.attrs);
|
|
684
683
|
return mark;
|
|
685
684
|
}
|
|
686
685
|
/**
|
|
@@ -1660,11 +1659,11 @@ class Node {
|
|
|
1660
1659
|
*/
|
|
1661
1660
|
check() {
|
|
1662
1661
|
this.type.checkContent(this.content);
|
|
1663
|
-
this.type.
|
|
1662
|
+
checkAttrs(this.type.attrs, this.attrs, "node", this.type.name);
|
|
1664
1663
|
let copy = Mark.none;
|
|
1665
1664
|
for (let i = 0; i < this.marks.length; i++) {
|
|
1666
1665
|
let mark = this.marks[i];
|
|
1667
|
-
mark.type.
|
|
1666
|
+
checkAttrs(mark.type.attrs, mark.attrs, "mark", mark.type.name);
|
|
1668
1667
|
copy = mark.addToSet(copy);
|
|
1669
1668
|
}
|
|
1670
1669
|
if (!Mark.sameSet(copy, this.marks))
|
|
@@ -1705,7 +1704,6 @@ class Node {
|
|
|
1705
1704
|
}
|
|
1706
1705
|
let content = Fragment.fromJSON(schema, json.content);
|
|
1707
1706
|
let node = schema.nodeType(json.type).create(json.attrs, content, marks);
|
|
1708
|
-
node.type.checkAttrs(node.attrs);
|
|
1709
1707
|
return node;
|
|
1710
1708
|
}
|
|
1711
1709
|
}
|
|
@@ -1755,6 +1753,15 @@ function wrapMarks(marks, str) {
|
|
|
1755
1753
|
str = marks[i].type.name + "(" + str + ")";
|
|
1756
1754
|
return str;
|
|
1757
1755
|
}
|
|
1756
|
+
function checkAttrs(attrs, values, type, name) {
|
|
1757
|
+
for (let attr in values)
|
|
1758
|
+
if (!(attr in attrs))
|
|
1759
|
+
throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
|
|
1760
|
+
for (let attr in attrs) {
|
|
1761
|
+
if (attrs[attr].validate)
|
|
1762
|
+
attrs[attr].validate(values[attr]);
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1758
1765
|
|
|
1759
1766
|
/**
|
|
1760
1767
|
Instances of this class represent a match state of a node type's
|
|
@@ -2209,27 +2216,21 @@ function defaultAttrs(attrs) {
|
|
|
2209
2216
|
function computeAttrs(attrs, value) {
|
|
2210
2217
|
let built = Object.create(null);
|
|
2211
2218
|
for (let name in attrs) {
|
|
2219
|
+
let attr = attrs[name];
|
|
2212
2220
|
let given = value && value[name];
|
|
2213
2221
|
if (given === undefined) {
|
|
2214
|
-
let attr = attrs[name];
|
|
2215
2222
|
if (attr.hasDefault)
|
|
2216
2223
|
given = attr.default;
|
|
2217
2224
|
else
|
|
2218
2225
|
throw new RangeError("No value supplied for attribute " + name);
|
|
2219
2226
|
}
|
|
2227
|
+
else if (attr.validate) {
|
|
2228
|
+
attr.validate(given);
|
|
2229
|
+
}
|
|
2220
2230
|
built[name] = given;
|
|
2221
2231
|
}
|
|
2222
2232
|
return built;
|
|
2223
2233
|
}
|
|
2224
|
-
function checkAttrs(attrs, values, type, name) {
|
|
2225
|
-
for (let attr in values)
|
|
2226
|
-
if (!(attr in attrs))
|
|
2227
|
-
throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
|
|
2228
|
-
for (let attr in attrs) {
|
|
2229
|
-
if (attrs[attr].validate)
|
|
2230
|
-
attrs[attr].validate(values[attr]);
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
2234
|
function initAttrs(typeName, attrs) {
|
|
2234
2235
|
let result = Object.create(null);
|
|
2235
2236
|
if (attrs)
|
|
@@ -2401,11 +2402,9 @@ let NodeType$1 = class NodeType {
|
|
|
2401
2402
|
throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
|
|
2402
2403
|
}
|
|
2403
2404
|
/**
|
|
2404
|
-
@internal
|
|
2405
|
+
@internal no longer useful, but called by old prosemirror-view versions
|
|
2405
2406
|
*/
|
|
2406
|
-
checkAttrs(attrs) {
|
|
2407
|
-
checkAttrs(this.attrs, attrs, "node", this.name);
|
|
2408
|
-
}
|
|
2407
|
+
checkAttrs(attrs) { }
|
|
2409
2408
|
/**
|
|
2410
2409
|
Check whether the given mark type is allowed in this node.
|
|
2411
2410
|
*/
|
|
@@ -2552,12 +2551,6 @@ class MarkType {
|
|
|
2552
2551
|
return set[i];
|
|
2553
2552
|
}
|
|
2554
2553
|
/**
|
|
2555
|
-
@internal
|
|
2556
|
-
*/
|
|
2557
|
-
checkAttrs(attrs) {
|
|
2558
|
-
checkAttrs(this.attrs, attrs, "mark", this.name);
|
|
2559
|
-
}
|
|
2560
|
-
/**
|
|
2561
2554
|
Queries whether a given mark type is
|
|
2562
2555
|
[excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
|
|
2563
2556
|
*/
|
|
@@ -15273,7 +15266,6 @@ function arrayReplaceAt (src, pos, newElements) {
|
|
|
15273
15266
|
}
|
|
15274
15267
|
|
|
15275
15268
|
function isValidEntityCode (c) {
|
|
15276
|
-
/* eslint no-bitwise:0 */
|
|
15277
15269
|
// broken sequence
|
|
15278
15270
|
if (c >= 0xD800 && c <= 0xDFFF) { return false }
|
|
15279
15271
|
// never used
|
|
@@ -15301,8 +15293,8 @@ function fromCodePoint (c) {
|
|
|
15301
15293
|
return String.fromCharCode(c)
|
|
15302
15294
|
}
|
|
15303
15295
|
|
|
15304
|
-
const UNESCAPE_MD_RE
|
|
15305
|
-
const ENTITY_RE
|
|
15296
|
+
const UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g;
|
|
15297
|
+
const ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;
|
|
15306
15298
|
const UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');
|
|
15307
15299
|
|
|
15308
15300
|
const DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
|
|
@@ -15328,12 +15320,6 @@ function replaceEntityPattern (match, name) {
|
|
|
15328
15320
|
return match
|
|
15329
15321
|
}
|
|
15330
15322
|
|
|
15331
|
-
/* function replaceEntities(str) {
|
|
15332
|
-
if (str.indexOf('&') < 0) { return str; }
|
|
15333
|
-
|
|
15334
|
-
return str.replace(ENTITY_RE, replaceEntityPattern);
|
|
15335
|
-
} */
|
|
15336
|
-
|
|
15337
15323
|
function unescapeMd (str) {
|
|
15338
15324
|
if (str.indexOf('\\') < 0) { return str }
|
|
15339
15325
|
return str.replace(UNESCAPE_MD_RE, '$1')
|
|
@@ -15403,8 +15389,6 @@ function isWhiteSpace (code) {
|
|
|
15403
15389
|
return false
|
|
15404
15390
|
}
|
|
15405
15391
|
|
|
15406
|
-
/* eslint-disable max-len */
|
|
15407
|
-
|
|
15408
15392
|
// Currently without astral characters support.
|
|
15409
15393
|
function isPunctChar (ch) {
|
|
15410
15394
|
return P.test(ch) || regex.test(ch)
|
|
@@ -15664,7 +15648,7 @@ function parseLinkDestination (str, start, max) {
|
|
|
15664
15648
|
if (code < 0x20 || code === 0x7F) { break }
|
|
15665
15649
|
|
|
15666
15650
|
if (code === 0x5C /* \ */ && pos + 1 < max) {
|
|
15667
|
-
if (str.charCodeAt(pos + 1) === 0x20) {
|
|
15651
|
+
if (str.charCodeAt(pos + 1) === 0x20) { pos++; continue }
|
|
15668
15652
|
pos += 2;
|
|
15669
15653
|
continue
|
|
15670
15654
|
}
|
|
@@ -15780,7 +15764,7 @@ const default_rules = {};
|
|
|
15780
15764
|
default_rules.code_inline = function (tokens, idx, options, env, slf) {
|
|
15781
15765
|
const token = tokens[idx];
|
|
15782
15766
|
|
|
15783
|
-
return
|
|
15767
|
+
return '<code' + slf.renderAttrs(token) + '>' +
|
|
15784
15768
|
escapeHtml(token.content) +
|
|
15785
15769
|
'</code>'
|
|
15786
15770
|
};
|
|
@@ -15788,7 +15772,7 @@ default_rules.code_inline = function (tokens, idx, options, env, slf) {
|
|
|
15788
15772
|
default_rules.code_block = function (tokens, idx, options, env, slf) {
|
|
15789
15773
|
const token = tokens[idx];
|
|
15790
15774
|
|
|
15791
|
-
return
|
|
15775
|
+
return '<pre' + slf.renderAttrs(token) + '><code>' +
|
|
15792
15776
|
escapeHtml(tokens[idx].content) +
|
|
15793
15777
|
'</code></pre>\n'
|
|
15794
15778
|
};
|
|
@@ -16441,28 +16425,28 @@ function Token (type, tag, nesting) {
|
|
|
16441
16425
|
*
|
|
16442
16426
|
* Type of the token (string, e.g. "paragraph_open")
|
|
16443
16427
|
**/
|
|
16444
|
-
this.type
|
|
16428
|
+
this.type = type;
|
|
16445
16429
|
|
|
16446
16430
|
/**
|
|
16447
16431
|
* Token#tag -> String
|
|
16448
16432
|
*
|
|
16449
16433
|
* html tag name, e.g. "p"
|
|
16450
16434
|
**/
|
|
16451
|
-
this.tag
|
|
16435
|
+
this.tag = tag;
|
|
16452
16436
|
|
|
16453
16437
|
/**
|
|
16454
16438
|
* Token#attrs -> Array
|
|
16455
16439
|
*
|
|
16456
16440
|
* Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
|
|
16457
16441
|
**/
|
|
16458
|
-
this.attrs
|
|
16442
|
+
this.attrs = null;
|
|
16459
16443
|
|
|
16460
16444
|
/**
|
|
16461
16445
|
* Token#map -> Array
|
|
16462
16446
|
*
|
|
16463
16447
|
* Source map info. Format: `[ line_begin, line_end ]`
|
|
16464
16448
|
**/
|
|
16465
|
-
this.map
|
|
16449
|
+
this.map = null;
|
|
16466
16450
|
|
|
16467
16451
|
/**
|
|
16468
16452
|
* Token#nesting -> Number
|
|
@@ -16473,14 +16457,14 @@ function Token (type, tag, nesting) {
|
|
|
16473
16457
|
* - `0` means the tag is self-closing
|
|
16474
16458
|
* - `-1` means the tag is closing
|
|
16475
16459
|
**/
|
|
16476
|
-
this.nesting
|
|
16460
|
+
this.nesting = nesting;
|
|
16477
16461
|
|
|
16478
16462
|
/**
|
|
16479
16463
|
* Token#level -> Number
|
|
16480
16464
|
*
|
|
16481
16465
|
* nesting level, the same as `state.level`
|
|
16482
16466
|
**/
|
|
16483
|
-
this.level
|
|
16467
|
+
this.level = 0;
|
|
16484
16468
|
|
|
16485
16469
|
/**
|
|
16486
16470
|
* Token#children -> Array
|
|
@@ -16495,14 +16479,14 @@ function Token (type, tag, nesting) {
|
|
|
16495
16479
|
* In a case of self-closing tag (code, html, fence, etc.),
|
|
16496
16480
|
* it has contents of this tag.
|
|
16497
16481
|
**/
|
|
16498
|
-
this.content
|
|
16482
|
+
this.content = '';
|
|
16499
16483
|
|
|
16500
16484
|
/**
|
|
16501
16485
|
* Token#markup -> String
|
|
16502
16486
|
*
|
|
16503
16487
|
* '*' or '_' for emphasis, fence string for fence, etc.
|
|
16504
16488
|
**/
|
|
16505
|
-
this.markup
|
|
16489
|
+
this.markup = '';
|
|
16506
16490
|
|
|
16507
16491
|
/**
|
|
16508
16492
|
* Token#info -> String
|
|
@@ -16513,14 +16497,14 @@ function Token (type, tag, nesting) {
|
|
|
16513
16497
|
* - The value "auto" for autolink "link_open" and "link_close" tokens
|
|
16514
16498
|
* - The string value of the item marker for ordered-list "list_item_open" tokens
|
|
16515
16499
|
**/
|
|
16516
|
-
this.info
|
|
16500
|
+
this.info = '';
|
|
16517
16501
|
|
|
16518
16502
|
/**
|
|
16519
16503
|
* Token#meta -> Object
|
|
16520
16504
|
*
|
|
16521
16505
|
* A place for plugins to store an arbitrary data
|
|
16522
16506
|
**/
|
|
16523
|
-
this.meta
|
|
16507
|
+
this.meta = null;
|
|
16524
16508
|
|
|
16525
16509
|
/**
|
|
16526
16510
|
* Token#block -> Boolean
|
|
@@ -16528,7 +16512,7 @@ function Token (type, tag, nesting) {
|
|
|
16528
16512
|
* True for block-level tokens, false for inline tokens.
|
|
16529
16513
|
* Used in renderer to calculate line breaks
|
|
16530
16514
|
**/
|
|
16531
|
-
this.block
|
|
16515
|
+
this.block = false;
|
|
16532
16516
|
|
|
16533
16517
|
/**
|
|
16534
16518
|
* Token#hidden -> Boolean
|
|
@@ -16536,7 +16520,7 @@ function Token (type, tag, nesting) {
|
|
|
16536
16520
|
* If it's true, ignore this element when rendering. Used for tight lists
|
|
16537
16521
|
* to hide paragraphs.
|
|
16538
16522
|
**/
|
|
16539
|
-
this.hidden
|
|
16523
|
+
this.hidden = false;
|
|
16540
16524
|
}
|
|
16541
16525
|
|
|
16542
16526
|
/**
|
|
@@ -16632,8 +16616,8 @@ StateCore.prototype.Token = Token;
|
|
|
16632
16616
|
// Normalize input string
|
|
16633
16617
|
|
|
16634
16618
|
// https://spec.commonmark.org/0.29/#line-ending
|
|
16635
|
-
const NEWLINES_RE
|
|
16636
|
-
const NULL_RE
|
|
16619
|
+
const NEWLINES_RE = /\r\n?|\n/g;
|
|
16620
|
+
const NULL_RE = /\0/g;
|
|
16637
16621
|
|
|
16638
16622
|
function normalize$1 (state) {
|
|
16639
16623
|
let str;
|
|
@@ -16651,9 +16635,9 @@ function block (state) {
|
|
|
16651
16635
|
let token;
|
|
16652
16636
|
|
|
16653
16637
|
if (state.inlineMode) {
|
|
16654
|
-
token
|
|
16655
|
-
token.content
|
|
16656
|
-
token.map
|
|
16638
|
+
token = new state.Token('inline', '', 0);
|
|
16639
|
+
token.content = state.src;
|
|
16640
|
+
token.map = [0, 1];
|
|
16657
16641
|
token.children = [];
|
|
16658
16642
|
state.tokens.push(token);
|
|
16659
16643
|
} else {
|
|
@@ -16678,7 +16662,6 @@ function inline (state) {
|
|
|
16678
16662
|
// Currently restricted by `md.validateLink()` to http/https/ftp
|
|
16679
16663
|
//
|
|
16680
16664
|
|
|
16681
|
-
|
|
16682
16665
|
function isLinkOpen$1 (str) {
|
|
16683
16666
|
return /^<a[>\s]/i.test(str)
|
|
16684
16667
|
}
|
|
@@ -16697,7 +16680,8 @@ function linkify$1 (state) {
|
|
|
16697
16680
|
continue
|
|
16698
16681
|
}
|
|
16699
16682
|
|
|
16700
|
-
|
|
16683
|
+
const tokens = blockTokens[j].children;
|
|
16684
|
+
const replacements = [];
|
|
16701
16685
|
|
|
16702
16686
|
let htmlLinkLevel = 0;
|
|
16703
16687
|
|
|
@@ -16767,43 +16751,70 @@ function linkify$1 (state) {
|
|
|
16767
16751
|
const pos = links[ln].index;
|
|
16768
16752
|
|
|
16769
16753
|
if (pos > lastPos) {
|
|
16770
|
-
const token
|
|
16754
|
+
const token = new state.Token('text', '', 0);
|
|
16771
16755
|
token.content = text.slice(lastPos, pos);
|
|
16772
|
-
token.level
|
|
16756
|
+
token.level = level;
|
|
16773
16757
|
nodes.push(token);
|
|
16774
16758
|
}
|
|
16775
16759
|
|
|
16776
|
-
const token_o
|
|
16777
|
-
token_o.attrs
|
|
16778
|
-
token_o.level
|
|
16779
|
-
token_o.markup
|
|
16780
|
-
token_o.info
|
|
16760
|
+
const token_o = new state.Token('link_open', 'a', 1);
|
|
16761
|
+
token_o.attrs = [['href', fullUrl]];
|
|
16762
|
+
token_o.level = level++;
|
|
16763
|
+
token_o.markup = 'linkify';
|
|
16764
|
+
token_o.info = 'auto';
|
|
16781
16765
|
nodes.push(token_o);
|
|
16782
16766
|
|
|
16783
|
-
const token_t
|
|
16767
|
+
const token_t = new state.Token('text', '', 0);
|
|
16784
16768
|
token_t.content = urlText;
|
|
16785
|
-
token_t.level
|
|
16769
|
+
token_t.level = level;
|
|
16786
16770
|
nodes.push(token_t);
|
|
16787
16771
|
|
|
16788
|
-
const token_c
|
|
16789
|
-
token_c.level
|
|
16790
|
-
token_c.markup
|
|
16791
|
-
token_c.info
|
|
16772
|
+
const token_c = new state.Token('link_close', 'a', -1);
|
|
16773
|
+
token_c.level = --level;
|
|
16774
|
+
token_c.markup = 'linkify';
|
|
16775
|
+
token_c.info = 'auto';
|
|
16792
16776
|
nodes.push(token_c);
|
|
16793
16777
|
|
|
16794
16778
|
lastPos = links[ln].lastIndex;
|
|
16795
16779
|
}
|
|
16796
16780
|
if (lastPos < text.length) {
|
|
16797
|
-
const token
|
|
16781
|
+
const token = new state.Token('text', '', 0);
|
|
16798
16782
|
token.content = text.slice(lastPos);
|
|
16799
|
-
token.level
|
|
16783
|
+
token.level = level;
|
|
16800
16784
|
nodes.push(token);
|
|
16801
16785
|
}
|
|
16802
16786
|
|
|
16803
|
-
|
|
16804
|
-
blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
|
|
16787
|
+
replacements.push({ index: i, nodes });
|
|
16805
16788
|
}
|
|
16806
16789
|
}
|
|
16790
|
+
|
|
16791
|
+
if (replacements.length > 0) {
|
|
16792
|
+
let newTokensLength = tokens.length;
|
|
16793
|
+
for (const replacement of replacements) {
|
|
16794
|
+
newTokensLength += replacement.nodes.length - 1;
|
|
16795
|
+
}
|
|
16796
|
+
|
|
16797
|
+
const newTokens = new Array(newTokensLength);
|
|
16798
|
+
let replacementIndex = 0;
|
|
16799
|
+
let newTokenIndex = 0;
|
|
16800
|
+
|
|
16801
|
+
replacements.reverse();
|
|
16802
|
+
|
|
16803
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
16804
|
+
const replacement = replacements[replacementIndex];
|
|
16805
|
+
|
|
16806
|
+
if (replacement?.index === i) {
|
|
16807
|
+
for (const node of replacement.nodes) {
|
|
16808
|
+
newTokens[newTokenIndex++] = node;
|
|
16809
|
+
}
|
|
16810
|
+
replacementIndex++;
|
|
16811
|
+
} else {
|
|
16812
|
+
newTokens[newTokenIndex++] = tokens[i];
|
|
16813
|
+
}
|
|
16814
|
+
}
|
|
16815
|
+
|
|
16816
|
+
blockTokens[j].children = newTokens;
|
|
16817
|
+
}
|
|
16807
16818
|
}
|
|
16808
16819
|
}
|
|
16809
16820
|
|
|
@@ -16916,6 +16927,19 @@ function replace (state) {
|
|
|
16916
16927
|
const QUOTE_TEST_RE = /['"]/;
|
|
16917
16928
|
const QUOTE_RE = /['"]/g;
|
|
16918
16929
|
const APOSTROPHE = '\u2019'; /* ’ */
|
|
16930
|
+
// Caps memory on malicious input
|
|
16931
|
+
const MAX_OPENERS = 1000;
|
|
16932
|
+
|
|
16933
|
+
function truncateStack (stack, heads, length) {
|
|
16934
|
+
while (stack.length > length) {
|
|
16935
|
+
const item = stack.pop();
|
|
16936
|
+
if (item.isSingleQuote) {
|
|
16937
|
+
heads.single = item.prevSameQuoteIdx;
|
|
16938
|
+
} else {
|
|
16939
|
+
heads.double = item.prevSameQuoteIdx;
|
|
16940
|
+
}
|
|
16941
|
+
}
|
|
16942
|
+
}
|
|
16919
16943
|
|
|
16920
16944
|
function addReplacement (replacements, tokenIdx, pos, ch) {
|
|
16921
16945
|
if (!replacements[tokenIdx]) {
|
|
@@ -16945,6 +16969,8 @@ function process_inlines (tokens, state) {
|
|
|
16945
16969
|
let j;
|
|
16946
16970
|
|
|
16947
16971
|
const stack = [];
|
|
16972
|
+
// stack indexes of topmost openers of each type (-1 if none)
|
|
16973
|
+
const heads = { single: -1, double: -1 };
|
|
16948
16974
|
// token index -> list of replacements in the original token content
|
|
16949
16975
|
const replacements = {};
|
|
16950
16976
|
|
|
@@ -16956,7 +16982,7 @@ function process_inlines (tokens, state) {
|
|
|
16956
16982
|
for (j = stack.length - 1; j >= 0; j--) {
|
|
16957
16983
|
if (stack[j].level <= thisLevel) { break }
|
|
16958
16984
|
}
|
|
16959
|
-
stack
|
|
16985
|
+
truncateStack(stack, heads, j + 1);
|
|
16960
16986
|
|
|
16961
16987
|
if (token.type !== 'text') { continue }
|
|
16962
16988
|
|
|
@@ -17060,39 +17086,45 @@ function process_inlines (tokens, state) {
|
|
|
17060
17086
|
}
|
|
17061
17087
|
|
|
17062
17088
|
if (canClose) {
|
|
17063
|
-
//
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
|
-
|
|
17077
|
-
|
|
17078
|
-
}
|
|
17089
|
+
// Stack levels never decrease, so an opener of this type below
|
|
17090
|
+
// the current level means there is no match
|
|
17091
|
+
j = isSingle ? heads.single : heads.double;
|
|
17092
|
+
if (j >= 0 && stack[j].level === thisLevel) {
|
|
17093
|
+
const item = stack[j];
|
|
17094
|
+
|
|
17095
|
+
let openQuote;
|
|
17096
|
+
let closeQuote;
|
|
17097
|
+
if (isSingle) {
|
|
17098
|
+
openQuote = state.md.options.quotes[2];
|
|
17099
|
+
closeQuote = state.md.options.quotes[3];
|
|
17100
|
+
} else {
|
|
17101
|
+
openQuote = state.md.options.quotes[0];
|
|
17102
|
+
closeQuote = state.md.options.quotes[1];
|
|
17103
|
+
}
|
|
17079
17104
|
|
|
17080
|
-
|
|
17081
|
-
|
|
17105
|
+
addReplacement(replacements, i, t.index, closeQuote);
|
|
17106
|
+
addReplacement(replacements, item.tokenIdx, item.contentPos, openQuote);
|
|
17082
17107
|
|
|
17083
|
-
|
|
17084
|
-
|
|
17085
|
-
}
|
|
17108
|
+
truncateStack(stack, heads, j);
|
|
17109
|
+
continue OUTER
|
|
17086
17110
|
}
|
|
17087
17111
|
}
|
|
17088
17112
|
|
|
17089
17113
|
if (canOpen) {
|
|
17114
|
+
if (stack.length >= MAX_OPENERS) { return }
|
|
17090
17115
|
stack.push({
|
|
17091
|
-
|
|
17092
|
-
|
|
17093
|
-
|
|
17094
|
-
level: thisLevel
|
|
17116
|
+
tokenIdx: i,
|
|
17117
|
+
contentPos: t.index,
|
|
17118
|
+
isSingleQuote: isSingle,
|
|
17119
|
+
level: thisLevel,
|
|
17120
|
+
// stack index of the previous opener of the same quote type, -1 if none
|
|
17121
|
+
prevSameQuoteIdx: isSingle ? heads.single : heads.double
|
|
17095
17122
|
});
|
|
17123
|
+
if (isSingle) {
|
|
17124
|
+
heads.single = stack.length - 1;
|
|
17125
|
+
} else {
|
|
17126
|
+
heads.double = stack.length - 1;
|
|
17127
|
+
}
|
|
17096
17128
|
} else if (canClose && isSingle) {
|
|
17097
17129
|
addReplacement(replacements, i, t.index, APOSTROPHE);
|
|
17098
17130
|
}
|
|
@@ -17171,15 +17203,15 @@ function text_join (state) {
|
|
|
17171
17203
|
|
|
17172
17204
|
|
|
17173
17205
|
const _rules$2 = [
|
|
17174
|
-
['normalize',
|
|
17175
|
-
['block',
|
|
17176
|
-
['inline',
|
|
17177
|
-
['linkify',
|
|
17178
|
-
['replacements',
|
|
17179
|
-
['smartquotes',
|
|
17206
|
+
['normalize', normalize$1],
|
|
17207
|
+
['block', block],
|
|
17208
|
+
['inline', inline],
|
|
17209
|
+
['linkify', linkify$1],
|
|
17210
|
+
['replacements', replace],
|
|
17211
|
+
['smartquotes', smartquotes],
|
|
17180
17212
|
// `text_join` finds `text_special` tokens (for escape sequences)
|
|
17181
17213
|
// and joins them with the rest of the text
|
|
17182
|
-
['text_join',
|
|
17214
|
+
['text_join', text_join]
|
|
17183
17215
|
];
|
|
17184
17216
|
|
|
17185
17217
|
/**
|
|
@@ -17220,7 +17252,7 @@ function StateBlock (src, md, env, tokens) {
|
|
|
17220
17252
|
this.src = src;
|
|
17221
17253
|
|
|
17222
17254
|
// link to parser instance
|
|
17223
|
-
this.md
|
|
17255
|
+
this.md = md;
|
|
17224
17256
|
|
|
17225
17257
|
this.env = env;
|
|
17226
17258
|
|
|
@@ -17251,11 +17283,11 @@ function StateBlock (src, md, env, tokens) {
|
|
|
17251
17283
|
|
|
17252
17284
|
// required block content indent (for example, if we are
|
|
17253
17285
|
// inside a list, it would be positioned after list marker)
|
|
17254
|
-
this.blkIndent
|
|
17255
|
-
this.line
|
|
17256
|
-
this.lineMax
|
|
17257
|
-
this.tight
|
|
17258
|
-
this.ddIndent
|
|
17286
|
+
this.blkIndent = 0;
|
|
17287
|
+
this.line = 0; // line index in src
|
|
17288
|
+
this.lineMax = 0; // lines count
|
|
17289
|
+
this.tight = false; // loose/tight mode for lists
|
|
17290
|
+
this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)
|
|
17259
17291
|
this.listIndent = -1; // indent of the current list block (-1 if there isn't any)
|
|
17260
17292
|
|
|
17261
17293
|
// can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
|
|
@@ -17582,11 +17614,11 @@ function table (state, startLine, endLine, silent) {
|
|
|
17582
17614
|
for (let i = 0; i < columns.length; i++) {
|
|
17583
17615
|
const token_ho = state.push('th_open', 'th', 1);
|
|
17584
17616
|
if (aligns[i]) {
|
|
17585
|
-
token_ho.attrs
|
|
17617
|
+
token_ho.attrs = [['style', 'text-align:' + aligns[i]]];
|
|
17586
17618
|
}
|
|
17587
17619
|
|
|
17588
17620
|
const token_il = state.push('inline', '', 0);
|
|
17589
|
-
token_il.content
|
|
17621
|
+
token_il.content = columns[i].trim();
|
|
17590
17622
|
token_il.children = [];
|
|
17591
17623
|
|
|
17592
17624
|
state.push('th_close', 'th', -1);
|
|
@@ -17633,11 +17665,11 @@ function table (state, startLine, endLine, silent) {
|
|
|
17633
17665
|
for (let i = 0; i < columnCount; i++) {
|
|
17634
17666
|
const token_tdo = state.push('td_open', 'td', 1);
|
|
17635
17667
|
if (aligns[i]) {
|
|
17636
|
-
token_tdo.attrs
|
|
17668
|
+
token_tdo.attrs = [['style', 'text-align:' + aligns[i]]];
|
|
17637
17669
|
}
|
|
17638
17670
|
|
|
17639
17671
|
const token_il = state.push('inline', '', 0);
|
|
17640
|
-
token_il.content
|
|
17672
|
+
token_il.content = columns[i] ? columns[i].trim() : '';
|
|
17641
17673
|
token_il.children = [];
|
|
17642
17674
|
|
|
17643
17675
|
state.push('td_close', 'td', -1);
|
|
@@ -17682,9 +17714,9 @@ function code$1 (state, startLine, endLine/*, silent */) {
|
|
|
17682
17714
|
|
|
17683
17715
|
state.line = last;
|
|
17684
17716
|
|
|
17685
|
-
const token
|
|
17717
|
+
const token = state.push('code_block', 'code', 0);
|
|
17686
17718
|
token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\n';
|
|
17687
|
-
token.map
|
|
17719
|
+
token.map = [startLine, state.line];
|
|
17688
17720
|
|
|
17689
17721
|
return true
|
|
17690
17722
|
}
|
|
@@ -17775,11 +17807,11 @@ function fence (state, startLine, endLine, silent) {
|
|
|
17775
17807
|
|
|
17776
17808
|
state.line = nextLine + (haveEndMarker ? 1 : 0);
|
|
17777
17809
|
|
|
17778
|
-
const token
|
|
17779
|
-
token.info
|
|
17810
|
+
const token = state.push('fence', 'code', 0);
|
|
17811
|
+
token.info = params;
|
|
17780
17812
|
token.content = state.getLines(startLine + 1, nextLine, len, true);
|
|
17781
|
-
token.markup
|
|
17782
|
-
token.map
|
|
17813
|
+
token.markup = markup;
|
|
17814
|
+
token.map = [startLine, state.line];
|
|
17783
17815
|
|
|
17784
17816
|
return true
|
|
17785
17817
|
}
|
|
@@ -17803,10 +17835,10 @@ function blockquote (state, startLine, endLine, silent) {
|
|
|
17803
17835
|
// so no point trying to find the end of it in silent mode
|
|
17804
17836
|
if (silent) { return true }
|
|
17805
17837
|
|
|
17806
|
-
const oldBMarks
|
|
17838
|
+
const oldBMarks = [];
|
|
17807
17839
|
const oldBSCount = [];
|
|
17808
|
-
const oldSCount
|
|
17809
|
-
const oldTShift
|
|
17840
|
+
const oldSCount = [];
|
|
17841
|
+
const oldTShift = [];
|
|
17810
17842
|
|
|
17811
17843
|
const terminatorRules = state.md.block.ruler.getRules('blockquote');
|
|
17812
17844
|
|
|
@@ -17966,14 +17998,14 @@ function blockquote (state, startLine, endLine, silent) {
|
|
|
17966
17998
|
const oldIndent = state.blkIndent;
|
|
17967
17999
|
state.blkIndent = 0;
|
|
17968
18000
|
|
|
17969
|
-
const token_o
|
|
18001
|
+
const token_o = state.push('blockquote_open', 'blockquote', 1);
|
|
17970
18002
|
token_o.markup = '>';
|
|
17971
18003
|
const lines = [startLine, 0];
|
|
17972
|
-
token_o.map
|
|
18004
|
+
token_o.map = lines;
|
|
17973
18005
|
|
|
17974
18006
|
state.md.block.tokenize(state, startLine, nextLine);
|
|
17975
18007
|
|
|
17976
|
-
const token_c
|
|
18008
|
+
const token_c = state.push('blockquote_close', 'blockquote', -1);
|
|
17977
18009
|
token_c.markup = '>';
|
|
17978
18010
|
|
|
17979
18011
|
state.lineMax = oldLineMax;
|
|
@@ -18026,8 +18058,8 @@ function hr (state, startLine, endLine, silent) {
|
|
|
18026
18058
|
|
|
18027
18059
|
state.line = startLine + 1;
|
|
18028
18060
|
|
|
18029
|
-
const token
|
|
18030
|
-
token.map
|
|
18061
|
+
const token = state.push('hr', 'hr', 0);
|
|
18062
|
+
token.map = [startLine, state.line];
|
|
18031
18063
|
token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
|
|
18032
18064
|
|
|
18033
18065
|
return true
|
|
@@ -18190,16 +18222,16 @@ function list (state, startLine, endLine, silent) {
|
|
|
18190
18222
|
const listTokIdx = state.tokens.length;
|
|
18191
18223
|
|
|
18192
18224
|
if (isOrdered) {
|
|
18193
|
-
token
|
|
18225
|
+
token = state.push('ordered_list_open', 'ol', 1);
|
|
18194
18226
|
if (markerValue !== 1) {
|
|
18195
18227
|
token.attrs = [['start', markerValue]];
|
|
18196
18228
|
}
|
|
18197
18229
|
} else {
|
|
18198
|
-
token
|
|
18230
|
+
token = state.push('bullet_list_open', 'ul', 1);
|
|
18199
18231
|
}
|
|
18200
18232
|
|
|
18201
18233
|
const listLines = [nextLine, 0];
|
|
18202
|
-
token.map
|
|
18234
|
+
token.map = listLines;
|
|
18203
18235
|
token.markup = String.fromCharCode(markerCharCode);
|
|
18204
18236
|
|
|
18205
18237
|
//
|
|
@@ -18252,10 +18284,10 @@ function list (state, startLine, endLine, silent) {
|
|
|
18252
18284
|
const indent = initial + indentAfterMarker;
|
|
18253
18285
|
|
|
18254
18286
|
// Run subparser & write tokens
|
|
18255
|
-
token
|
|
18287
|
+
token = state.push('list_item_open', 'li', 1);
|
|
18256
18288
|
token.markup = String.fromCharCode(markerCharCode);
|
|
18257
18289
|
const itemLines = [nextLine, 0];
|
|
18258
|
-
token.map
|
|
18290
|
+
token.map = itemLines;
|
|
18259
18291
|
if (isOrdered) {
|
|
18260
18292
|
token.info = state.src.slice(start, posAfterMarker - 1);
|
|
18261
18293
|
}
|
|
@@ -18304,7 +18336,7 @@ function list (state, startLine, endLine, silent) {
|
|
|
18304
18336
|
state.sCount[nextLine] = oldSCount;
|
|
18305
18337
|
state.tight = oldTight;
|
|
18306
18338
|
|
|
18307
|
-
token
|
|
18339
|
+
token = state.push('list_item_close', 'li', -1);
|
|
18308
18340
|
token.markup = String.fromCharCode(markerCharCode);
|
|
18309
18341
|
|
|
18310
18342
|
nextLine = state.line;
|
|
@@ -18641,23 +18673,23 @@ var block_names = [
|
|
|
18641
18673
|
|
|
18642
18674
|
// Regexps to match html elements
|
|
18643
18675
|
|
|
18644
|
-
const attr_name
|
|
18676
|
+
const attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
|
|
18645
18677
|
|
|
18646
|
-
const unquoted
|
|
18678
|
+
const unquoted = '[^"\'=<>`\\x00-\\x20]+';
|
|
18647
18679
|
const single_quoted = "'[^']*'";
|
|
18648
18680
|
const double_quoted = '"[^"]*"';
|
|
18649
18681
|
|
|
18650
|
-
const attr_value
|
|
18682
|
+
const attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
|
|
18651
18683
|
|
|
18652
|
-
const attribute
|
|
18684
|
+
const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
|
|
18653
18685
|
|
|
18654
|
-
const open_tag
|
|
18686
|
+
const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
|
|
18655
18687
|
|
|
18656
|
-
const close_tag
|
|
18657
|
-
const comment
|
|
18658
|
-
const processing
|
|
18688
|
+
const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
|
|
18689
|
+
const comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->';
|
|
18690
|
+
const processing = '<[?][\\s\\S]*?[?]>';
|
|
18659
18691
|
const declaration = '<![A-Za-z][^>]*>';
|
|
18660
|
-
const cdata
|
|
18692
|
+
const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
|
|
18661
18693
|
|
|
18662
18694
|
const HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
|
|
18663
18695
|
'|' + processing + '|' + declaration + '|' + cdata + ')');
|
|
@@ -18671,12 +18703,12 @@ const HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag +
|
|
|
18671
18703
|
//
|
|
18672
18704
|
const HTML_SEQUENCES = [
|
|
18673
18705
|
[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, true],
|
|
18674
|
-
[/^<!--/,
|
|
18675
|
-
[/^<\?/,
|
|
18676
|
-
[/^<![A-
|
|
18706
|
+
[/^<!--/, /-->/, true],
|
|
18707
|
+
[/^<\?/, /\?>/, true],
|
|
18708
|
+
[/^<![A-Za-z]/, />/, true],
|
|
18677
18709
|
[/^<!\[CDATA\[/, /\]\]>/, true],
|
|
18678
18710
|
[new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true],
|
|
18679
|
-
[new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'),
|
|
18711
|
+
[new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false]
|
|
18680
18712
|
];
|
|
18681
18713
|
|
|
18682
18714
|
function html_block (state, startLine, endLine, silent) {
|
|
@@ -18735,8 +18767,8 @@ function html_block (state, startLine, endLine, silent) {
|
|
|
18735
18767
|
|
|
18736
18768
|
state.line = nextLine;
|
|
18737
18769
|
|
|
18738
|
-
const token
|
|
18739
|
-
token.map
|
|
18770
|
+
const token = state.push('html_block', '', 0);
|
|
18771
|
+
token.map = [startLine, nextLine];
|
|
18740
18772
|
token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
|
|
18741
18773
|
|
|
18742
18774
|
return true
|
|
@@ -18752,7 +18784,7 @@ function heading (state, startLine, endLine, silent) {
|
|
|
18752
18784
|
// if it's indented more than 3 spaces, it should be a code block
|
|
18753
18785
|
if (state.sCount[startLine] - state.blkIndent >= 4) { return false }
|
|
18754
18786
|
|
|
18755
|
-
let ch
|
|
18787
|
+
let ch = state.src.charCodeAt(pos);
|
|
18756
18788
|
|
|
18757
18789
|
if (ch !== 0x23/* # */ || pos >= max) { return false }
|
|
18758
18790
|
|
|
@@ -18778,16 +18810,16 @@ function heading (state, startLine, endLine, silent) {
|
|
|
18778
18810
|
|
|
18779
18811
|
state.line = startLine + 1;
|
|
18780
18812
|
|
|
18781
|
-
const token_o
|
|
18813
|
+
const token_o = state.push('heading_open', 'h' + String(level), 1);
|
|
18782
18814
|
token_o.markup = '########'.slice(0, level);
|
|
18783
|
-
token_o.map
|
|
18815
|
+
token_o.map = [startLine, state.line];
|
|
18784
18816
|
|
|
18785
|
-
const token_i
|
|
18786
|
-
token_i.content
|
|
18787
|
-
token_i.map
|
|
18817
|
+
const token_i = state.push('inline', '', 0);
|
|
18818
|
+
token_i.content = asciiTrim(state.src.slice(pos, max));
|
|
18819
|
+
token_i.map = [startLine, state.line];
|
|
18788
18820
|
token_i.children = [];
|
|
18789
18821
|
|
|
18790
|
-
const token_c
|
|
18822
|
+
const token_c = state.push('heading_close', 'h' + String(level), -1);
|
|
18791
18823
|
token_c.markup = '########'.slice(0, level);
|
|
18792
18824
|
|
|
18793
18825
|
return true
|
|
@@ -18861,17 +18893,17 @@ function lheading (state, startLine, endLine/*, silent */) {
|
|
|
18861
18893
|
|
|
18862
18894
|
state.line = nextLine + 1;
|
|
18863
18895
|
|
|
18864
|
-
const token_o
|
|
18865
|
-
token_o.markup
|
|
18866
|
-
token_o.map
|
|
18896
|
+
const token_o = state.push('heading_open', 'h' + String(level), 1);
|
|
18897
|
+
token_o.markup = String.fromCharCode(marker);
|
|
18898
|
+
token_o.map = [startLine, state.line];
|
|
18867
18899
|
|
|
18868
|
-
const token_i
|
|
18869
|
-
token_i.content
|
|
18870
|
-
token_i.map
|
|
18900
|
+
const token_i = state.push('inline', '', 0);
|
|
18901
|
+
token_i.content = content;
|
|
18902
|
+
token_i.map = [startLine, state.line - 1];
|
|
18871
18903
|
token_i.children = [];
|
|
18872
18904
|
|
|
18873
|
-
const token_c
|
|
18874
|
-
token_c.markup
|
|
18905
|
+
const token_c = state.push('heading_close', 'h' + String(level), -1);
|
|
18906
|
+
token_c.markup = String.fromCharCode(marker);
|
|
18875
18907
|
|
|
18876
18908
|
state.parentType = oldParentType;
|
|
18877
18909
|
|
|
@@ -18911,12 +18943,12 @@ function paragraph (state, startLine, endLine) {
|
|
|
18911
18943
|
|
|
18912
18944
|
state.line = nextLine;
|
|
18913
18945
|
|
|
18914
|
-
const token_o
|
|
18915
|
-
token_o.map
|
|
18946
|
+
const token_o = state.push('paragraph_open', 'p', 1);
|
|
18947
|
+
token_o.map = [startLine, state.line];
|
|
18916
18948
|
|
|
18917
|
-
const token_i
|
|
18918
|
-
token_i.content
|
|
18919
|
-
token_i.map
|
|
18949
|
+
const token_i = state.push('inline', '', 0);
|
|
18950
|
+
token_i.content = content;
|
|
18951
|
+
token_i.map = [startLine, state.line];
|
|
18920
18952
|
token_i.children = [];
|
|
18921
18953
|
|
|
18922
18954
|
state.push('paragraph_close', 'p', -1);
|
|
@@ -18936,17 +18968,17 @@ function paragraph (state, startLine, endLine) {
|
|
|
18936
18968
|
const _rules$1 = [
|
|
18937
18969
|
// First 2 params - rule name & source. Secondary array - list of rules,
|
|
18938
18970
|
// which can be terminated by this one.
|
|
18939
|
-
['table',
|
|
18940
|
-
['code',
|
|
18941
|
-
['fence',
|
|
18971
|
+
['table', table, ['paragraph', 'reference']],
|
|
18972
|
+
['code', code$1],
|
|
18973
|
+
['fence', fence, ['paragraph', 'reference', 'blockquote', 'list']],
|
|
18942
18974
|
['blockquote', blockquote, ['paragraph', 'reference', 'blockquote', 'list']],
|
|
18943
|
-
['hr',
|
|
18944
|
-
['list',
|
|
18945
|
-
['reference',
|
|
18975
|
+
['hr', hr, ['paragraph', 'reference', 'blockquote', 'list']],
|
|
18976
|
+
['list', list, ['paragraph', 'reference', 'blockquote']],
|
|
18977
|
+
['reference', reference],
|
|
18946
18978
|
['html_block', html_block, ['paragraph', 'reference', 'blockquote']],
|
|
18947
|
-
['heading',
|
|
18948
|
-
['lheading',
|
|
18949
|
-
['paragraph',
|
|
18979
|
+
['heading', heading, ['paragraph', 'reference', 'blockquote']],
|
|
18980
|
+
['lheading', lheading],
|
|
18981
|
+
['paragraph', paragraph]
|
|
18950
18982
|
];
|
|
18951
18983
|
|
|
18952
18984
|
/**
|
|
@@ -19187,8 +19219,8 @@ StateInline.prototype.scanDelims = function (start, canSplitWord) {
|
|
|
19187
19219
|
const right_flanking =
|
|
19188
19220
|
!isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
|
|
19189
19221
|
|
|
19190
|
-
const can_open
|
|
19191
|
-
const can_close = right_flanking && (canSplitWord || !left_flanking
|
|
19222
|
+
const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar);
|
|
19223
|
+
const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar);
|
|
19192
19224
|
|
|
19193
19225
|
return { can_open, can_close, length: count }
|
|
19194
19226
|
};
|
|
@@ -19283,10 +19315,20 @@ module.exports = function text(state, silent) {
|
|
|
19283
19315
|
return true;
|
|
19284
19316
|
}; */
|
|
19285
19317
|
|
|
19286
|
-
//
|
|
19318
|
+
// Early process links like https://example.org/ to have priority
|
|
19319
|
+
// over emphasis, etc.
|
|
19287
19320
|
|
|
19288
19321
|
// RFC3986: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
|
19289
|
-
|
|
19322
|
+
function isAsciiAlpha (code) {
|
|
19323
|
+
return (code >= 0x41 && code <= 0x5A) || (code >= 0x61 && code <= 0x7A)
|
|
19324
|
+
}
|
|
19325
|
+
|
|
19326
|
+
function isSchemeChar (code) {
|
|
19327
|
+
return (code >= 0x41 && code <= 0x5A) ||
|
|
19328
|
+
(code >= 0x61 && code <= 0x7A) ||
|
|
19329
|
+
(code >= 0x30 && code <= 0x39) ||
|
|
19330
|
+
code === 0x2B || code === 0x2D || code === 0x2E
|
|
19331
|
+
}
|
|
19290
19332
|
|
|
19291
19333
|
function linkify (state, silent) {
|
|
19292
19334
|
if (!state.md.options.linkify) return false
|
|
@@ -19300,19 +19342,27 @@ function linkify (state, silent) {
|
|
|
19300
19342
|
if (state.src.charCodeAt(pos + 1) !== 0x2F/* / */) return false
|
|
19301
19343
|
if (state.src.charCodeAt(pos + 2) !== 0x2F/* / */) return false
|
|
19302
19344
|
|
|
19303
|
-
|
|
19304
|
-
|
|
19345
|
+
// Search backwards for the scheme, but no more than 10 characters, the length
|
|
19346
|
+
// of the pending string, or the length of the source prefix.
|
|
19347
|
+
// Use state.src instead of state.pending because it is faster to access.
|
|
19348
|
+
const protoMin = pos - Math.min(10, state.pending.length, pos);
|
|
19349
|
+
let protoStart = pos;
|
|
19350
|
+
while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) {
|
|
19351
|
+
protoStart--;
|
|
19352
|
+
}
|
|
19305
19353
|
|
|
19306
|
-
|
|
19354
|
+
if (protoStart === pos || !isAsciiAlpha(state.src.charCodeAt(protoStart))) return false
|
|
19307
19355
|
|
|
19308
|
-
const
|
|
19356
|
+
const protoLength = pos - protoStart;
|
|
19357
|
+
|
|
19358
|
+
const link = state.md.linkify.matchAtStart(state.src.slice(protoStart));
|
|
19309
19359
|
if (!link) return false
|
|
19310
19360
|
|
|
19311
19361
|
let url = link.url;
|
|
19312
19362
|
|
|
19313
19363
|
// invalid link, but still detected by linkify somehow;
|
|
19314
19364
|
// need to check to prevent infinite loop below
|
|
19315
|
-
if (url.length <=
|
|
19365
|
+
if (url.length <= protoLength) return false
|
|
19316
19366
|
|
|
19317
19367
|
// disallow '*' at the end of the link (conflicts with emphasis)
|
|
19318
19368
|
// do manual backsearch to avoid perf issues with regex /\*+$/ on "****...****a".
|
|
@@ -19328,7 +19378,7 @@ function linkify (state, silent) {
|
|
|
19328
19378
|
if (!state.md.validateLink(fullUrl)) return false
|
|
19329
19379
|
|
|
19330
19380
|
if (!silent) {
|
|
19331
|
-
state.pending = state.pending.slice(0, -
|
|
19381
|
+
state.pending = state.pending.slice(0, -protoLength);
|
|
19332
19382
|
|
|
19333
19383
|
const token_o = state.push('link_open', 'a', 1);
|
|
19334
19384
|
token_o.attrs = [['href', fullUrl]];
|
|
@@ -19343,7 +19393,7 @@ function linkify (state, silent) {
|
|
|
19343
19393
|
token_c.info = 'auto';
|
|
19344
19394
|
}
|
|
19345
19395
|
|
|
19346
|
-
state.pos += url.length -
|
|
19396
|
+
state.pos += url.length - protoLength;
|
|
19347
19397
|
return true
|
|
19348
19398
|
}
|
|
19349
19399
|
|
|
@@ -19428,6 +19478,20 @@ function escape (state, silent) {
|
|
|
19428
19478
|
return true
|
|
19429
19479
|
}
|
|
19430
19480
|
|
|
19481
|
+
// '\' before a space is a literal backslash. Don't consume the space, so a
|
|
19482
|
+
// trailing two-space hard line break is still detected by the newline rule.
|
|
19483
|
+
if (ch1 === 0x20) {
|
|
19484
|
+
if (!silent) {
|
|
19485
|
+
const token = state.push('text_special', '', 0);
|
|
19486
|
+
token.content = '\\';
|
|
19487
|
+
token.markup = '\\';
|
|
19488
|
+
token.info = 'escape';
|
|
19489
|
+
}
|
|
19490
|
+
|
|
19491
|
+
state.pos = pos;
|
|
19492
|
+
return true
|
|
19493
|
+
}
|
|
19494
|
+
|
|
19431
19495
|
let escapedStr = state.src[pos];
|
|
19432
19496
|
|
|
19433
19497
|
if (ch1 >= 0xD800 && ch1 <= 0xDBFF && pos + 1 < max) {
|
|
@@ -19451,7 +19515,7 @@ function escape (state, silent) {
|
|
|
19451
19515
|
}
|
|
19452
19516
|
|
|
19453
19517
|
token.markup = origStr;
|
|
19454
|
-
token.info
|
|
19518
|
+
token.info = 'escape';
|
|
19455
19519
|
}
|
|
19456
19520
|
|
|
19457
19521
|
state.pos = pos + 1;
|
|
@@ -19541,13 +19605,13 @@ function strikethrough_tokenize (state, silent) {
|
|
|
19541
19605
|
let token;
|
|
19542
19606
|
|
|
19543
19607
|
if (len % 2) {
|
|
19544
|
-
token
|
|
19608
|
+
token = state.push('text', '', 0);
|
|
19545
19609
|
token.content = ch;
|
|
19546
19610
|
len--;
|
|
19547
19611
|
}
|
|
19548
19612
|
|
|
19549
19613
|
for (let i = 0; i < len; i += 2) {
|
|
19550
|
-
token
|
|
19614
|
+
token = state.push('text', '', 0);
|
|
19551
19615
|
token.content = ch + ch;
|
|
19552
19616
|
|
|
19553
19617
|
state.delimiters.push({
|
|
@@ -19583,18 +19647,18 @@ function postProcess$1 (state, delimiters) {
|
|
|
19583
19647
|
|
|
19584
19648
|
const endDelim = delimiters[startDelim.end];
|
|
19585
19649
|
|
|
19586
|
-
token
|
|
19587
|
-
token.type
|
|
19588
|
-
token.tag
|
|
19650
|
+
token = state.tokens[startDelim.token];
|
|
19651
|
+
token.type = 's_open';
|
|
19652
|
+
token.tag = 's';
|
|
19589
19653
|
token.nesting = 1;
|
|
19590
|
-
token.markup
|
|
19654
|
+
token.markup = '~~';
|
|
19591
19655
|
token.content = '';
|
|
19592
19656
|
|
|
19593
|
-
token
|
|
19594
|
-
token.type
|
|
19595
|
-
token.tag
|
|
19657
|
+
token = state.tokens[endDelim.token];
|
|
19658
|
+
token.type = 's_close';
|
|
19659
|
+
token.tag = 's';
|
|
19596
19660
|
token.nesting = -1;
|
|
19597
|
-
token.markup
|
|
19661
|
+
token.markup = '~~';
|
|
19598
19662
|
token.content = '';
|
|
19599
19663
|
|
|
19600
19664
|
if (state.tokens[endDelim.token - 1].type === 'text' &&
|
|
@@ -19729,18 +19793,18 @@ function postProcess (state, delimiters) {
|
|
|
19729
19793
|
|
|
19730
19794
|
const ch = String.fromCharCode(startDelim.marker);
|
|
19731
19795
|
|
|
19732
|
-
const token_o
|
|
19733
|
-
token_o.type
|
|
19734
|
-
token_o.tag
|
|
19796
|
+
const token_o = state.tokens[startDelim.token];
|
|
19797
|
+
token_o.type = isStrong ? 'strong_open' : 'em_open';
|
|
19798
|
+
token_o.tag = isStrong ? 'strong' : 'em';
|
|
19735
19799
|
token_o.nesting = 1;
|
|
19736
|
-
token_o.markup
|
|
19800
|
+
token_o.markup = isStrong ? ch + ch : ch;
|
|
19737
19801
|
token_o.content = '';
|
|
19738
19802
|
|
|
19739
|
-
const token_c
|
|
19740
|
-
token_c.type
|
|
19741
|
-
token_c.tag
|
|
19803
|
+
const token_c = state.tokens[endDelim.token];
|
|
19804
|
+
token_c.type = isStrong ? 'strong_close' : 'em_close';
|
|
19805
|
+
token_c.tag = isStrong ? 'strong' : 'em';
|
|
19742
19806
|
token_c.nesting = -1;
|
|
19743
|
-
token_c.markup
|
|
19807
|
+
token_c.markup = isStrong ? ch + ch : ch;
|
|
19744
19808
|
token_c.content = '';
|
|
19745
19809
|
|
|
19746
19810
|
if (isStrong) {
|
|
@@ -19893,7 +19957,7 @@ function link (state, silent) {
|
|
|
19893
19957
|
|
|
19894
19958
|
const token_o = state.push('link_open', 'a', 1);
|
|
19895
19959
|
const attrs = [['href', href]];
|
|
19896
|
-
token_o.attrs
|
|
19960
|
+
token_o.attrs = attrs;
|
|
19897
19961
|
if (title) {
|
|
19898
19962
|
attrs.push(['title', title]);
|
|
19899
19963
|
}
|
|
@@ -20051,7 +20115,7 @@ function image (state, silent) {
|
|
|
20051
20115
|
// Process autolinks '<protocol:...>'
|
|
20052
20116
|
|
|
20053
20117
|
/* eslint max-len:0 */
|
|
20054
|
-
const EMAIL_RE
|
|
20118
|
+
const EMAIL_RE = /^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/;
|
|
20055
20119
|
/* eslint-disable-next-line no-control-regex */
|
|
20056
20120
|
const AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;
|
|
20057
20121
|
|
|
@@ -20079,17 +20143,17 @@ function autolink (state, silent) {
|
|
|
20079
20143
|
if (!state.md.validateLink(fullUrl)) { return false }
|
|
20080
20144
|
|
|
20081
20145
|
if (!silent) {
|
|
20082
|
-
const token_o
|
|
20083
|
-
token_o.attrs
|
|
20084
|
-
token_o.markup
|
|
20085
|
-
token_o.info
|
|
20146
|
+
const token_o = state.push('link_open', 'a', 1);
|
|
20147
|
+
token_o.attrs = [['href', fullUrl]];
|
|
20148
|
+
token_o.markup = 'autolink';
|
|
20149
|
+
token_o.info = 'auto';
|
|
20086
20150
|
|
|
20087
|
-
const token_t
|
|
20151
|
+
const token_t = state.push('text', '', 0);
|
|
20088
20152
|
token_t.content = state.md.normalizeLinkText(url);
|
|
20089
20153
|
|
|
20090
|
-
const token_c
|
|
20091
|
-
token_c.markup
|
|
20092
|
-
token_c.info
|
|
20154
|
+
const token_c = state.push('link_close', 'a', -1);
|
|
20155
|
+
token_c.markup = 'autolink';
|
|
20156
|
+
token_c.info = 'auto';
|
|
20093
20157
|
}
|
|
20094
20158
|
|
|
20095
20159
|
state.pos += url.length + 2;
|
|
@@ -20101,17 +20165,17 @@ function autolink (state, silent) {
|
|
|
20101
20165
|
if (!state.md.validateLink(fullUrl)) { return false }
|
|
20102
20166
|
|
|
20103
20167
|
if (!silent) {
|
|
20104
|
-
const token_o
|
|
20105
|
-
token_o.attrs
|
|
20106
|
-
token_o.markup
|
|
20107
|
-
token_o.info
|
|
20168
|
+
const token_o = state.push('link_open', 'a', 1);
|
|
20169
|
+
token_o.attrs = [['href', fullUrl]];
|
|
20170
|
+
token_o.markup = 'autolink';
|
|
20171
|
+
token_o.info = 'auto';
|
|
20108
20172
|
|
|
20109
|
-
const token_t
|
|
20173
|
+
const token_t = state.push('text', '', 0);
|
|
20110
20174
|
token_t.content = state.md.normalizeLinkText(url);
|
|
20111
20175
|
|
|
20112
|
-
const token_c
|
|
20113
|
-
token_c.markup
|
|
20114
|
-
token_c.info
|
|
20176
|
+
const token_c = state.push('link_close', 'a', -1);
|
|
20177
|
+
token_c.markup = 'autolink';
|
|
20178
|
+
token_c.info = 'auto';
|
|
20115
20179
|
}
|
|
20116
20180
|
|
|
20117
20181
|
state.pos += url.length + 2;
|
|
@@ -20164,7 +20228,7 @@ function html_inline (state, silent) {
|
|
|
20164
20228
|
const token = state.push('html_inline', '', 0);
|
|
20165
20229
|
token.content = match[0];
|
|
20166
20230
|
|
|
20167
|
-
if (isLinkOpen(token.content))
|
|
20231
|
+
if (isLinkOpen(token.content)) state.linkLevel++;
|
|
20168
20232
|
if (isLinkClose(token.content)) state.linkLevel--;
|
|
20169
20233
|
}
|
|
20170
20234
|
state.pos += match[0].length;
|
|
@@ -20175,7 +20239,7 @@ function html_inline (state, silent) {
|
|
|
20175
20239
|
|
|
20176
20240
|
|
|
20177
20241
|
const DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
|
|
20178
|
-
const NAMED_RE
|
|
20242
|
+
const NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
|
|
20179
20243
|
|
|
20180
20244
|
function entity (state, silent) {
|
|
20181
20245
|
const pos = state.pos;
|
|
@@ -20193,10 +20257,10 @@ function entity (state, silent) {
|
|
|
20193
20257
|
if (!silent) {
|
|
20194
20258
|
const code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
|
|
20195
20259
|
|
|
20196
|
-
const token
|
|
20260
|
+
const token = state.push('text_special', '', 0);
|
|
20197
20261
|
token.content = isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);
|
|
20198
|
-
token.markup
|
|
20199
|
-
token.info
|
|
20262
|
+
token.markup = match[0];
|
|
20263
|
+
token.info = 'entity';
|
|
20200
20264
|
}
|
|
20201
20265
|
state.pos += match[0].length;
|
|
20202
20266
|
return true
|
|
@@ -20207,10 +20271,10 @@ function entity (state, silent) {
|
|
|
20207
20271
|
const decoded = decodeHTMLStrict(match[0]);
|
|
20208
20272
|
if (decoded !== match[0]) {
|
|
20209
20273
|
if (!silent) {
|
|
20210
|
-
const token
|
|
20274
|
+
const token = state.push('text_special', '', 0);
|
|
20211
20275
|
token.content = decoded;
|
|
20212
|
-
token.markup
|
|
20213
|
-
token.info
|
|
20276
|
+
token.markup = match[0];
|
|
20277
|
+
token.info = 'entity';
|
|
20214
20278
|
}
|
|
20215
20279
|
state.pos += match[0].length;
|
|
20216
20280
|
return true
|
|
@@ -20308,8 +20372,8 @@ function processDelimiters (delimiters) {
|
|
|
20308
20372
|
jumps[closerIdx] = closerIdx - openerIdx + lastJump;
|
|
20309
20373
|
jumps[openerIdx] = lastJump;
|
|
20310
20374
|
|
|
20311
|
-
closer.open
|
|
20312
|
-
opener.end
|
|
20375
|
+
closer.open = false;
|
|
20376
|
+
opener.end = closerIdx;
|
|
20313
20377
|
opener.close = false;
|
|
20314
20378
|
newMinOpenerIdx = -1;
|
|
20315
20379
|
// treat next token as start of run,
|
|
@@ -20395,18 +20459,18 @@ function fragments_join (state) {
|
|
|
20395
20459
|
// Parser rules
|
|
20396
20460
|
|
|
20397
20461
|
const _rules = [
|
|
20398
|
-
['text',
|
|
20399
|
-
['linkify',
|
|
20400
|
-
['newline',
|
|
20401
|
-
['escape',
|
|
20402
|
-
['backticks',
|
|
20403
|
-
['strikethrough',
|
|
20404
|
-
['emphasis',
|
|
20405
|
-
['link',
|
|
20406
|
-
['image',
|
|
20407
|
-
['autolink',
|
|
20408
|
-
['html_inline',
|
|
20409
|
-
['entity',
|
|
20462
|
+
['text', text],
|
|
20463
|
+
['linkify', linkify],
|
|
20464
|
+
['newline', newline],
|
|
20465
|
+
['escape', escape],
|
|
20466
|
+
['backticks', backtick],
|
|
20467
|
+
['strikethrough', r_strikethrough.tokenize],
|
|
20468
|
+
['emphasis', r_emphasis.tokenize],
|
|
20469
|
+
['link', link],
|
|
20470
|
+
['image', image],
|
|
20471
|
+
['autolink', autolink],
|
|
20472
|
+
['html_inline', html_inline],
|
|
20473
|
+
['entity', entity]
|
|
20410
20474
|
];
|
|
20411
20475
|
|
|
20412
20476
|
// `rule2` ruleset was created specifically for emphasis/strikethrough
|
|
@@ -20415,12 +20479,12 @@ const _rules = [
|
|
|
20415
20479
|
// Don't use this for anything except pairs (plugins working with `balance_pairs`).
|
|
20416
20480
|
//
|
|
20417
20481
|
const _rules2 = [
|
|
20418
|
-
['balance_pairs',
|
|
20419
|
-
['strikethrough',
|
|
20420
|
-
['emphasis',
|
|
20482
|
+
['balance_pairs', link_pairs],
|
|
20483
|
+
['strikethrough', r_strikethrough.postProcess],
|
|
20484
|
+
['emphasis', r_emphasis.postProcess],
|
|
20421
20485
|
// rules for pairs separate '**' into its own text tokens, which may be left unused,
|
|
20422
20486
|
// rule below merges unused segments back with the rest of the text
|
|
20423
|
-
['fragments_join',
|
|
20487
|
+
['fragments_join', fragments_join]
|
|
20424
20488
|
];
|
|
20425
20489
|
|
|
20426
20490
|
/**
|
|
@@ -22623,7 +22687,7 @@ const schema$1 = new Schema({
|
|
|
22623
22687
|
toDOM() { return ["div", ["hr"]]; }
|
|
22624
22688
|
},
|
|
22625
22689
|
heading: {
|
|
22626
|
-
attrs: { level: { default: 1 } },
|
|
22690
|
+
attrs: { level: { default: 1, validate: "number" } },
|
|
22627
22691
|
content: "(text | image)*",
|
|
22628
22692
|
group: "block",
|
|
22629
22693
|
defining: true,
|
|
@@ -22633,7 +22697,7 @@ const schema$1 = new Schema({
|
|
|
22633
22697
|
{ tag: "h4", attrs: { level: 4 } },
|
|
22634
22698
|
{ tag: "h5", attrs: { level: 5 } },
|
|
22635
22699
|
{ tag: "h6", attrs: { level: 6 } }],
|
|
22636
|
-
toDOM(node) { return ["h" + node.attrs.level, 0]; }
|
|
22700
|
+
toDOM(node) { return ["h" + +node.attrs.level, 0]; }
|
|
22637
22701
|
},
|
|
22638
22702
|
code_block: {
|
|
22639
22703
|
content: "text*",
|
|
@@ -23624,7 +23688,7 @@ const nodes = {
|
|
|
23624
23688
|
{ tag: "h4", attrs: { level: 4 } },
|
|
23625
23689
|
{ tag: "h5", attrs: { level: 5 } },
|
|
23626
23690
|
{ tag: "h6", attrs: { level: 6 } }],
|
|
23627
|
-
toDOM(node) { return ["h" + node.attrs.level, 0]; }
|
|
23691
|
+
toDOM(node) { return ["h" + +node.attrs.level, 0]; }
|
|
23628
23692
|
},
|
|
23629
23693
|
/**
|
|
23630
23694
|
A code listing. Disallows marks or non-text inline
|