@limetech/lime-elements 40.5.2 → 40.6.0
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 +25 -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/{index-ETPz91V5.js → index-zZvs6xK-.js} +9382 -9504
- 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/lime-elements.cjs.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 +511 -71
- 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-markdown.cjs.entry.js +28 -4
- package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +328 -264
- package/dist/cjs/limel-tab-bar.cjs.entry.js +83 -4
- package/dist/cjs/limel-table.cjs.entry.js +598 -199
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/markdown-exporter-9p7d3Q76.js +6210 -0
- package/dist/cjs/{markdown-parser-YH5HSSgF.js → markdown-parser-Cgv5Y9Z4.js} +579 -848
- 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/markdown/markdown-exporter.js +186 -0
- package/dist/collection/components/markdown/markdown-parser.js +2 -3
- package/dist/collection/components/markdown/markdown.js +54 -2
- 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/{index-CbciMfiU.js → index-BN64nlbO.js} +9369 -9505
- 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/lime-elements.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 +511 -71
- package/dist/esm/limel-flatpickr-adapter.entry.js +69 -7
- package/dist/esm/limel-form.entry.js +1854 -1916
- package/dist/esm/limel-markdown.entry.js +28 -4
- package/dist/esm/limel-prosemirror-adapter.entry.js +329 -265
- package/dist/esm/limel-tab-bar.entry.js +83 -4
- package/dist/esm/limel-table.entry.js +595 -196
- package/dist/esm/loader.js +1 -1
- package/dist/esm/markdown-exporter--3_MaqwD.js +6208 -0
- package/dist/esm/{markdown-parser-DrxxGLF5.js → markdown-parser-DCf-3dKZ.js} +506 -791
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-0fba64eb.entry.js +16 -0
- package/dist/lime-elements/p-19344984.entry.js +13 -0
- package/dist/lime-elements/p-20658306.entry.js +1 -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-BPzhuHcl.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-CC4Usa-Q.js +7 -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-_UXAljNc.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-dc9cd793.entry.js +1 -0
- package/dist/lime-elements/p-dd62042a.entry.js +1 -0
- 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/dist/types/components/markdown/markdown-exporter.d.ts +15 -0
- package/dist/types/components/markdown/markdown.d.ts +19 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/types/global/shared-types/custom-element.types.d.ts +25 -0
- package/package.json +17 -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-6d5b23ad.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-C9xHOCE_.js +0 -7
- 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-DMNtoJ8I.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
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
var index$1 = require('./index--B6-r0uo.js');
|
|
4
4
|
var types = require('./types-C7gNcwzE.js');
|
|
5
|
-
var markdownParser = require('./markdown-parser-
|
|
6
|
-
var cloneDeep = require('./cloneDeep-
|
|
5
|
+
var markdownParser = require('./markdown-parser-Cgv5Y9Z4.js');
|
|
6
|
+
var cloneDeep = require('./cloneDeep-D2immmwT.js');
|
|
7
7
|
var translations = require('./translations-DFFpR6AZ.js');
|
|
8
|
-
var index = require('./index-
|
|
8
|
+
var index = require('./index-zZvs6xK-.js');
|
|
9
9
|
var randomString = require('./random-string-BTzDB2ee.js');
|
|
10
10
|
var isItem = require('./is-item-DMELyaao.js');
|
|
11
11
|
var files = require('./files-DI4jItxi.js');
|
|
12
|
-
var isEqual = require('./isEqual-
|
|
12
|
+
var isEqual = require('./isEqual-D3eFkhqd.js');
|
|
13
13
|
var debounce = require('./debounce-DgDnRSlt.js');
|
|
14
14
|
require('./_commonjsHelpers-CFO10eej.js');
|
|
15
|
-
require('./_baseIsEqual-
|
|
15
|
+
require('./_baseIsEqual-zzV9DKMv.js');
|
|
16
16
|
require('./eq-DFcUoVzv.js');
|
|
17
17
|
require('./_getTag-BC28Za7d.js');
|
|
18
18
|
require('./isObject-B6Osvvqp.js');
|
|
@@ -24,7 +24,7 @@ require('./isArray-BuFVIU_i.js');
|
|
|
24
24
|
require('./_isIndex-Bu45fvR7.js');
|
|
25
25
|
require('./_assignValue-DQh76m39.js');
|
|
26
26
|
require('./_defineProperty-Csu6P9HT.js');
|
|
27
|
-
require('./
|
|
27
|
+
require('./_getPrototype-CCLHkBHj.js');
|
|
28
28
|
require('./language-CaqPKPyW.js');
|
|
29
29
|
require('./file-metadata-BrhOssGG.js');
|
|
30
30
|
require('./icons-isR5V1X0.js');
|
|
@@ -682,7 +682,6 @@ class Mark {
|
|
|
682
682
|
if (!type)
|
|
683
683
|
throw new RangeError(`There is no mark type ${json.type} in this schema`);
|
|
684
684
|
let mark = type.create(json.attrs);
|
|
685
|
-
type.checkAttrs(mark.attrs);
|
|
686
685
|
return mark;
|
|
687
686
|
}
|
|
688
687
|
/**
|
|
@@ -1662,11 +1661,11 @@ class Node {
|
|
|
1662
1661
|
*/
|
|
1663
1662
|
check() {
|
|
1664
1663
|
this.type.checkContent(this.content);
|
|
1665
|
-
this.type.
|
|
1664
|
+
checkAttrs(this.type.attrs, this.attrs, "node", this.type.name);
|
|
1666
1665
|
let copy = Mark.none;
|
|
1667
1666
|
for (let i = 0; i < this.marks.length; i++) {
|
|
1668
1667
|
let mark = this.marks[i];
|
|
1669
|
-
mark.type.
|
|
1668
|
+
checkAttrs(mark.type.attrs, mark.attrs, "mark", mark.type.name);
|
|
1670
1669
|
copy = mark.addToSet(copy);
|
|
1671
1670
|
}
|
|
1672
1671
|
if (!Mark.sameSet(copy, this.marks))
|
|
@@ -1707,7 +1706,6 @@ class Node {
|
|
|
1707
1706
|
}
|
|
1708
1707
|
let content = Fragment.fromJSON(schema, json.content);
|
|
1709
1708
|
let node = schema.nodeType(json.type).create(json.attrs, content, marks);
|
|
1710
|
-
node.type.checkAttrs(node.attrs);
|
|
1711
1709
|
return node;
|
|
1712
1710
|
}
|
|
1713
1711
|
}
|
|
@@ -1757,6 +1755,15 @@ function wrapMarks(marks, str) {
|
|
|
1757
1755
|
str = marks[i].type.name + "(" + str + ")";
|
|
1758
1756
|
return str;
|
|
1759
1757
|
}
|
|
1758
|
+
function checkAttrs(attrs, values, type, name) {
|
|
1759
|
+
for (let attr in values)
|
|
1760
|
+
if (!(attr in attrs))
|
|
1761
|
+
throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
|
|
1762
|
+
for (let attr in attrs) {
|
|
1763
|
+
if (attrs[attr].validate)
|
|
1764
|
+
attrs[attr].validate(values[attr]);
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1760
1767
|
|
|
1761
1768
|
/**
|
|
1762
1769
|
Instances of this class represent a match state of a node type's
|
|
@@ -2211,27 +2218,21 @@ function defaultAttrs(attrs) {
|
|
|
2211
2218
|
function computeAttrs(attrs, value) {
|
|
2212
2219
|
let built = Object.create(null);
|
|
2213
2220
|
for (let name in attrs) {
|
|
2221
|
+
let attr = attrs[name];
|
|
2214
2222
|
let given = value && value[name];
|
|
2215
2223
|
if (given === undefined) {
|
|
2216
|
-
let attr = attrs[name];
|
|
2217
2224
|
if (attr.hasDefault)
|
|
2218
2225
|
given = attr.default;
|
|
2219
2226
|
else
|
|
2220
2227
|
throw new RangeError("No value supplied for attribute " + name);
|
|
2221
2228
|
}
|
|
2229
|
+
else if (attr.validate) {
|
|
2230
|
+
attr.validate(given);
|
|
2231
|
+
}
|
|
2222
2232
|
built[name] = given;
|
|
2223
2233
|
}
|
|
2224
2234
|
return built;
|
|
2225
2235
|
}
|
|
2226
|
-
function checkAttrs(attrs, values, type, name) {
|
|
2227
|
-
for (let attr in values)
|
|
2228
|
-
if (!(attr in attrs))
|
|
2229
|
-
throw new RangeError(`Unsupported attribute ${attr} for ${type} of type ${name}`);
|
|
2230
|
-
for (let attr in attrs) {
|
|
2231
|
-
if (attrs[attr].validate)
|
|
2232
|
-
attrs[attr].validate(values[attr]);
|
|
2233
|
-
}
|
|
2234
|
-
}
|
|
2235
2236
|
function initAttrs(typeName, attrs) {
|
|
2236
2237
|
let result = Object.create(null);
|
|
2237
2238
|
if (attrs)
|
|
@@ -2403,11 +2404,9 @@ let NodeType$1 = class NodeType {
|
|
|
2403
2404
|
throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);
|
|
2404
2405
|
}
|
|
2405
2406
|
/**
|
|
2406
|
-
@internal
|
|
2407
|
+
@internal no longer useful, but called by old prosemirror-view versions
|
|
2407
2408
|
*/
|
|
2408
|
-
checkAttrs(attrs) {
|
|
2409
|
-
checkAttrs(this.attrs, attrs, "node", this.name);
|
|
2410
|
-
}
|
|
2409
|
+
checkAttrs(attrs) { }
|
|
2411
2410
|
/**
|
|
2412
2411
|
Check whether the given mark type is allowed in this node.
|
|
2413
2412
|
*/
|
|
@@ -2554,12 +2553,6 @@ class MarkType {
|
|
|
2554
2553
|
return set[i];
|
|
2555
2554
|
}
|
|
2556
2555
|
/**
|
|
2557
|
-
@internal
|
|
2558
|
-
*/
|
|
2559
|
-
checkAttrs(attrs) {
|
|
2560
|
-
checkAttrs(this.attrs, attrs, "mark", this.name);
|
|
2561
|
-
}
|
|
2562
|
-
/**
|
|
2563
2556
|
Queries whether a given mark type is
|
|
2564
2557
|
[excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.
|
|
2565
2558
|
*/
|
|
@@ -15275,7 +15268,6 @@ function arrayReplaceAt (src, pos, newElements) {
|
|
|
15275
15268
|
}
|
|
15276
15269
|
|
|
15277
15270
|
function isValidEntityCode (c) {
|
|
15278
|
-
/* eslint no-bitwise:0 */
|
|
15279
15271
|
// broken sequence
|
|
15280
15272
|
if (c >= 0xD800 && c <= 0xDFFF) { return false }
|
|
15281
15273
|
// never used
|
|
@@ -15303,8 +15295,8 @@ function fromCodePoint (c) {
|
|
|
15303
15295
|
return String.fromCharCode(c)
|
|
15304
15296
|
}
|
|
15305
15297
|
|
|
15306
|
-
const UNESCAPE_MD_RE
|
|
15307
|
-
const ENTITY_RE
|
|
15298
|
+
const UNESCAPE_MD_RE = /\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g;
|
|
15299
|
+
const ENTITY_RE = /&([a-z#][a-z0-9]{1,31});/gi;
|
|
15308
15300
|
const UNESCAPE_ALL_RE = new RegExp(UNESCAPE_MD_RE.source + '|' + ENTITY_RE.source, 'gi');
|
|
15309
15301
|
|
|
15310
15302
|
const DIGITAL_ENTITY_TEST_RE = /^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;
|
|
@@ -15330,12 +15322,6 @@ function replaceEntityPattern (match, name) {
|
|
|
15330
15322
|
return match
|
|
15331
15323
|
}
|
|
15332
15324
|
|
|
15333
|
-
/* function replaceEntities(str) {
|
|
15334
|
-
if (str.indexOf('&') < 0) { return str; }
|
|
15335
|
-
|
|
15336
|
-
return str.replace(ENTITY_RE, replaceEntityPattern);
|
|
15337
|
-
} */
|
|
15338
|
-
|
|
15339
15325
|
function unescapeMd (str) {
|
|
15340
15326
|
if (str.indexOf('\\') < 0) { return str }
|
|
15341
15327
|
return str.replace(UNESCAPE_MD_RE, '$1')
|
|
@@ -15405,8 +15391,6 @@ function isWhiteSpace (code) {
|
|
|
15405
15391
|
return false
|
|
15406
15392
|
}
|
|
15407
15393
|
|
|
15408
|
-
/* eslint-disable max-len */
|
|
15409
|
-
|
|
15410
15394
|
// Currently without astral characters support.
|
|
15411
15395
|
function isPunctChar (ch) {
|
|
15412
15396
|
return P.test(ch) || regex.test(ch)
|
|
@@ -15666,7 +15650,7 @@ function parseLinkDestination (str, start, max) {
|
|
|
15666
15650
|
if (code < 0x20 || code === 0x7F) { break }
|
|
15667
15651
|
|
|
15668
15652
|
if (code === 0x5C /* \ */ && pos + 1 < max) {
|
|
15669
|
-
if (str.charCodeAt(pos + 1) === 0x20) {
|
|
15653
|
+
if (str.charCodeAt(pos + 1) === 0x20) { pos++; continue }
|
|
15670
15654
|
pos += 2;
|
|
15671
15655
|
continue
|
|
15672
15656
|
}
|
|
@@ -15782,7 +15766,7 @@ const default_rules = {};
|
|
|
15782
15766
|
default_rules.code_inline = function (tokens, idx, options, env, slf) {
|
|
15783
15767
|
const token = tokens[idx];
|
|
15784
15768
|
|
|
15785
|
-
return
|
|
15769
|
+
return '<code' + slf.renderAttrs(token) + '>' +
|
|
15786
15770
|
escapeHtml(token.content) +
|
|
15787
15771
|
'</code>'
|
|
15788
15772
|
};
|
|
@@ -15790,7 +15774,7 @@ default_rules.code_inline = function (tokens, idx, options, env, slf) {
|
|
|
15790
15774
|
default_rules.code_block = function (tokens, idx, options, env, slf) {
|
|
15791
15775
|
const token = tokens[idx];
|
|
15792
15776
|
|
|
15793
|
-
return
|
|
15777
|
+
return '<pre' + slf.renderAttrs(token) + '><code>' +
|
|
15794
15778
|
escapeHtml(tokens[idx].content) +
|
|
15795
15779
|
'</code></pre>\n'
|
|
15796
15780
|
};
|
|
@@ -16443,28 +16427,28 @@ function Token (type, tag, nesting) {
|
|
|
16443
16427
|
*
|
|
16444
16428
|
* Type of the token (string, e.g. "paragraph_open")
|
|
16445
16429
|
**/
|
|
16446
|
-
this.type
|
|
16430
|
+
this.type = type;
|
|
16447
16431
|
|
|
16448
16432
|
/**
|
|
16449
16433
|
* Token#tag -> String
|
|
16450
16434
|
*
|
|
16451
16435
|
* html tag name, e.g. "p"
|
|
16452
16436
|
**/
|
|
16453
|
-
this.tag
|
|
16437
|
+
this.tag = tag;
|
|
16454
16438
|
|
|
16455
16439
|
/**
|
|
16456
16440
|
* Token#attrs -> Array
|
|
16457
16441
|
*
|
|
16458
16442
|
* Html attributes. Format: `[ [ name1, value1 ], [ name2, value2 ] ]`
|
|
16459
16443
|
**/
|
|
16460
|
-
this.attrs
|
|
16444
|
+
this.attrs = null;
|
|
16461
16445
|
|
|
16462
16446
|
/**
|
|
16463
16447
|
* Token#map -> Array
|
|
16464
16448
|
*
|
|
16465
16449
|
* Source map info. Format: `[ line_begin, line_end ]`
|
|
16466
16450
|
**/
|
|
16467
|
-
this.map
|
|
16451
|
+
this.map = null;
|
|
16468
16452
|
|
|
16469
16453
|
/**
|
|
16470
16454
|
* Token#nesting -> Number
|
|
@@ -16475,14 +16459,14 @@ function Token (type, tag, nesting) {
|
|
|
16475
16459
|
* - `0` means the tag is self-closing
|
|
16476
16460
|
* - `-1` means the tag is closing
|
|
16477
16461
|
**/
|
|
16478
|
-
this.nesting
|
|
16462
|
+
this.nesting = nesting;
|
|
16479
16463
|
|
|
16480
16464
|
/**
|
|
16481
16465
|
* Token#level -> Number
|
|
16482
16466
|
*
|
|
16483
16467
|
* nesting level, the same as `state.level`
|
|
16484
16468
|
**/
|
|
16485
|
-
this.level
|
|
16469
|
+
this.level = 0;
|
|
16486
16470
|
|
|
16487
16471
|
/**
|
|
16488
16472
|
* Token#children -> Array
|
|
@@ -16497,14 +16481,14 @@ function Token (type, tag, nesting) {
|
|
|
16497
16481
|
* In a case of self-closing tag (code, html, fence, etc.),
|
|
16498
16482
|
* it has contents of this tag.
|
|
16499
16483
|
**/
|
|
16500
|
-
this.content
|
|
16484
|
+
this.content = '';
|
|
16501
16485
|
|
|
16502
16486
|
/**
|
|
16503
16487
|
* Token#markup -> String
|
|
16504
16488
|
*
|
|
16505
16489
|
* '*' or '_' for emphasis, fence string for fence, etc.
|
|
16506
16490
|
**/
|
|
16507
|
-
this.markup
|
|
16491
|
+
this.markup = '';
|
|
16508
16492
|
|
|
16509
16493
|
/**
|
|
16510
16494
|
* Token#info -> String
|
|
@@ -16515,14 +16499,14 @@ function Token (type, tag, nesting) {
|
|
|
16515
16499
|
* - The value "auto" for autolink "link_open" and "link_close" tokens
|
|
16516
16500
|
* - The string value of the item marker for ordered-list "list_item_open" tokens
|
|
16517
16501
|
**/
|
|
16518
|
-
this.info
|
|
16502
|
+
this.info = '';
|
|
16519
16503
|
|
|
16520
16504
|
/**
|
|
16521
16505
|
* Token#meta -> Object
|
|
16522
16506
|
*
|
|
16523
16507
|
* A place for plugins to store an arbitrary data
|
|
16524
16508
|
**/
|
|
16525
|
-
this.meta
|
|
16509
|
+
this.meta = null;
|
|
16526
16510
|
|
|
16527
16511
|
/**
|
|
16528
16512
|
* Token#block -> Boolean
|
|
@@ -16530,7 +16514,7 @@ function Token (type, tag, nesting) {
|
|
|
16530
16514
|
* True for block-level tokens, false for inline tokens.
|
|
16531
16515
|
* Used in renderer to calculate line breaks
|
|
16532
16516
|
**/
|
|
16533
|
-
this.block
|
|
16517
|
+
this.block = false;
|
|
16534
16518
|
|
|
16535
16519
|
/**
|
|
16536
16520
|
* Token#hidden -> Boolean
|
|
@@ -16538,7 +16522,7 @@ function Token (type, tag, nesting) {
|
|
|
16538
16522
|
* If it's true, ignore this element when rendering. Used for tight lists
|
|
16539
16523
|
* to hide paragraphs.
|
|
16540
16524
|
**/
|
|
16541
|
-
this.hidden
|
|
16525
|
+
this.hidden = false;
|
|
16542
16526
|
}
|
|
16543
16527
|
|
|
16544
16528
|
/**
|
|
@@ -16634,8 +16618,8 @@ StateCore.prototype.Token = Token;
|
|
|
16634
16618
|
// Normalize input string
|
|
16635
16619
|
|
|
16636
16620
|
// https://spec.commonmark.org/0.29/#line-ending
|
|
16637
|
-
const NEWLINES_RE
|
|
16638
|
-
const NULL_RE
|
|
16621
|
+
const NEWLINES_RE = /\r\n?|\n/g;
|
|
16622
|
+
const NULL_RE = /\0/g;
|
|
16639
16623
|
|
|
16640
16624
|
function normalize$1 (state) {
|
|
16641
16625
|
let str;
|
|
@@ -16653,9 +16637,9 @@ function block (state) {
|
|
|
16653
16637
|
let token;
|
|
16654
16638
|
|
|
16655
16639
|
if (state.inlineMode) {
|
|
16656
|
-
token
|
|
16657
|
-
token.content
|
|
16658
|
-
token.map
|
|
16640
|
+
token = new state.Token('inline', '', 0);
|
|
16641
|
+
token.content = state.src;
|
|
16642
|
+
token.map = [0, 1];
|
|
16659
16643
|
token.children = [];
|
|
16660
16644
|
state.tokens.push(token);
|
|
16661
16645
|
} else {
|
|
@@ -16680,7 +16664,6 @@ function inline (state) {
|
|
|
16680
16664
|
// Currently restricted by `md.validateLink()` to http/https/ftp
|
|
16681
16665
|
//
|
|
16682
16666
|
|
|
16683
|
-
|
|
16684
16667
|
function isLinkOpen$1 (str) {
|
|
16685
16668
|
return /^<a[>\s]/i.test(str)
|
|
16686
16669
|
}
|
|
@@ -16699,7 +16682,8 @@ function linkify$1 (state) {
|
|
|
16699
16682
|
continue
|
|
16700
16683
|
}
|
|
16701
16684
|
|
|
16702
|
-
|
|
16685
|
+
const tokens = blockTokens[j].children;
|
|
16686
|
+
const replacements = [];
|
|
16703
16687
|
|
|
16704
16688
|
let htmlLinkLevel = 0;
|
|
16705
16689
|
|
|
@@ -16769,43 +16753,70 @@ function linkify$1 (state) {
|
|
|
16769
16753
|
const pos = links[ln].index;
|
|
16770
16754
|
|
|
16771
16755
|
if (pos > lastPos) {
|
|
16772
|
-
const token
|
|
16756
|
+
const token = new state.Token('text', '', 0);
|
|
16773
16757
|
token.content = text.slice(lastPos, pos);
|
|
16774
|
-
token.level
|
|
16758
|
+
token.level = level;
|
|
16775
16759
|
nodes.push(token);
|
|
16776
16760
|
}
|
|
16777
16761
|
|
|
16778
|
-
const token_o
|
|
16779
|
-
token_o.attrs
|
|
16780
|
-
token_o.level
|
|
16781
|
-
token_o.markup
|
|
16782
|
-
token_o.info
|
|
16762
|
+
const token_o = new state.Token('link_open', 'a', 1);
|
|
16763
|
+
token_o.attrs = [['href', fullUrl]];
|
|
16764
|
+
token_o.level = level++;
|
|
16765
|
+
token_o.markup = 'linkify';
|
|
16766
|
+
token_o.info = 'auto';
|
|
16783
16767
|
nodes.push(token_o);
|
|
16784
16768
|
|
|
16785
|
-
const token_t
|
|
16769
|
+
const token_t = new state.Token('text', '', 0);
|
|
16786
16770
|
token_t.content = urlText;
|
|
16787
|
-
token_t.level
|
|
16771
|
+
token_t.level = level;
|
|
16788
16772
|
nodes.push(token_t);
|
|
16789
16773
|
|
|
16790
|
-
const token_c
|
|
16791
|
-
token_c.level
|
|
16792
|
-
token_c.markup
|
|
16793
|
-
token_c.info
|
|
16774
|
+
const token_c = new state.Token('link_close', 'a', -1);
|
|
16775
|
+
token_c.level = --level;
|
|
16776
|
+
token_c.markup = 'linkify';
|
|
16777
|
+
token_c.info = 'auto';
|
|
16794
16778
|
nodes.push(token_c);
|
|
16795
16779
|
|
|
16796
16780
|
lastPos = links[ln].lastIndex;
|
|
16797
16781
|
}
|
|
16798
16782
|
if (lastPos < text.length) {
|
|
16799
|
-
const token
|
|
16783
|
+
const token = new state.Token('text', '', 0);
|
|
16800
16784
|
token.content = text.slice(lastPos);
|
|
16801
|
-
token.level
|
|
16785
|
+
token.level = level;
|
|
16802
16786
|
nodes.push(token);
|
|
16803
16787
|
}
|
|
16804
16788
|
|
|
16805
|
-
|
|
16806
|
-
blockTokens[j].children = tokens = arrayReplaceAt(tokens, i, nodes);
|
|
16789
|
+
replacements.push({ index: i, nodes });
|
|
16807
16790
|
}
|
|
16808
16791
|
}
|
|
16792
|
+
|
|
16793
|
+
if (replacements.length > 0) {
|
|
16794
|
+
let newTokensLength = tokens.length;
|
|
16795
|
+
for (const replacement of replacements) {
|
|
16796
|
+
newTokensLength += replacement.nodes.length - 1;
|
|
16797
|
+
}
|
|
16798
|
+
|
|
16799
|
+
const newTokens = new Array(newTokensLength);
|
|
16800
|
+
let replacementIndex = 0;
|
|
16801
|
+
let newTokenIndex = 0;
|
|
16802
|
+
|
|
16803
|
+
replacements.reverse();
|
|
16804
|
+
|
|
16805
|
+
for (let i = 0; i < tokens.length; i++) {
|
|
16806
|
+
const replacement = replacements[replacementIndex];
|
|
16807
|
+
|
|
16808
|
+
if (replacement?.index === i) {
|
|
16809
|
+
for (const node of replacement.nodes) {
|
|
16810
|
+
newTokens[newTokenIndex++] = node;
|
|
16811
|
+
}
|
|
16812
|
+
replacementIndex++;
|
|
16813
|
+
} else {
|
|
16814
|
+
newTokens[newTokenIndex++] = tokens[i];
|
|
16815
|
+
}
|
|
16816
|
+
}
|
|
16817
|
+
|
|
16818
|
+
blockTokens[j].children = newTokens;
|
|
16819
|
+
}
|
|
16809
16820
|
}
|
|
16810
16821
|
}
|
|
16811
16822
|
|
|
@@ -16918,6 +16929,19 @@ function replace (state) {
|
|
|
16918
16929
|
const QUOTE_TEST_RE = /['"]/;
|
|
16919
16930
|
const QUOTE_RE = /['"]/g;
|
|
16920
16931
|
const APOSTROPHE = '\u2019'; /* ’ */
|
|
16932
|
+
// Caps memory on malicious input
|
|
16933
|
+
const MAX_OPENERS = 1000;
|
|
16934
|
+
|
|
16935
|
+
function truncateStack (stack, heads, length) {
|
|
16936
|
+
while (stack.length > length) {
|
|
16937
|
+
const item = stack.pop();
|
|
16938
|
+
if (item.isSingleQuote) {
|
|
16939
|
+
heads.single = item.prevSameQuoteIdx;
|
|
16940
|
+
} else {
|
|
16941
|
+
heads.double = item.prevSameQuoteIdx;
|
|
16942
|
+
}
|
|
16943
|
+
}
|
|
16944
|
+
}
|
|
16921
16945
|
|
|
16922
16946
|
function addReplacement (replacements, tokenIdx, pos, ch) {
|
|
16923
16947
|
if (!replacements[tokenIdx]) {
|
|
@@ -16947,6 +16971,8 @@ function process_inlines (tokens, state) {
|
|
|
16947
16971
|
let j;
|
|
16948
16972
|
|
|
16949
16973
|
const stack = [];
|
|
16974
|
+
// stack indexes of topmost openers of each type (-1 if none)
|
|
16975
|
+
const heads = { single: -1, double: -1 };
|
|
16950
16976
|
// token index -> list of replacements in the original token content
|
|
16951
16977
|
const replacements = {};
|
|
16952
16978
|
|
|
@@ -16958,7 +16984,7 @@ function process_inlines (tokens, state) {
|
|
|
16958
16984
|
for (j = stack.length - 1; j >= 0; j--) {
|
|
16959
16985
|
if (stack[j].level <= thisLevel) { break }
|
|
16960
16986
|
}
|
|
16961
|
-
stack
|
|
16987
|
+
truncateStack(stack, heads, j + 1);
|
|
16962
16988
|
|
|
16963
16989
|
if (token.type !== 'text') { continue }
|
|
16964
16990
|
|
|
@@ -17062,39 +17088,45 @@ function process_inlines (tokens, state) {
|
|
|
17062
17088
|
}
|
|
17063
17089
|
|
|
17064
17090
|
if (canClose) {
|
|
17065
|
-
//
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
|
-
|
|
17077
|
-
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
}
|
|
17091
|
+
// Stack levels never decrease, so an opener of this type below
|
|
17092
|
+
// the current level means there is no match
|
|
17093
|
+
j = isSingle ? heads.single : heads.double;
|
|
17094
|
+
if (j >= 0 && stack[j].level === thisLevel) {
|
|
17095
|
+
const item = stack[j];
|
|
17096
|
+
|
|
17097
|
+
let openQuote;
|
|
17098
|
+
let closeQuote;
|
|
17099
|
+
if (isSingle) {
|
|
17100
|
+
openQuote = state.md.options.quotes[2];
|
|
17101
|
+
closeQuote = state.md.options.quotes[3];
|
|
17102
|
+
} else {
|
|
17103
|
+
openQuote = state.md.options.quotes[0];
|
|
17104
|
+
closeQuote = state.md.options.quotes[1];
|
|
17105
|
+
}
|
|
17081
17106
|
|
|
17082
|
-
|
|
17083
|
-
|
|
17107
|
+
addReplacement(replacements, i, t.index, closeQuote);
|
|
17108
|
+
addReplacement(replacements, item.tokenIdx, item.contentPos, openQuote);
|
|
17084
17109
|
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
}
|
|
17110
|
+
truncateStack(stack, heads, j);
|
|
17111
|
+
continue OUTER
|
|
17088
17112
|
}
|
|
17089
17113
|
}
|
|
17090
17114
|
|
|
17091
17115
|
if (canOpen) {
|
|
17116
|
+
if (stack.length >= MAX_OPENERS) { return }
|
|
17092
17117
|
stack.push({
|
|
17093
|
-
|
|
17094
|
-
|
|
17095
|
-
|
|
17096
|
-
level: thisLevel
|
|
17118
|
+
tokenIdx: i,
|
|
17119
|
+
contentPos: t.index,
|
|
17120
|
+
isSingleQuote: isSingle,
|
|
17121
|
+
level: thisLevel,
|
|
17122
|
+
// stack index of the previous opener of the same quote type, -1 if none
|
|
17123
|
+
prevSameQuoteIdx: isSingle ? heads.single : heads.double
|
|
17097
17124
|
});
|
|
17125
|
+
if (isSingle) {
|
|
17126
|
+
heads.single = stack.length - 1;
|
|
17127
|
+
} else {
|
|
17128
|
+
heads.double = stack.length - 1;
|
|
17129
|
+
}
|
|
17098
17130
|
} else if (canClose && isSingle) {
|
|
17099
17131
|
addReplacement(replacements, i, t.index, APOSTROPHE);
|
|
17100
17132
|
}
|
|
@@ -17173,15 +17205,15 @@ function text_join (state) {
|
|
|
17173
17205
|
|
|
17174
17206
|
|
|
17175
17207
|
const _rules$2 = [
|
|
17176
|
-
['normalize',
|
|
17177
|
-
['block',
|
|
17178
|
-
['inline',
|
|
17179
|
-
['linkify',
|
|
17180
|
-
['replacements',
|
|
17181
|
-
['smartquotes',
|
|
17208
|
+
['normalize', normalize$1],
|
|
17209
|
+
['block', block],
|
|
17210
|
+
['inline', inline],
|
|
17211
|
+
['linkify', linkify$1],
|
|
17212
|
+
['replacements', replace],
|
|
17213
|
+
['smartquotes', smartquotes],
|
|
17182
17214
|
// `text_join` finds `text_special` tokens (for escape sequences)
|
|
17183
17215
|
// and joins them with the rest of the text
|
|
17184
|
-
['text_join',
|
|
17216
|
+
['text_join', text_join]
|
|
17185
17217
|
];
|
|
17186
17218
|
|
|
17187
17219
|
/**
|
|
@@ -17222,7 +17254,7 @@ function StateBlock (src, md, env, tokens) {
|
|
|
17222
17254
|
this.src = src;
|
|
17223
17255
|
|
|
17224
17256
|
// link to parser instance
|
|
17225
|
-
this.md
|
|
17257
|
+
this.md = md;
|
|
17226
17258
|
|
|
17227
17259
|
this.env = env;
|
|
17228
17260
|
|
|
@@ -17253,11 +17285,11 @@ function StateBlock (src, md, env, tokens) {
|
|
|
17253
17285
|
|
|
17254
17286
|
// required block content indent (for example, if we are
|
|
17255
17287
|
// inside a list, it would be positioned after list marker)
|
|
17256
|
-
this.blkIndent
|
|
17257
|
-
this.line
|
|
17258
|
-
this.lineMax
|
|
17259
|
-
this.tight
|
|
17260
|
-
this.ddIndent
|
|
17288
|
+
this.blkIndent = 0;
|
|
17289
|
+
this.line = 0; // line index in src
|
|
17290
|
+
this.lineMax = 0; // lines count
|
|
17291
|
+
this.tight = false; // loose/tight mode for lists
|
|
17292
|
+
this.ddIndent = -1; // indent of the current dd block (-1 if there isn't any)
|
|
17261
17293
|
this.listIndent = -1; // indent of the current list block (-1 if there isn't any)
|
|
17262
17294
|
|
|
17263
17295
|
// can be 'blockquote', 'list', 'root', 'paragraph' or 'reference'
|
|
@@ -17584,11 +17616,11 @@ function table (state, startLine, endLine, silent) {
|
|
|
17584
17616
|
for (let i = 0; i < columns.length; i++) {
|
|
17585
17617
|
const token_ho = state.push('th_open', 'th', 1);
|
|
17586
17618
|
if (aligns[i]) {
|
|
17587
|
-
token_ho.attrs
|
|
17619
|
+
token_ho.attrs = [['style', 'text-align:' + aligns[i]]];
|
|
17588
17620
|
}
|
|
17589
17621
|
|
|
17590
17622
|
const token_il = state.push('inline', '', 0);
|
|
17591
|
-
token_il.content
|
|
17623
|
+
token_il.content = columns[i].trim();
|
|
17592
17624
|
token_il.children = [];
|
|
17593
17625
|
|
|
17594
17626
|
state.push('th_close', 'th', -1);
|
|
@@ -17635,11 +17667,11 @@ function table (state, startLine, endLine, silent) {
|
|
|
17635
17667
|
for (let i = 0; i < columnCount; i++) {
|
|
17636
17668
|
const token_tdo = state.push('td_open', 'td', 1);
|
|
17637
17669
|
if (aligns[i]) {
|
|
17638
|
-
token_tdo.attrs
|
|
17670
|
+
token_tdo.attrs = [['style', 'text-align:' + aligns[i]]];
|
|
17639
17671
|
}
|
|
17640
17672
|
|
|
17641
17673
|
const token_il = state.push('inline', '', 0);
|
|
17642
|
-
token_il.content
|
|
17674
|
+
token_il.content = columns[i] ? columns[i].trim() : '';
|
|
17643
17675
|
token_il.children = [];
|
|
17644
17676
|
|
|
17645
17677
|
state.push('td_close', 'td', -1);
|
|
@@ -17684,9 +17716,9 @@ function code$1 (state, startLine, endLine/*, silent */) {
|
|
|
17684
17716
|
|
|
17685
17717
|
state.line = last;
|
|
17686
17718
|
|
|
17687
|
-
const token
|
|
17719
|
+
const token = state.push('code_block', 'code', 0);
|
|
17688
17720
|
token.content = state.getLines(startLine, last, 4 + state.blkIndent, false) + '\n';
|
|
17689
|
-
token.map
|
|
17721
|
+
token.map = [startLine, state.line];
|
|
17690
17722
|
|
|
17691
17723
|
return true
|
|
17692
17724
|
}
|
|
@@ -17777,11 +17809,11 @@ function fence (state, startLine, endLine, silent) {
|
|
|
17777
17809
|
|
|
17778
17810
|
state.line = nextLine + (haveEndMarker ? 1 : 0);
|
|
17779
17811
|
|
|
17780
|
-
const token
|
|
17781
|
-
token.info
|
|
17812
|
+
const token = state.push('fence', 'code', 0);
|
|
17813
|
+
token.info = params;
|
|
17782
17814
|
token.content = state.getLines(startLine + 1, nextLine, len, true);
|
|
17783
|
-
token.markup
|
|
17784
|
-
token.map
|
|
17815
|
+
token.markup = markup;
|
|
17816
|
+
token.map = [startLine, state.line];
|
|
17785
17817
|
|
|
17786
17818
|
return true
|
|
17787
17819
|
}
|
|
@@ -17805,10 +17837,10 @@ function blockquote (state, startLine, endLine, silent) {
|
|
|
17805
17837
|
// so no point trying to find the end of it in silent mode
|
|
17806
17838
|
if (silent) { return true }
|
|
17807
17839
|
|
|
17808
|
-
const oldBMarks
|
|
17840
|
+
const oldBMarks = [];
|
|
17809
17841
|
const oldBSCount = [];
|
|
17810
|
-
const oldSCount
|
|
17811
|
-
const oldTShift
|
|
17842
|
+
const oldSCount = [];
|
|
17843
|
+
const oldTShift = [];
|
|
17812
17844
|
|
|
17813
17845
|
const terminatorRules = state.md.block.ruler.getRules('blockquote');
|
|
17814
17846
|
|
|
@@ -17968,14 +18000,14 @@ function blockquote (state, startLine, endLine, silent) {
|
|
|
17968
18000
|
const oldIndent = state.blkIndent;
|
|
17969
18001
|
state.blkIndent = 0;
|
|
17970
18002
|
|
|
17971
|
-
const token_o
|
|
18003
|
+
const token_o = state.push('blockquote_open', 'blockquote', 1);
|
|
17972
18004
|
token_o.markup = '>';
|
|
17973
18005
|
const lines = [startLine, 0];
|
|
17974
|
-
token_o.map
|
|
18006
|
+
token_o.map = lines;
|
|
17975
18007
|
|
|
17976
18008
|
state.md.block.tokenize(state, startLine, nextLine);
|
|
17977
18009
|
|
|
17978
|
-
const token_c
|
|
18010
|
+
const token_c = state.push('blockquote_close', 'blockquote', -1);
|
|
17979
18011
|
token_c.markup = '>';
|
|
17980
18012
|
|
|
17981
18013
|
state.lineMax = oldLineMax;
|
|
@@ -18028,8 +18060,8 @@ function hr (state, startLine, endLine, silent) {
|
|
|
18028
18060
|
|
|
18029
18061
|
state.line = startLine + 1;
|
|
18030
18062
|
|
|
18031
|
-
const token
|
|
18032
|
-
token.map
|
|
18063
|
+
const token = state.push('hr', 'hr', 0);
|
|
18064
|
+
token.map = [startLine, state.line];
|
|
18033
18065
|
token.markup = Array(cnt + 1).join(String.fromCharCode(marker));
|
|
18034
18066
|
|
|
18035
18067
|
return true
|
|
@@ -18192,16 +18224,16 @@ function list (state, startLine, endLine, silent) {
|
|
|
18192
18224
|
const listTokIdx = state.tokens.length;
|
|
18193
18225
|
|
|
18194
18226
|
if (isOrdered) {
|
|
18195
|
-
token
|
|
18227
|
+
token = state.push('ordered_list_open', 'ol', 1);
|
|
18196
18228
|
if (markerValue !== 1) {
|
|
18197
18229
|
token.attrs = [['start', markerValue]];
|
|
18198
18230
|
}
|
|
18199
18231
|
} else {
|
|
18200
|
-
token
|
|
18232
|
+
token = state.push('bullet_list_open', 'ul', 1);
|
|
18201
18233
|
}
|
|
18202
18234
|
|
|
18203
18235
|
const listLines = [nextLine, 0];
|
|
18204
|
-
token.map
|
|
18236
|
+
token.map = listLines;
|
|
18205
18237
|
token.markup = String.fromCharCode(markerCharCode);
|
|
18206
18238
|
|
|
18207
18239
|
//
|
|
@@ -18254,10 +18286,10 @@ function list (state, startLine, endLine, silent) {
|
|
|
18254
18286
|
const indent = initial + indentAfterMarker;
|
|
18255
18287
|
|
|
18256
18288
|
// Run subparser & write tokens
|
|
18257
|
-
token
|
|
18289
|
+
token = state.push('list_item_open', 'li', 1);
|
|
18258
18290
|
token.markup = String.fromCharCode(markerCharCode);
|
|
18259
18291
|
const itemLines = [nextLine, 0];
|
|
18260
|
-
token.map
|
|
18292
|
+
token.map = itemLines;
|
|
18261
18293
|
if (isOrdered) {
|
|
18262
18294
|
token.info = state.src.slice(start, posAfterMarker - 1);
|
|
18263
18295
|
}
|
|
@@ -18306,7 +18338,7 @@ function list (state, startLine, endLine, silent) {
|
|
|
18306
18338
|
state.sCount[nextLine] = oldSCount;
|
|
18307
18339
|
state.tight = oldTight;
|
|
18308
18340
|
|
|
18309
|
-
token
|
|
18341
|
+
token = state.push('list_item_close', 'li', -1);
|
|
18310
18342
|
token.markup = String.fromCharCode(markerCharCode);
|
|
18311
18343
|
|
|
18312
18344
|
nextLine = state.line;
|
|
@@ -18643,23 +18675,23 @@ var block_names = [
|
|
|
18643
18675
|
|
|
18644
18676
|
// Regexps to match html elements
|
|
18645
18677
|
|
|
18646
|
-
const attr_name
|
|
18678
|
+
const attr_name = '[a-zA-Z_:][a-zA-Z0-9:._-]*';
|
|
18647
18679
|
|
|
18648
|
-
const unquoted
|
|
18680
|
+
const unquoted = '[^"\'=<>`\\x00-\\x20]+';
|
|
18649
18681
|
const single_quoted = "'[^']*'";
|
|
18650
18682
|
const double_quoted = '"[^"]*"';
|
|
18651
18683
|
|
|
18652
|
-
const attr_value
|
|
18684
|
+
const attr_value = '(?:' + unquoted + '|' + single_quoted + '|' + double_quoted + ')';
|
|
18653
18685
|
|
|
18654
|
-
const attribute
|
|
18686
|
+
const attribute = '(?:\\s+' + attr_name + '(?:\\s*=\\s*' + attr_value + ')?)';
|
|
18655
18687
|
|
|
18656
|
-
const open_tag
|
|
18688
|
+
const open_tag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>';
|
|
18657
18689
|
|
|
18658
|
-
const close_tag
|
|
18659
|
-
const comment
|
|
18660
|
-
const processing
|
|
18690
|
+
const close_tag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>';
|
|
18691
|
+
const comment = '<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->';
|
|
18692
|
+
const processing = '<[?][\\s\\S]*?[?]>';
|
|
18661
18693
|
const declaration = '<![A-Za-z][^>]*>';
|
|
18662
|
-
const cdata
|
|
18694
|
+
const cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>';
|
|
18663
18695
|
|
|
18664
18696
|
const HTML_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag + '|' + comment +
|
|
18665
18697
|
'|' + processing + '|' + declaration + '|' + cdata + ')');
|
|
@@ -18673,12 +18705,12 @@ const HTML_OPEN_CLOSE_TAG_RE = new RegExp('^(?:' + open_tag + '|' + close_tag +
|
|
|
18673
18705
|
//
|
|
18674
18706
|
const HTML_SEQUENCES = [
|
|
18675
18707
|
[/^<(script|pre|style|textarea)(?=(\s|>|$))/i, /<\/(script|pre|style|textarea)>/i, true],
|
|
18676
|
-
[/^<!--/,
|
|
18677
|
-
[/^<\?/,
|
|
18678
|
-
[/^<![A-
|
|
18708
|
+
[/^<!--/, /-->/, true],
|
|
18709
|
+
[/^<\?/, /\?>/, true],
|
|
18710
|
+
[/^<![A-Za-z]/, />/, true],
|
|
18679
18711
|
[/^<!\[CDATA\[/, /\]\]>/, true],
|
|
18680
18712
|
[new RegExp('^</?(' + block_names.join('|') + ')(?=(\\s|/?>|$))', 'i'), /^$/, true],
|
|
18681
|
-
[new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'),
|
|
18713
|
+
[new RegExp(HTML_OPEN_CLOSE_TAG_RE.source + '\\s*$'), /^$/, false]
|
|
18682
18714
|
];
|
|
18683
18715
|
|
|
18684
18716
|
function html_block (state, startLine, endLine, silent) {
|
|
@@ -18737,8 +18769,8 @@ function html_block (state, startLine, endLine, silent) {
|
|
|
18737
18769
|
|
|
18738
18770
|
state.line = nextLine;
|
|
18739
18771
|
|
|
18740
|
-
const token
|
|
18741
|
-
token.map
|
|
18772
|
+
const token = state.push('html_block', '', 0);
|
|
18773
|
+
token.map = [startLine, nextLine];
|
|
18742
18774
|
token.content = state.getLines(startLine, nextLine, state.blkIndent, true);
|
|
18743
18775
|
|
|
18744
18776
|
return true
|
|
@@ -18754,7 +18786,7 @@ function heading (state, startLine, endLine, silent) {
|
|
|
18754
18786
|
// if it's indented more than 3 spaces, it should be a code block
|
|
18755
18787
|
if (state.sCount[startLine] - state.blkIndent >= 4) { return false }
|
|
18756
18788
|
|
|
18757
|
-
let ch
|
|
18789
|
+
let ch = state.src.charCodeAt(pos);
|
|
18758
18790
|
|
|
18759
18791
|
if (ch !== 0x23/* # */ || pos >= max) { return false }
|
|
18760
18792
|
|
|
@@ -18780,16 +18812,16 @@ function heading (state, startLine, endLine, silent) {
|
|
|
18780
18812
|
|
|
18781
18813
|
state.line = startLine + 1;
|
|
18782
18814
|
|
|
18783
|
-
const token_o
|
|
18815
|
+
const token_o = state.push('heading_open', 'h' + String(level), 1);
|
|
18784
18816
|
token_o.markup = '########'.slice(0, level);
|
|
18785
|
-
token_o.map
|
|
18817
|
+
token_o.map = [startLine, state.line];
|
|
18786
18818
|
|
|
18787
|
-
const token_i
|
|
18788
|
-
token_i.content
|
|
18789
|
-
token_i.map
|
|
18819
|
+
const token_i = state.push('inline', '', 0);
|
|
18820
|
+
token_i.content = asciiTrim(state.src.slice(pos, max));
|
|
18821
|
+
token_i.map = [startLine, state.line];
|
|
18790
18822
|
token_i.children = [];
|
|
18791
18823
|
|
|
18792
|
-
const token_c
|
|
18824
|
+
const token_c = state.push('heading_close', 'h' + String(level), -1);
|
|
18793
18825
|
token_c.markup = '########'.slice(0, level);
|
|
18794
18826
|
|
|
18795
18827
|
return true
|
|
@@ -18863,17 +18895,17 @@ function lheading (state, startLine, endLine/*, silent */) {
|
|
|
18863
18895
|
|
|
18864
18896
|
state.line = nextLine + 1;
|
|
18865
18897
|
|
|
18866
|
-
const token_o
|
|
18867
|
-
token_o.markup
|
|
18868
|
-
token_o.map
|
|
18898
|
+
const token_o = state.push('heading_open', 'h' + String(level), 1);
|
|
18899
|
+
token_o.markup = String.fromCharCode(marker);
|
|
18900
|
+
token_o.map = [startLine, state.line];
|
|
18869
18901
|
|
|
18870
|
-
const token_i
|
|
18871
|
-
token_i.content
|
|
18872
|
-
token_i.map
|
|
18902
|
+
const token_i = state.push('inline', '', 0);
|
|
18903
|
+
token_i.content = content;
|
|
18904
|
+
token_i.map = [startLine, state.line - 1];
|
|
18873
18905
|
token_i.children = [];
|
|
18874
18906
|
|
|
18875
|
-
const token_c
|
|
18876
|
-
token_c.markup
|
|
18907
|
+
const token_c = state.push('heading_close', 'h' + String(level), -1);
|
|
18908
|
+
token_c.markup = String.fromCharCode(marker);
|
|
18877
18909
|
|
|
18878
18910
|
state.parentType = oldParentType;
|
|
18879
18911
|
|
|
@@ -18913,12 +18945,12 @@ function paragraph (state, startLine, endLine) {
|
|
|
18913
18945
|
|
|
18914
18946
|
state.line = nextLine;
|
|
18915
18947
|
|
|
18916
|
-
const token_o
|
|
18917
|
-
token_o.map
|
|
18948
|
+
const token_o = state.push('paragraph_open', 'p', 1);
|
|
18949
|
+
token_o.map = [startLine, state.line];
|
|
18918
18950
|
|
|
18919
|
-
const token_i
|
|
18920
|
-
token_i.content
|
|
18921
|
-
token_i.map
|
|
18951
|
+
const token_i = state.push('inline', '', 0);
|
|
18952
|
+
token_i.content = content;
|
|
18953
|
+
token_i.map = [startLine, state.line];
|
|
18922
18954
|
token_i.children = [];
|
|
18923
18955
|
|
|
18924
18956
|
state.push('paragraph_close', 'p', -1);
|
|
@@ -18938,17 +18970,17 @@ function paragraph (state, startLine, endLine) {
|
|
|
18938
18970
|
const _rules$1 = [
|
|
18939
18971
|
// First 2 params - rule name & source. Secondary array - list of rules,
|
|
18940
18972
|
// which can be terminated by this one.
|
|
18941
|
-
['table',
|
|
18942
|
-
['code',
|
|
18943
|
-
['fence',
|
|
18973
|
+
['table', table, ['paragraph', 'reference']],
|
|
18974
|
+
['code', code$1],
|
|
18975
|
+
['fence', fence, ['paragraph', 'reference', 'blockquote', 'list']],
|
|
18944
18976
|
['blockquote', blockquote, ['paragraph', 'reference', 'blockquote', 'list']],
|
|
18945
|
-
['hr',
|
|
18946
|
-
['list',
|
|
18947
|
-
['reference',
|
|
18977
|
+
['hr', hr, ['paragraph', 'reference', 'blockquote', 'list']],
|
|
18978
|
+
['list', list, ['paragraph', 'reference', 'blockquote']],
|
|
18979
|
+
['reference', reference],
|
|
18948
18980
|
['html_block', html_block, ['paragraph', 'reference', 'blockquote']],
|
|
18949
|
-
['heading',
|
|
18950
|
-
['lheading',
|
|
18951
|
-
['paragraph',
|
|
18981
|
+
['heading', heading, ['paragraph', 'reference', 'blockquote']],
|
|
18982
|
+
['lheading', lheading],
|
|
18983
|
+
['paragraph', paragraph]
|
|
18952
18984
|
];
|
|
18953
18985
|
|
|
18954
18986
|
/**
|
|
@@ -19189,8 +19221,8 @@ StateInline.prototype.scanDelims = function (start, canSplitWord) {
|
|
|
19189
19221
|
const right_flanking =
|
|
19190
19222
|
!isLastWhiteSpace && (!isLastPunctChar || isNextWhiteSpace || isNextPunctChar);
|
|
19191
19223
|
|
|
19192
|
-
const can_open
|
|
19193
|
-
const can_close = right_flanking && (canSplitWord || !left_flanking
|
|
19224
|
+
const can_open = left_flanking && (canSplitWord || !right_flanking || isLastPunctChar);
|
|
19225
|
+
const can_close = right_flanking && (canSplitWord || !left_flanking || isNextPunctChar);
|
|
19194
19226
|
|
|
19195
19227
|
return { can_open, can_close, length: count }
|
|
19196
19228
|
};
|
|
@@ -19285,10 +19317,20 @@ module.exports = function text(state, silent) {
|
|
|
19285
19317
|
return true;
|
|
19286
19318
|
}; */
|
|
19287
19319
|
|
|
19288
|
-
//
|
|
19320
|
+
// Early process links like https://example.org/ to have priority
|
|
19321
|
+
// over emphasis, etc.
|
|
19289
19322
|
|
|
19290
19323
|
// RFC3986: scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
|
|
19291
|
-
|
|
19324
|
+
function isAsciiAlpha (code) {
|
|
19325
|
+
return (code >= 0x41 && code <= 0x5A) || (code >= 0x61 && code <= 0x7A)
|
|
19326
|
+
}
|
|
19327
|
+
|
|
19328
|
+
function isSchemeChar (code) {
|
|
19329
|
+
return (code >= 0x41 && code <= 0x5A) ||
|
|
19330
|
+
(code >= 0x61 && code <= 0x7A) ||
|
|
19331
|
+
(code >= 0x30 && code <= 0x39) ||
|
|
19332
|
+
code === 0x2B || code === 0x2D || code === 0x2E
|
|
19333
|
+
}
|
|
19292
19334
|
|
|
19293
19335
|
function linkify (state, silent) {
|
|
19294
19336
|
if (!state.md.options.linkify) return false
|
|
@@ -19302,19 +19344,27 @@ function linkify (state, silent) {
|
|
|
19302
19344
|
if (state.src.charCodeAt(pos + 1) !== 0x2F/* / */) return false
|
|
19303
19345
|
if (state.src.charCodeAt(pos + 2) !== 0x2F/* / */) return false
|
|
19304
19346
|
|
|
19305
|
-
|
|
19306
|
-
|
|
19347
|
+
// Search backwards for the scheme, but no more than 10 characters, the length
|
|
19348
|
+
// of the pending string, or the length of the source prefix.
|
|
19349
|
+
// Use state.src instead of state.pending because it is faster to access.
|
|
19350
|
+
const protoMin = pos - Math.min(10, state.pending.length, pos);
|
|
19351
|
+
let protoStart = pos;
|
|
19352
|
+
while (protoStart > protoMin && isSchemeChar(state.src.charCodeAt(protoStart - 1))) {
|
|
19353
|
+
protoStart--;
|
|
19354
|
+
}
|
|
19307
19355
|
|
|
19308
|
-
|
|
19356
|
+
if (protoStart === pos || !isAsciiAlpha(state.src.charCodeAt(protoStart))) return false
|
|
19309
19357
|
|
|
19310
|
-
const
|
|
19358
|
+
const protoLength = pos - protoStart;
|
|
19359
|
+
|
|
19360
|
+
const link = state.md.linkify.matchAtStart(state.src.slice(protoStart));
|
|
19311
19361
|
if (!link) return false
|
|
19312
19362
|
|
|
19313
19363
|
let url = link.url;
|
|
19314
19364
|
|
|
19315
19365
|
// invalid link, but still detected by linkify somehow;
|
|
19316
19366
|
// need to check to prevent infinite loop below
|
|
19317
|
-
if (url.length <=
|
|
19367
|
+
if (url.length <= protoLength) return false
|
|
19318
19368
|
|
|
19319
19369
|
// disallow '*' at the end of the link (conflicts with emphasis)
|
|
19320
19370
|
// do manual backsearch to avoid perf issues with regex /\*+$/ on "****...****a".
|
|
@@ -19330,7 +19380,7 @@ function linkify (state, silent) {
|
|
|
19330
19380
|
if (!state.md.validateLink(fullUrl)) return false
|
|
19331
19381
|
|
|
19332
19382
|
if (!silent) {
|
|
19333
|
-
state.pending = state.pending.slice(0, -
|
|
19383
|
+
state.pending = state.pending.slice(0, -protoLength);
|
|
19334
19384
|
|
|
19335
19385
|
const token_o = state.push('link_open', 'a', 1);
|
|
19336
19386
|
token_o.attrs = [['href', fullUrl]];
|
|
@@ -19345,7 +19395,7 @@ function linkify (state, silent) {
|
|
|
19345
19395
|
token_c.info = 'auto';
|
|
19346
19396
|
}
|
|
19347
19397
|
|
|
19348
|
-
state.pos += url.length -
|
|
19398
|
+
state.pos += url.length - protoLength;
|
|
19349
19399
|
return true
|
|
19350
19400
|
}
|
|
19351
19401
|
|
|
@@ -19430,6 +19480,20 @@ function escape (state, silent) {
|
|
|
19430
19480
|
return true
|
|
19431
19481
|
}
|
|
19432
19482
|
|
|
19483
|
+
// '\' before a space is a literal backslash. Don't consume the space, so a
|
|
19484
|
+
// trailing two-space hard line break is still detected by the newline rule.
|
|
19485
|
+
if (ch1 === 0x20) {
|
|
19486
|
+
if (!silent) {
|
|
19487
|
+
const token = state.push('text_special', '', 0);
|
|
19488
|
+
token.content = '\\';
|
|
19489
|
+
token.markup = '\\';
|
|
19490
|
+
token.info = 'escape';
|
|
19491
|
+
}
|
|
19492
|
+
|
|
19493
|
+
state.pos = pos;
|
|
19494
|
+
return true
|
|
19495
|
+
}
|
|
19496
|
+
|
|
19433
19497
|
let escapedStr = state.src[pos];
|
|
19434
19498
|
|
|
19435
19499
|
if (ch1 >= 0xD800 && ch1 <= 0xDBFF && pos + 1 < max) {
|
|
@@ -19453,7 +19517,7 @@ function escape (state, silent) {
|
|
|
19453
19517
|
}
|
|
19454
19518
|
|
|
19455
19519
|
token.markup = origStr;
|
|
19456
|
-
token.info
|
|
19520
|
+
token.info = 'escape';
|
|
19457
19521
|
}
|
|
19458
19522
|
|
|
19459
19523
|
state.pos = pos + 1;
|
|
@@ -19543,13 +19607,13 @@ function strikethrough_tokenize (state, silent) {
|
|
|
19543
19607
|
let token;
|
|
19544
19608
|
|
|
19545
19609
|
if (len % 2) {
|
|
19546
|
-
token
|
|
19610
|
+
token = state.push('text', '', 0);
|
|
19547
19611
|
token.content = ch;
|
|
19548
19612
|
len--;
|
|
19549
19613
|
}
|
|
19550
19614
|
|
|
19551
19615
|
for (let i = 0; i < len; i += 2) {
|
|
19552
|
-
token
|
|
19616
|
+
token = state.push('text', '', 0);
|
|
19553
19617
|
token.content = ch + ch;
|
|
19554
19618
|
|
|
19555
19619
|
state.delimiters.push({
|
|
@@ -19585,18 +19649,18 @@ function postProcess$1 (state, delimiters) {
|
|
|
19585
19649
|
|
|
19586
19650
|
const endDelim = delimiters[startDelim.end];
|
|
19587
19651
|
|
|
19588
|
-
token
|
|
19589
|
-
token.type
|
|
19590
|
-
token.tag
|
|
19652
|
+
token = state.tokens[startDelim.token];
|
|
19653
|
+
token.type = 's_open';
|
|
19654
|
+
token.tag = 's';
|
|
19591
19655
|
token.nesting = 1;
|
|
19592
|
-
token.markup
|
|
19656
|
+
token.markup = '~~';
|
|
19593
19657
|
token.content = '';
|
|
19594
19658
|
|
|
19595
|
-
token
|
|
19596
|
-
token.type
|
|
19597
|
-
token.tag
|
|
19659
|
+
token = state.tokens[endDelim.token];
|
|
19660
|
+
token.type = 's_close';
|
|
19661
|
+
token.tag = 's';
|
|
19598
19662
|
token.nesting = -1;
|
|
19599
|
-
token.markup
|
|
19663
|
+
token.markup = '~~';
|
|
19600
19664
|
token.content = '';
|
|
19601
19665
|
|
|
19602
19666
|
if (state.tokens[endDelim.token - 1].type === 'text' &&
|
|
@@ -19731,18 +19795,18 @@ function postProcess (state, delimiters) {
|
|
|
19731
19795
|
|
|
19732
19796
|
const ch = String.fromCharCode(startDelim.marker);
|
|
19733
19797
|
|
|
19734
|
-
const token_o
|
|
19735
|
-
token_o.type
|
|
19736
|
-
token_o.tag
|
|
19798
|
+
const token_o = state.tokens[startDelim.token];
|
|
19799
|
+
token_o.type = isStrong ? 'strong_open' : 'em_open';
|
|
19800
|
+
token_o.tag = isStrong ? 'strong' : 'em';
|
|
19737
19801
|
token_o.nesting = 1;
|
|
19738
|
-
token_o.markup
|
|
19802
|
+
token_o.markup = isStrong ? ch + ch : ch;
|
|
19739
19803
|
token_o.content = '';
|
|
19740
19804
|
|
|
19741
|
-
const token_c
|
|
19742
|
-
token_c.type
|
|
19743
|
-
token_c.tag
|
|
19805
|
+
const token_c = state.tokens[endDelim.token];
|
|
19806
|
+
token_c.type = isStrong ? 'strong_close' : 'em_close';
|
|
19807
|
+
token_c.tag = isStrong ? 'strong' : 'em';
|
|
19744
19808
|
token_c.nesting = -1;
|
|
19745
|
-
token_c.markup
|
|
19809
|
+
token_c.markup = isStrong ? ch + ch : ch;
|
|
19746
19810
|
token_c.content = '';
|
|
19747
19811
|
|
|
19748
19812
|
if (isStrong) {
|
|
@@ -19895,7 +19959,7 @@ function link (state, silent) {
|
|
|
19895
19959
|
|
|
19896
19960
|
const token_o = state.push('link_open', 'a', 1);
|
|
19897
19961
|
const attrs = [['href', href]];
|
|
19898
|
-
token_o.attrs
|
|
19962
|
+
token_o.attrs = attrs;
|
|
19899
19963
|
if (title) {
|
|
19900
19964
|
attrs.push(['title', title]);
|
|
19901
19965
|
}
|
|
@@ -20053,7 +20117,7 @@ function image (state, silent) {
|
|
|
20053
20117
|
// Process autolinks '<protocol:...>'
|
|
20054
20118
|
|
|
20055
20119
|
/* eslint max-len:0 */
|
|
20056
|
-
const EMAIL_RE
|
|
20120
|
+
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])?)*)$/;
|
|
20057
20121
|
/* eslint-disable-next-line no-control-regex */
|
|
20058
20122
|
const AUTOLINK_RE = /^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;
|
|
20059
20123
|
|
|
@@ -20081,17 +20145,17 @@ function autolink (state, silent) {
|
|
|
20081
20145
|
if (!state.md.validateLink(fullUrl)) { return false }
|
|
20082
20146
|
|
|
20083
20147
|
if (!silent) {
|
|
20084
|
-
const token_o
|
|
20085
|
-
token_o.attrs
|
|
20086
|
-
token_o.markup
|
|
20087
|
-
token_o.info
|
|
20148
|
+
const token_o = state.push('link_open', 'a', 1);
|
|
20149
|
+
token_o.attrs = [['href', fullUrl]];
|
|
20150
|
+
token_o.markup = 'autolink';
|
|
20151
|
+
token_o.info = 'auto';
|
|
20088
20152
|
|
|
20089
|
-
const token_t
|
|
20153
|
+
const token_t = state.push('text', '', 0);
|
|
20090
20154
|
token_t.content = state.md.normalizeLinkText(url);
|
|
20091
20155
|
|
|
20092
|
-
const token_c
|
|
20093
|
-
token_c.markup
|
|
20094
|
-
token_c.info
|
|
20156
|
+
const token_c = state.push('link_close', 'a', -1);
|
|
20157
|
+
token_c.markup = 'autolink';
|
|
20158
|
+
token_c.info = 'auto';
|
|
20095
20159
|
}
|
|
20096
20160
|
|
|
20097
20161
|
state.pos += url.length + 2;
|
|
@@ -20103,17 +20167,17 @@ function autolink (state, silent) {
|
|
|
20103
20167
|
if (!state.md.validateLink(fullUrl)) { return false }
|
|
20104
20168
|
|
|
20105
20169
|
if (!silent) {
|
|
20106
|
-
const token_o
|
|
20107
|
-
token_o.attrs
|
|
20108
|
-
token_o.markup
|
|
20109
|
-
token_o.info
|
|
20170
|
+
const token_o = state.push('link_open', 'a', 1);
|
|
20171
|
+
token_o.attrs = [['href', fullUrl]];
|
|
20172
|
+
token_o.markup = 'autolink';
|
|
20173
|
+
token_o.info = 'auto';
|
|
20110
20174
|
|
|
20111
|
-
const token_t
|
|
20175
|
+
const token_t = state.push('text', '', 0);
|
|
20112
20176
|
token_t.content = state.md.normalizeLinkText(url);
|
|
20113
20177
|
|
|
20114
|
-
const token_c
|
|
20115
|
-
token_c.markup
|
|
20116
|
-
token_c.info
|
|
20178
|
+
const token_c = state.push('link_close', 'a', -1);
|
|
20179
|
+
token_c.markup = 'autolink';
|
|
20180
|
+
token_c.info = 'auto';
|
|
20117
20181
|
}
|
|
20118
20182
|
|
|
20119
20183
|
state.pos += url.length + 2;
|
|
@@ -20166,7 +20230,7 @@ function html_inline (state, silent) {
|
|
|
20166
20230
|
const token = state.push('html_inline', '', 0);
|
|
20167
20231
|
token.content = match[0];
|
|
20168
20232
|
|
|
20169
|
-
if (isLinkOpen(token.content))
|
|
20233
|
+
if (isLinkOpen(token.content)) state.linkLevel++;
|
|
20170
20234
|
if (isLinkClose(token.content)) state.linkLevel--;
|
|
20171
20235
|
}
|
|
20172
20236
|
state.pos += match[0].length;
|
|
@@ -20177,7 +20241,7 @@ function html_inline (state, silent) {
|
|
|
20177
20241
|
|
|
20178
20242
|
|
|
20179
20243
|
const DIGITAL_RE = /^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i;
|
|
20180
|
-
const NAMED_RE
|
|
20244
|
+
const NAMED_RE = /^&([a-z][a-z0-9]{1,31});/i;
|
|
20181
20245
|
|
|
20182
20246
|
function entity (state, silent) {
|
|
20183
20247
|
const pos = state.pos;
|
|
@@ -20195,10 +20259,10 @@ function entity (state, silent) {
|
|
|
20195
20259
|
if (!silent) {
|
|
20196
20260
|
const code = match[1][0].toLowerCase() === 'x' ? parseInt(match[1].slice(1), 16) : parseInt(match[1], 10);
|
|
20197
20261
|
|
|
20198
|
-
const token
|
|
20262
|
+
const token = state.push('text_special', '', 0);
|
|
20199
20263
|
token.content = isValidEntityCode(code) ? fromCodePoint(code) : fromCodePoint(0xFFFD);
|
|
20200
|
-
token.markup
|
|
20201
|
-
token.info
|
|
20264
|
+
token.markup = match[0];
|
|
20265
|
+
token.info = 'entity';
|
|
20202
20266
|
}
|
|
20203
20267
|
state.pos += match[0].length;
|
|
20204
20268
|
return true
|
|
@@ -20209,10 +20273,10 @@ function entity (state, silent) {
|
|
|
20209
20273
|
const decoded = index.decodeHTMLStrict(match[0]);
|
|
20210
20274
|
if (decoded !== match[0]) {
|
|
20211
20275
|
if (!silent) {
|
|
20212
|
-
const token
|
|
20276
|
+
const token = state.push('text_special', '', 0);
|
|
20213
20277
|
token.content = decoded;
|
|
20214
|
-
token.markup
|
|
20215
|
-
token.info
|
|
20278
|
+
token.markup = match[0];
|
|
20279
|
+
token.info = 'entity';
|
|
20216
20280
|
}
|
|
20217
20281
|
state.pos += match[0].length;
|
|
20218
20282
|
return true
|
|
@@ -20310,8 +20374,8 @@ function processDelimiters (delimiters) {
|
|
|
20310
20374
|
jumps[closerIdx] = closerIdx - openerIdx + lastJump;
|
|
20311
20375
|
jumps[openerIdx] = lastJump;
|
|
20312
20376
|
|
|
20313
|
-
closer.open
|
|
20314
|
-
opener.end
|
|
20377
|
+
closer.open = false;
|
|
20378
|
+
opener.end = closerIdx;
|
|
20315
20379
|
opener.close = false;
|
|
20316
20380
|
newMinOpenerIdx = -1;
|
|
20317
20381
|
// treat next token as start of run,
|
|
@@ -20397,18 +20461,18 @@ function fragments_join (state) {
|
|
|
20397
20461
|
// Parser rules
|
|
20398
20462
|
|
|
20399
20463
|
const _rules = [
|
|
20400
|
-
['text',
|
|
20401
|
-
['linkify',
|
|
20402
|
-
['newline',
|
|
20403
|
-
['escape',
|
|
20404
|
-
['backticks',
|
|
20405
|
-
['strikethrough',
|
|
20406
|
-
['emphasis',
|
|
20407
|
-
['link',
|
|
20408
|
-
['image',
|
|
20409
|
-
['autolink',
|
|
20410
|
-
['html_inline',
|
|
20411
|
-
['entity',
|
|
20464
|
+
['text', text],
|
|
20465
|
+
['linkify', linkify],
|
|
20466
|
+
['newline', newline],
|
|
20467
|
+
['escape', escape],
|
|
20468
|
+
['backticks', backtick],
|
|
20469
|
+
['strikethrough', r_strikethrough.tokenize],
|
|
20470
|
+
['emphasis', r_emphasis.tokenize],
|
|
20471
|
+
['link', link],
|
|
20472
|
+
['image', image],
|
|
20473
|
+
['autolink', autolink],
|
|
20474
|
+
['html_inline', html_inline],
|
|
20475
|
+
['entity', entity]
|
|
20412
20476
|
];
|
|
20413
20477
|
|
|
20414
20478
|
// `rule2` ruleset was created specifically for emphasis/strikethrough
|
|
@@ -20417,12 +20481,12 @@ const _rules = [
|
|
|
20417
20481
|
// Don't use this for anything except pairs (plugins working with `balance_pairs`).
|
|
20418
20482
|
//
|
|
20419
20483
|
const _rules2 = [
|
|
20420
|
-
['balance_pairs',
|
|
20421
|
-
['strikethrough',
|
|
20422
|
-
['emphasis',
|
|
20484
|
+
['balance_pairs', link_pairs],
|
|
20485
|
+
['strikethrough', r_strikethrough.postProcess],
|
|
20486
|
+
['emphasis', r_emphasis.postProcess],
|
|
20423
20487
|
// rules for pairs separate '**' into its own text tokens, which may be left unused,
|
|
20424
20488
|
// rule below merges unused segments back with the rest of the text
|
|
20425
|
-
['fragments_join',
|
|
20489
|
+
['fragments_join', fragments_join]
|
|
20426
20490
|
];
|
|
20427
20491
|
|
|
20428
20492
|
/**
|
|
@@ -22625,7 +22689,7 @@ const schema$1 = new Schema({
|
|
|
22625
22689
|
toDOM() { return ["div", ["hr"]]; }
|
|
22626
22690
|
},
|
|
22627
22691
|
heading: {
|
|
22628
|
-
attrs: { level: { default: 1 } },
|
|
22692
|
+
attrs: { level: { default: 1, validate: "number" } },
|
|
22629
22693
|
content: "(text | image)*",
|
|
22630
22694
|
group: "block",
|
|
22631
22695
|
defining: true,
|
|
@@ -22635,7 +22699,7 @@ const schema$1 = new Schema({
|
|
|
22635
22699
|
{ tag: "h4", attrs: { level: 4 } },
|
|
22636
22700
|
{ tag: "h5", attrs: { level: 5 } },
|
|
22637
22701
|
{ tag: "h6", attrs: { level: 6 } }],
|
|
22638
|
-
toDOM(node) { return ["h" + node.attrs.level, 0]; }
|
|
22702
|
+
toDOM(node) { return ["h" + +node.attrs.level, 0]; }
|
|
22639
22703
|
},
|
|
22640
22704
|
code_block: {
|
|
22641
22705
|
content: "text*",
|
|
@@ -23626,7 +23690,7 @@ const nodes = {
|
|
|
23626
23690
|
{ tag: "h4", attrs: { level: 4 } },
|
|
23627
23691
|
{ tag: "h5", attrs: { level: 5 } },
|
|
23628
23692
|
{ tag: "h6", attrs: { level: 6 } }],
|
|
23629
|
-
toDOM(node) { return ["h" + node.attrs.level, 0]; }
|
|
23693
|
+
toDOM(node) { return ["h" + +node.attrs.level, 0]; }
|
|
23630
23694
|
},
|
|
23631
23695
|
/**
|
|
23632
23696
|
A code listing. Disallows marks or non-text inline
|