@saasquatch/vanilla-components 1.4.2-1 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{WidgetHost-7c65e2c5.js → WidgetHost-71b013eb.js} +2 -2
- package/dist/cjs/sqh-close-button.cjs.entry.js +1 -1
- package/dist/cjs/sqh-copy-button_12.cjs.entry.js +1537 -1287
- package/dist/cjs/sqh-referral-code.cjs.entry.js +1 -1
- package/dist/collection/components/text-component/text-component.js +4 -4
- package/dist/collection/services/WidgetHost.js +2 -2
- package/dist/collection/utilities.js +12 -1
- package/dist/esm/{WidgetHost-b09e0d27.js → WidgetHost-9c337319.js} +2 -2
- package/dist/esm/sqh-close-button.entry.js +1 -1
- package/dist/esm/sqh-copy-button_12.entry.js +1537 -1287
- package/dist/esm/sqh-referral-code.entry.js +1 -1
- package/dist/esm-es5/{WidgetHost-b09e0d27.js → WidgetHost-9c337319.js} +2 -2
- package/dist/esm-es5/sqh-close-button.entry.js +1 -1
- package/dist/esm-es5/sqh-copy-button_12.entry.js +1401 -828
- package/dist/esm-es5/sqh-referral-code.entry.js +1 -1
- package/dist/types/utilities.d.ts +10 -1
- package/dist/widget-components/{p-c1c81a3b.entry.js → p-366f1663.entry.js} +1 -1
- package/dist/widget-components/{p-d6bde96f.entry.js → p-54ea7a00.entry.js} +1 -1
- package/dist/widget-components/p-5829fc57.system.entry.js +8 -0
- package/dist/widget-components/p-58be1132.system.js +1 -1
- package/dist/widget-components/{p-37fd6e72.system.js → p-8e232564.system.js} +1 -1
- package/dist/widget-components/{p-1a19f961.system.entry.js → p-b17efca4.system.entry.js} +1 -1
- package/dist/widget-components/p-b9ae08a2.entry.js +149 -0
- package/dist/widget-components/{p-e1d2fd8f.system.entry.js → p-c8bc8c77.system.entry.js} +1 -1
- package/dist/widget-components/{p-5f2ae286.js → p-edd43dbc.js} +2 -2
- package/dist/widget-components/widget-components.esm.js +1 -1
- package/package.json +20 -29
- package/dist/widget-components/p-2e323fe9.system.entry.js +0 -8
- package/dist/widget-components/p-7c848114.entry.js +0 -149
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-deb40352.js');
|
|
6
6
|
const _commonjsHelpers = require('./_commonjsHelpers-ac2d0785.js');
|
|
7
|
-
const WidgetHost = require('./WidgetHost-
|
|
7
|
+
const WidgetHost = require('./WidgetHost-71b013eb.js');
|
|
8
8
|
|
|
9
9
|
/////////////////////////////////////
|
|
10
10
|
////// ////
|
|
@@ -86,6 +86,17 @@ const uuid = function b(a = undefined) {
|
|
|
86
86
|
? (a ^ ((Math.random() * 16) >> (a / 4))).toString(16)
|
|
87
87
|
: ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, b);
|
|
88
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Decides whether a background value should be treated as an image URL
|
|
91
|
+
* (as opposed to a CSS color). The check is anchored to the start of the
|
|
92
|
+
* value and runs in linear time: an unanchored pattern would rescan the
|
|
93
|
+
* remaining suffix at every word boundary, freezing the widget on long
|
|
94
|
+
* non-URL values (e.g. "a.".repeat(32000) + "!") since it runs
|
|
95
|
+
* synchronously in render(). Embedded URLs are intentionally unsupported.
|
|
96
|
+
*/
|
|
97
|
+
const isUrl = (value) => {
|
|
98
|
+
return /^(?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|(?:\/\/)?(?:www\d{0,3}\.|[a-z0-9-]+(?:\.[a-z0-9-]+)*\.[a-z]{2,4}\/))/i.test(value.trim());
|
|
99
|
+
};
|
|
89
100
|
|
|
90
101
|
/*
|
|
91
102
|
|
|
@@ -7524,7 +7535,7 @@ function lexer(str) {
|
|
|
7524
7535
|
break;
|
|
7525
7536
|
}
|
|
7526
7537
|
if (!name)
|
|
7527
|
-
throw new TypeError("Missing parameter name at "
|
|
7538
|
+
throw new TypeError("Missing parameter name at ".concat(i));
|
|
7528
7539
|
tokens.push({ type: "NAME", index: i, value: name });
|
|
7529
7540
|
i = j;
|
|
7530
7541
|
continue;
|
|
@@ -7534,7 +7545,7 @@ function lexer(str) {
|
|
|
7534
7545
|
var pattern = "";
|
|
7535
7546
|
var j = i + 1;
|
|
7536
7547
|
if (str[j] === "?") {
|
|
7537
|
-
throw new TypeError("Pattern cannot start with \"?\" at "
|
|
7548
|
+
throw new TypeError("Pattern cannot start with \"?\" at ".concat(j));
|
|
7538
7549
|
}
|
|
7539
7550
|
while (j < str.length) {
|
|
7540
7551
|
if (str[j] === "\\") {
|
|
@@ -7551,15 +7562,15 @@ function lexer(str) {
|
|
|
7551
7562
|
else if (str[j] === "(") {
|
|
7552
7563
|
count++;
|
|
7553
7564
|
if (str[j + 1] !== "?") {
|
|
7554
|
-
throw new TypeError("Capturing groups are not allowed at "
|
|
7565
|
+
throw new TypeError("Capturing groups are not allowed at ".concat(j));
|
|
7555
7566
|
}
|
|
7556
7567
|
}
|
|
7557
7568
|
pattern += str[j++];
|
|
7558
7569
|
}
|
|
7559
7570
|
if (count)
|
|
7560
|
-
throw new TypeError("Unbalanced pattern at "
|
|
7571
|
+
throw new TypeError("Unbalanced pattern at ".concat(i));
|
|
7561
7572
|
if (!pattern)
|
|
7562
|
-
throw new TypeError("Missing pattern at "
|
|
7573
|
+
throw new TypeError("Missing pattern at ".concat(i));
|
|
7563
7574
|
tokens.push({ type: "PATTERN", index: i, value: pattern });
|
|
7564
7575
|
i = j;
|
|
7565
7576
|
continue;
|
|
@@ -7575,8 +7586,7 @@ function lexer(str) {
|
|
|
7575
7586
|
function parse$1(str, options) {
|
|
7576
7587
|
if (options === void 0) { options = {}; }
|
|
7577
7588
|
var tokens = lexer(str);
|
|
7578
|
-
var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a;
|
|
7579
|
-
var defaultPattern = "[^" + escapeString(options.delimiter || "/#?") + "]+?";
|
|
7589
|
+
var _a = options.prefixes, prefixes = _a === void 0 ? "./" : _a, _b = options.delimiter, delimiter = _b === void 0 ? "/#?" : _b;
|
|
7580
7590
|
var result = [];
|
|
7581
7591
|
var key = 0;
|
|
7582
7592
|
var i = 0;
|
|
@@ -7590,17 +7600,34 @@ function parse$1(str, options) {
|
|
|
7590
7600
|
if (value !== undefined)
|
|
7591
7601
|
return value;
|
|
7592
7602
|
var _a = tokens[i], nextType = _a.type, index = _a.index;
|
|
7593
|
-
throw new TypeError("Unexpected "
|
|
7603
|
+
throw new TypeError("Unexpected ".concat(nextType, " at ").concat(index, ", expected ").concat(type));
|
|
7594
7604
|
};
|
|
7595
7605
|
var consumeText = function () {
|
|
7596
7606
|
var result = "";
|
|
7597
7607
|
var value;
|
|
7598
|
-
// tslint:disable-next-line
|
|
7599
7608
|
while ((value = tryConsume("CHAR") || tryConsume("ESCAPED_CHAR"))) {
|
|
7600
7609
|
result += value;
|
|
7601
7610
|
}
|
|
7602
7611
|
return result;
|
|
7603
7612
|
};
|
|
7613
|
+
var isSafe = function (value) {
|
|
7614
|
+
for (var _i = 0, delimiter_1 = delimiter; _i < delimiter_1.length; _i++) {
|
|
7615
|
+
var char = delimiter_1[_i];
|
|
7616
|
+
if (value.indexOf(char) > -1)
|
|
7617
|
+
return true;
|
|
7618
|
+
}
|
|
7619
|
+
return false;
|
|
7620
|
+
};
|
|
7621
|
+
var safePattern = function (prefix) {
|
|
7622
|
+
var prev = result[result.length - 1];
|
|
7623
|
+
var prevText = prefix || (prev && typeof prev === "string" ? prev : "");
|
|
7624
|
+
if (prev && !prevText) {
|
|
7625
|
+
throw new TypeError("Must have text between two parameters, missing text after \"".concat(prev.name, "\""));
|
|
7626
|
+
}
|
|
7627
|
+
if (!prevText || isSafe(prevText))
|
|
7628
|
+
return "[^".concat(escapeString(delimiter), "]+?");
|
|
7629
|
+
return "(?:(?!".concat(escapeString(prevText), ")[^").concat(escapeString(delimiter), "])+?");
|
|
7630
|
+
};
|
|
7604
7631
|
while (i < tokens.length) {
|
|
7605
7632
|
var char = tryConsume("CHAR");
|
|
7606
7633
|
var name = tryConsume("NAME");
|
|
@@ -7619,8 +7646,8 @@ function parse$1(str, options) {
|
|
|
7619
7646
|
name: name || key++,
|
|
7620
7647
|
prefix: prefix,
|
|
7621
7648
|
suffix: "",
|
|
7622
|
-
pattern: pattern ||
|
|
7623
|
-
modifier: tryConsume("MODIFIER") || ""
|
|
7649
|
+
pattern: pattern || safePattern(prefix),
|
|
7650
|
+
modifier: tryConsume("MODIFIER") || "",
|
|
7624
7651
|
});
|
|
7625
7652
|
continue;
|
|
7626
7653
|
}
|
|
@@ -7642,10 +7669,10 @@ function parse$1(str, options) {
|
|
|
7642
7669
|
mustConsume("CLOSE");
|
|
7643
7670
|
result.push({
|
|
7644
7671
|
name: name_1 || (pattern_1 ? key++ : ""),
|
|
7645
|
-
pattern: name_1 && !pattern_1 ?
|
|
7672
|
+
pattern: name_1 && !pattern_1 ? safePattern(prefix) : pattern_1,
|
|
7646
7673
|
prefix: prefix,
|
|
7647
7674
|
suffix: suffix,
|
|
7648
|
-
modifier: tryConsume("MODIFIER") || ""
|
|
7675
|
+
modifier: tryConsume("MODIFIER") || "",
|
|
7649
7676
|
});
|
|
7650
7677
|
continue;
|
|
7651
7678
|
}
|
|
@@ -7671,18 +7698,19 @@ function flags(options) {
|
|
|
7671
7698
|
function regexpToRegexp(path, keys) {
|
|
7672
7699
|
if (!keys)
|
|
7673
7700
|
return path;
|
|
7674
|
-
|
|
7675
|
-
var
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
}
|
|
7701
|
+
var groupsRegex = /\((?:\?<(.*?)>)?(?!\?)/g;
|
|
7702
|
+
var index = 0;
|
|
7703
|
+
var execResult = groupsRegex.exec(path.source);
|
|
7704
|
+
while (execResult) {
|
|
7705
|
+
keys.push({
|
|
7706
|
+
// Use parenthesized substring match if available, index otherwise
|
|
7707
|
+
name: execResult[1] || index++,
|
|
7708
|
+
prefix: "",
|
|
7709
|
+
suffix: "",
|
|
7710
|
+
modifier: "",
|
|
7711
|
+
pattern: "",
|
|
7712
|
+
});
|
|
7713
|
+
execResult = groupsRegex.exec(path.source);
|
|
7686
7714
|
}
|
|
7687
7715
|
return path;
|
|
7688
7716
|
}
|
|
@@ -7691,7 +7719,7 @@ function regexpToRegexp(path, keys) {
|
|
|
7691
7719
|
*/
|
|
7692
7720
|
function arrayToRegexp(paths, keys, options) {
|
|
7693
7721
|
var parts = paths.map(function (path) { return pathToRegexp(path, keys, options).source; });
|
|
7694
|
-
return new RegExp("(?:"
|
|
7722
|
+
return new RegExp("(?:".concat(parts.join("|"), ")"), flags(options));
|
|
7695
7723
|
}
|
|
7696
7724
|
/**
|
|
7697
7725
|
* Create a path regexp from string input.
|
|
@@ -7704,9 +7732,9 @@ function stringToRegexp(path, keys, options) {
|
|
|
7704
7732
|
*/
|
|
7705
7733
|
function tokensToRegexp(tokens, keys, options) {
|
|
7706
7734
|
if (options === void 0) { options = {}; }
|
|
7707
|
-
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d;
|
|
7708
|
-
var
|
|
7709
|
-
var
|
|
7735
|
+
var _a = options.strict, strict = _a === void 0 ? false : _a, _b = options.start, start = _b === void 0 ? true : _b, _c = options.end, end = _c === void 0 ? true : _c, _d = options.encode, encode = _d === void 0 ? function (x) { return x; } : _d, _e = options.delimiter, delimiter = _e === void 0 ? "/#?" : _e, _f = options.endsWith, endsWith = _f === void 0 ? "" : _f;
|
|
7736
|
+
var endsWithRe = "[".concat(escapeString(endsWith), "]|$");
|
|
7737
|
+
var delimiterRe = "[".concat(escapeString(delimiter), "]");
|
|
7710
7738
|
var route = start ? "^" : "";
|
|
7711
7739
|
// Iterate over the tokens and create our regexp string.
|
|
7712
7740
|
for (var _i = 0, tokens_1 = tokens; _i < tokens_1.length; _i++) {
|
|
@@ -7723,37 +7751,39 @@ function tokensToRegexp(tokens, keys, options) {
|
|
|
7723
7751
|
if (prefix || suffix) {
|
|
7724
7752
|
if (token.modifier === "+" || token.modifier === "*") {
|
|
7725
7753
|
var mod = token.modifier === "*" ? "?" : "";
|
|
7726
|
-
route += "(?:"
|
|
7754
|
+
route += "(?:".concat(prefix, "((?:").concat(token.pattern, ")(?:").concat(suffix).concat(prefix, "(?:").concat(token.pattern, "))*)").concat(suffix, ")").concat(mod);
|
|
7727
7755
|
}
|
|
7728
7756
|
else {
|
|
7729
|
-
route += "(?:"
|
|
7757
|
+
route += "(?:".concat(prefix, "(").concat(token.pattern, ")").concat(suffix, ")").concat(token.modifier);
|
|
7730
7758
|
}
|
|
7731
7759
|
}
|
|
7732
7760
|
else {
|
|
7733
|
-
|
|
7761
|
+
if (token.modifier === "+" || token.modifier === "*") {
|
|
7762
|
+
throw new TypeError("Can not repeat \"".concat(token.name, "\" without a prefix and suffix"));
|
|
7763
|
+
}
|
|
7764
|
+
route += "(".concat(token.pattern, ")").concat(token.modifier);
|
|
7734
7765
|
}
|
|
7735
7766
|
}
|
|
7736
7767
|
else {
|
|
7737
|
-
route += "(?:"
|
|
7768
|
+
route += "(?:".concat(prefix).concat(suffix, ")").concat(token.modifier);
|
|
7738
7769
|
}
|
|
7739
7770
|
}
|
|
7740
7771
|
}
|
|
7741
7772
|
if (end) {
|
|
7742
7773
|
if (!strict)
|
|
7743
|
-
route +=
|
|
7744
|
-
route += !options.endsWith ? "$" : "(?="
|
|
7774
|
+
route += "".concat(delimiterRe, "?");
|
|
7775
|
+
route += !options.endsWith ? "$" : "(?=".concat(endsWithRe, ")");
|
|
7745
7776
|
}
|
|
7746
7777
|
else {
|
|
7747
7778
|
var endToken = tokens[tokens.length - 1];
|
|
7748
7779
|
var isEndDelimited = typeof endToken === "string"
|
|
7749
|
-
?
|
|
7750
|
-
:
|
|
7751
|
-
endToken === undefined;
|
|
7780
|
+
? delimiterRe.indexOf(endToken[endToken.length - 1]) > -1
|
|
7781
|
+
: endToken === undefined;
|
|
7752
7782
|
if (!strict) {
|
|
7753
|
-
route += "(?:"
|
|
7783
|
+
route += "(?:".concat(delimiterRe, "(?=").concat(endsWithRe, "))?");
|
|
7754
7784
|
}
|
|
7755
7785
|
if (!isEndDelimited) {
|
|
7756
|
-
route += "(?="
|
|
7786
|
+
route += "(?=".concat(delimiterRe, "|").concat(endsWithRe, ")");
|
|
7757
7787
|
}
|
|
7758
7788
|
}
|
|
7759
7789
|
return new RegExp(route, flags(options));
|
|
@@ -7879,10 +7909,10 @@ const StatsContainer = class {
|
|
|
7879
7909
|
};
|
|
7880
7910
|
StatsContainer.style = statsContainerCss;
|
|
7881
7911
|
|
|
7882
|
-
var
|
|
7912
|
+
var marked_umd = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
7883
7913
|
/**
|
|
7884
|
-
* marked - a markdown parser
|
|
7885
|
-
* Copyright (c) 2011-
|
|
7914
|
+
* marked v4.3.0 - a markdown parser
|
|
7915
|
+
* Copyright (c) 2011-2023, Christopher Jeffrey. (MIT Licensed)
|
|
7886
7916
|
* https://github.com/markedjs/marked
|
|
7887
7917
|
*/
|
|
7888
7918
|
|
|
@@ -7892,24 +7922,39 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
7892
7922
|
*/
|
|
7893
7923
|
|
|
7894
7924
|
(function (global, factory) {
|
|
7895
|
-
|
|
7896
|
-
}(_commonjsHelpers.commonjsGlobal, (function () {
|
|
7925
|
+
factory(exports) ;
|
|
7926
|
+
})(_commonjsHelpers.commonjsGlobal, (function (exports) {
|
|
7897
7927
|
function _defineProperties(target, props) {
|
|
7898
7928
|
for (var i = 0; i < props.length; i++) {
|
|
7899
7929
|
var descriptor = props[i];
|
|
7900
7930
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
7901
7931
|
descriptor.configurable = true;
|
|
7902
7932
|
if ("value" in descriptor) descriptor.writable = true;
|
|
7903
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
7933
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
7904
7934
|
}
|
|
7905
7935
|
}
|
|
7906
|
-
|
|
7907
7936
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
7908
7937
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
7909
7938
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
7939
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
7940
|
+
writable: false
|
|
7941
|
+
});
|
|
7910
7942
|
return Constructor;
|
|
7911
7943
|
}
|
|
7912
|
-
|
|
7944
|
+
function _extends() {
|
|
7945
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
7946
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
7947
|
+
var source = arguments[i];
|
|
7948
|
+
for (var key in source) {
|
|
7949
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7950
|
+
target[key] = source[key];
|
|
7951
|
+
}
|
|
7952
|
+
}
|
|
7953
|
+
}
|
|
7954
|
+
return target;
|
|
7955
|
+
};
|
|
7956
|
+
return _extends.apply(this, arguments);
|
|
7957
|
+
}
|
|
7913
7958
|
function _unsupportedIterableToArray(o, minLen) {
|
|
7914
7959
|
if (!o) return;
|
|
7915
7960
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -7918,86 +7963,80 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
7918
7963
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
7919
7964
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
7920
7965
|
}
|
|
7921
|
-
|
|
7922
7966
|
function _arrayLikeToArray(arr, len) {
|
|
7923
7967
|
if (len == null || len > arr.length) len = arr.length;
|
|
7924
|
-
|
|
7925
7968
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
7926
|
-
|
|
7927
7969
|
return arr2;
|
|
7928
7970
|
}
|
|
7929
|
-
|
|
7930
7971
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
7931
|
-
var it;
|
|
7932
|
-
|
|
7933
|
-
if (
|
|
7934
|
-
if (
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
done: true
|
|
7940
|
-
};
|
|
7941
|
-
return {
|
|
7942
|
-
done: false,
|
|
7943
|
-
value: o[i++]
|
|
7944
|
-
};
|
|
7972
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
7973
|
+
if (it) return (it = it.call(o)).next.bind(it);
|
|
7974
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
7975
|
+
if (it) o = it;
|
|
7976
|
+
var i = 0;
|
|
7977
|
+
return function () {
|
|
7978
|
+
if (i >= o.length) return {
|
|
7979
|
+
done: true
|
|
7945
7980
|
};
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7981
|
+
return {
|
|
7982
|
+
done: false,
|
|
7983
|
+
value: o[i++]
|
|
7984
|
+
};
|
|
7985
|
+
};
|
|
7949
7986
|
}
|
|
7950
|
-
|
|
7951
|
-
it = o[Symbol.iterator]();
|
|
7952
|
-
return it.next.bind(it);
|
|
7987
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
7953
7988
|
}
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7989
|
+
function _toPrimitive(input, hint) {
|
|
7990
|
+
if (typeof input !== "object" || input === null) return input;
|
|
7991
|
+
var prim = input[Symbol.toPrimitive];
|
|
7992
|
+
if (prim !== undefined) {
|
|
7993
|
+
var res = prim.call(input, hint || "default");
|
|
7994
|
+
if (typeof res !== "object") return res;
|
|
7995
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7996
|
+
}
|
|
7997
|
+
return (hint === "string" ? String : Number)(input);
|
|
7998
|
+
}
|
|
7999
|
+
function _toPropertyKey(arg) {
|
|
8000
|
+
var key = _toPrimitive(arg, "string");
|
|
8001
|
+
return typeof key === "symbol" ? key : String(key);
|
|
7957
8002
|
}
|
|
7958
8003
|
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
}
|
|
7982
|
-
|
|
7983
|
-
function changeDefaults(newDefaults) {
|
|
7984
|
-
module.exports.defaults = newDefaults;
|
|
7985
|
-
}
|
|
7986
|
-
|
|
7987
|
-
module.exports = {
|
|
7988
|
-
defaults: getDefaults(),
|
|
7989
|
-
getDefaults: getDefaults,
|
|
7990
|
-
changeDefaults: changeDefaults
|
|
8004
|
+
function getDefaults() {
|
|
8005
|
+
return {
|
|
8006
|
+
async: false,
|
|
8007
|
+
baseUrl: null,
|
|
8008
|
+
breaks: false,
|
|
8009
|
+
extensions: null,
|
|
8010
|
+
gfm: true,
|
|
8011
|
+
headerIds: true,
|
|
8012
|
+
headerPrefix: '',
|
|
8013
|
+
highlight: null,
|
|
8014
|
+
hooks: null,
|
|
8015
|
+
langPrefix: 'language-',
|
|
8016
|
+
mangle: true,
|
|
8017
|
+
pedantic: false,
|
|
8018
|
+
renderer: null,
|
|
8019
|
+
sanitize: false,
|
|
8020
|
+
sanitizer: null,
|
|
8021
|
+
silent: false,
|
|
8022
|
+
smartypants: false,
|
|
8023
|
+
tokenizer: null,
|
|
8024
|
+
walkTokens: null,
|
|
8025
|
+
xhtml: false
|
|
7991
8026
|
};
|
|
7992
|
-
}
|
|
8027
|
+
}
|
|
8028
|
+
exports.defaults = getDefaults();
|
|
8029
|
+
function changeDefaults(newDefaults) {
|
|
8030
|
+
exports.defaults = newDefaults;
|
|
8031
|
+
}
|
|
7993
8032
|
|
|
7994
8033
|
/**
|
|
7995
8034
|
* Helpers
|
|
7996
8035
|
*/
|
|
7997
8036
|
var escapeTest = /[&<>"']/;
|
|
7998
|
-
var escapeReplace =
|
|
7999
|
-
var escapeTestNoEncode = /[<>"']|&(
|
|
8000
|
-
var escapeReplaceNoEncode =
|
|
8037
|
+
var escapeReplace = new RegExp(escapeTest.source, 'g');
|
|
8038
|
+
var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
|
|
8039
|
+
var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
|
|
8001
8040
|
var escapeReplacements = {
|
|
8002
8041
|
'&': '&',
|
|
8003
8042
|
'<': '<',
|
|
@@ -8005,11 +8044,9 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8005
8044
|
'"': '"',
|
|
8006
8045
|
"'": '''
|
|
8007
8046
|
};
|
|
8008
|
-
|
|
8009
8047
|
var getEscapeReplacement = function getEscapeReplacement(ch) {
|
|
8010
8048
|
return escapeReplacements[ch];
|
|
8011
8049
|
};
|
|
8012
|
-
|
|
8013
8050
|
function escape(html, encode) {
|
|
8014
8051
|
if (encode) {
|
|
8015
8052
|
if (escapeTest.test(html)) {
|
|
@@ -8020,30 +8057,32 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8020
8057
|
return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
|
|
8021
8058
|
}
|
|
8022
8059
|
}
|
|
8023
|
-
|
|
8024
8060
|
return html;
|
|
8025
8061
|
}
|
|
8026
|
-
|
|
8027
8062
|
var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
|
8028
8063
|
|
|
8064
|
+
/**
|
|
8065
|
+
* @param {string} html
|
|
8066
|
+
*/
|
|
8029
8067
|
function unescape(html) {
|
|
8030
8068
|
// explicitly match decimal, hex, and named HTML entities
|
|
8031
8069
|
return html.replace(unescapeTest, function (_, n) {
|
|
8032
8070
|
n = n.toLowerCase();
|
|
8033
8071
|
if (n === 'colon') return ':';
|
|
8034
|
-
|
|
8035
8072
|
if (n.charAt(0) === '#') {
|
|
8036
8073
|
return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
|
|
8037
8074
|
}
|
|
8038
|
-
|
|
8039
8075
|
return '';
|
|
8040
8076
|
});
|
|
8041
8077
|
}
|
|
8042
|
-
|
|
8043
8078
|
var caret = /(^|[^\[])\^/g;
|
|
8044
8079
|
|
|
8080
|
+
/**
|
|
8081
|
+
* @param {string | RegExp} regex
|
|
8082
|
+
* @param {string} opt
|
|
8083
|
+
*/
|
|
8045
8084
|
function edit(regex, opt) {
|
|
8046
|
-
regex = regex
|
|
8085
|
+
regex = typeof regex === 'string' ? regex : regex.source;
|
|
8047
8086
|
opt = opt || '';
|
|
8048
8087
|
var obj = {
|
|
8049
8088
|
replace: function replace(name, val) {
|
|
@@ -8058,43 +8097,45 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8058
8097
|
};
|
|
8059
8098
|
return obj;
|
|
8060
8099
|
}
|
|
8061
|
-
|
|
8062
8100
|
var nonWordAndColonTest = /[^\w:]/g;
|
|
8063
8101
|
var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
|
|
8064
8102
|
|
|
8103
|
+
/**
|
|
8104
|
+
* @param {boolean} sanitize
|
|
8105
|
+
* @param {string} base
|
|
8106
|
+
* @param {string} href
|
|
8107
|
+
*/
|
|
8065
8108
|
function cleanUrl(sanitize, base, href) {
|
|
8066
8109
|
if (sanitize) {
|
|
8067
8110
|
var prot;
|
|
8068
|
-
|
|
8069
8111
|
try {
|
|
8070
8112
|
prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
|
|
8071
8113
|
} catch (e) {
|
|
8072
8114
|
return null;
|
|
8073
8115
|
}
|
|
8074
|
-
|
|
8075
8116
|
if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
|
|
8076
8117
|
return null;
|
|
8077
8118
|
}
|
|
8078
8119
|
}
|
|
8079
|
-
|
|
8080
8120
|
if (base && !originIndependentUrl.test(href)) {
|
|
8081
8121
|
href = resolveUrl(base, href);
|
|
8082
8122
|
}
|
|
8083
|
-
|
|
8084
8123
|
try {
|
|
8085
8124
|
href = encodeURI(href).replace(/%25/g, '%');
|
|
8086
8125
|
} catch (e) {
|
|
8087
8126
|
return null;
|
|
8088
8127
|
}
|
|
8089
|
-
|
|
8090
8128
|
return href;
|
|
8091
8129
|
}
|
|
8092
|
-
|
|
8093
8130
|
var baseUrls = {};
|
|
8094
8131
|
var justDomain = /^[^:]+:\/*[^/]*$/;
|
|
8095
8132
|
var protocol = /^([^:]+:)[\s\S]*$/;
|
|
8096
8133
|
var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
|
|
8097
8134
|
|
|
8135
|
+
/**
|
|
8136
|
+
* @param {string} base
|
|
8137
|
+
* @param {string} href
|
|
8138
|
+
*/
|
|
8098
8139
|
function resolveUrl(base, href) {
|
|
8099
8140
|
if (!baseUrls[' ' + base]) {
|
|
8100
8141
|
// we can ignore everything in base after the last slash of its path component,
|
|
@@ -8106,72 +8147,53 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8106
8147
|
baseUrls[' ' + base] = rtrim(base, '/', true);
|
|
8107
8148
|
}
|
|
8108
8149
|
}
|
|
8109
|
-
|
|
8110
8150
|
base = baseUrls[' ' + base];
|
|
8111
8151
|
var relativeBase = base.indexOf(':') === -1;
|
|
8112
|
-
|
|
8113
8152
|
if (href.substring(0, 2) === '//') {
|
|
8114
8153
|
if (relativeBase) {
|
|
8115
8154
|
return href;
|
|
8116
8155
|
}
|
|
8117
|
-
|
|
8118
8156
|
return base.replace(protocol, '$1') + href;
|
|
8119
8157
|
} else if (href.charAt(0) === '/') {
|
|
8120
8158
|
if (relativeBase) {
|
|
8121
8159
|
return href;
|
|
8122
8160
|
}
|
|
8123
|
-
|
|
8124
8161
|
return base.replace(domain, '$1') + href;
|
|
8125
8162
|
} else {
|
|
8126
8163
|
return base + href;
|
|
8127
8164
|
}
|
|
8128
8165
|
}
|
|
8129
|
-
|
|
8130
8166
|
var noopTest = {
|
|
8131
8167
|
exec: function noopTest() {}
|
|
8132
8168
|
};
|
|
8133
|
-
|
|
8134
|
-
function merge(obj) {
|
|
8135
|
-
var i = 1,
|
|
8136
|
-
target,
|
|
8137
|
-
key;
|
|
8138
|
-
|
|
8139
|
-
for (; i < arguments.length; i++) {
|
|
8140
|
-
target = arguments[i];
|
|
8141
|
-
|
|
8142
|
-
for (key in target) {
|
|
8143
|
-
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
|
8144
|
-
obj[key] = target[key];
|
|
8145
|
-
}
|
|
8146
|
-
}
|
|
8147
|
-
}
|
|
8148
|
-
|
|
8149
|
-
return obj;
|
|
8150
|
-
}
|
|
8151
|
-
|
|
8152
8169
|
function splitCells(tableRow, count) {
|
|
8153
8170
|
// ensure that every cell-delimiting pipe has a space
|
|
8154
8171
|
// before it to distinguish it from an escaped pipe
|
|
8155
8172
|
var row = tableRow.replace(/\|/g, function (match, offset, str) {
|
|
8156
|
-
|
|
8173
|
+
var escaped = false,
|
|
8157
8174
|
curr = offset;
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
}),
|
|
8172
|
-
cells = row.split(/ \|/);
|
|
8175
|
+
while (--curr >= 0 && str[curr] === '\\') {
|
|
8176
|
+
escaped = !escaped;
|
|
8177
|
+
}
|
|
8178
|
+
if (escaped) {
|
|
8179
|
+
// odd number of slashes means | is escaped
|
|
8180
|
+
// so we leave it alone
|
|
8181
|
+
return '|';
|
|
8182
|
+
} else {
|
|
8183
|
+
// add space before unescaped |
|
|
8184
|
+
return ' |';
|
|
8185
|
+
}
|
|
8186
|
+
}),
|
|
8187
|
+
cells = row.split(/ \|/);
|
|
8173
8188
|
var i = 0;
|
|
8174
8189
|
|
|
8190
|
+
// First/last cell in a row cannot be empty if it has no leading/trailing pipe
|
|
8191
|
+
if (!cells[0].trim()) {
|
|
8192
|
+
cells.shift();
|
|
8193
|
+
}
|
|
8194
|
+
if (cells.length > 0 && !cells[cells.length - 1].trim()) {
|
|
8195
|
+
cells.pop();
|
|
8196
|
+
}
|
|
8175
8197
|
if (cells.length > count) {
|
|
8176
8198
|
cells.splice(count);
|
|
8177
8199
|
} else {
|
|
@@ -8179,31 +8201,33 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8179
8201
|
cells.push('');
|
|
8180
8202
|
}
|
|
8181
8203
|
}
|
|
8182
|
-
|
|
8183
8204
|
for (; i < cells.length; i++) {
|
|
8184
8205
|
// leading or trailing whitespace is ignored per the gfm spec
|
|
8185
8206
|
cells[i] = cells[i].trim().replace(/\\\|/g, '|');
|
|
8186
8207
|
}
|
|
8187
|
-
|
|
8188
8208
|
return cells;
|
|
8189
|
-
}
|
|
8190
|
-
// /c*$/ is vulnerable to REDOS.
|
|
8191
|
-
// invert: Remove suffix of non-c chars instead. Default falsey.
|
|
8192
|
-
|
|
8209
|
+
}
|
|
8193
8210
|
|
|
8211
|
+
/**
|
|
8212
|
+
* Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
|
|
8213
|
+
* /c*$/ is vulnerable to REDOS.
|
|
8214
|
+
*
|
|
8215
|
+
* @param {string} str
|
|
8216
|
+
* @param {string} c
|
|
8217
|
+
* @param {boolean} invert Remove suffix of non-c chars instead. Default falsey.
|
|
8218
|
+
*/
|
|
8194
8219
|
function rtrim(str, c, invert) {
|
|
8195
8220
|
var l = str.length;
|
|
8196
|
-
|
|
8197
8221
|
if (l === 0) {
|
|
8198
8222
|
return '';
|
|
8199
|
-
}
|
|
8200
|
-
|
|
8223
|
+
}
|
|
8201
8224
|
|
|
8202
|
-
|
|
8225
|
+
// Length of suffix matching the invert condition.
|
|
8226
|
+
var suffLen = 0;
|
|
8203
8227
|
|
|
8228
|
+
// Step left until we fail to match the invert condition.
|
|
8204
8229
|
while (suffLen < l) {
|
|
8205
8230
|
var currChar = str.charAt(l - suffLen - 1);
|
|
8206
|
-
|
|
8207
8231
|
if (currChar === c && !invert) {
|
|
8208
8232
|
suffLen++;
|
|
8209
8233
|
} else if (currChar !== c && invert) {
|
|
@@ -8212,19 +8236,15 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8212
8236
|
break;
|
|
8213
8237
|
}
|
|
8214
8238
|
}
|
|
8215
|
-
|
|
8216
|
-
return str.substr(0, l - suffLen);
|
|
8239
|
+
return str.slice(0, l - suffLen);
|
|
8217
8240
|
}
|
|
8218
|
-
|
|
8219
8241
|
function findClosingBracket(str, b) {
|
|
8220
8242
|
if (str.indexOf(b[1]) === -1) {
|
|
8221
8243
|
return -1;
|
|
8222
8244
|
}
|
|
8223
|
-
|
|
8224
8245
|
var l = str.length;
|
|
8225
8246
|
var level = 0,
|
|
8226
|
-
|
|
8227
|
-
|
|
8247
|
+
i = 0;
|
|
8228
8248
|
for (; i < l; i++) {
|
|
8229
8249
|
if (str[i] === '\\') {
|
|
8230
8250
|
i++;
|
|
@@ -8232,212 +8252,151 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8232
8252
|
level++;
|
|
8233
8253
|
} else if (str[i] === b[1]) {
|
|
8234
8254
|
level--;
|
|
8235
|
-
|
|
8236
8255
|
if (level < 0) {
|
|
8237
8256
|
return i;
|
|
8238
8257
|
}
|
|
8239
8258
|
}
|
|
8240
8259
|
}
|
|
8241
|
-
|
|
8242
8260
|
return -1;
|
|
8243
8261
|
}
|
|
8244
|
-
|
|
8245
8262
|
function checkSanitizeDeprecation(opt) {
|
|
8246
8263
|
if (opt && opt.sanitize && !opt.silent) {
|
|
8247
8264
|
console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
|
|
8248
8265
|
}
|
|
8249
8266
|
}
|
|
8250
8267
|
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8268
|
+
// copied from https://stackoverflow.com/a/5450113/806777
|
|
8269
|
+
/**
|
|
8270
|
+
* @param {string} pattern
|
|
8271
|
+
* @param {number} count
|
|
8272
|
+
*/
|
|
8273
|
+
function repeatString(pattern, count) {
|
|
8274
|
+
if (count < 1) {
|
|
8275
|
+
return '';
|
|
8276
|
+
}
|
|
8277
|
+
var result = '';
|
|
8278
|
+
while (count > 1) {
|
|
8279
|
+
if (count & 1) {
|
|
8280
|
+
result += pattern;
|
|
8281
|
+
}
|
|
8282
|
+
count >>= 1;
|
|
8283
|
+
pattern += pattern;
|
|
8284
|
+
}
|
|
8285
|
+
return result + pattern;
|
|
8286
|
+
}
|
|
8270
8287
|
|
|
8271
|
-
function outputLink(cap, link, raw) {
|
|
8288
|
+
function outputLink(cap, link, raw, lexer) {
|
|
8272
8289
|
var href = link.href;
|
|
8273
|
-
var title = link.title ?
|
|
8290
|
+
var title = link.title ? escape(link.title) : null;
|
|
8274
8291
|
var text = cap[1].replace(/\\([\[\]])/g, '$1');
|
|
8275
|
-
|
|
8276
8292
|
if (cap[0].charAt(0) !== '!') {
|
|
8277
|
-
|
|
8293
|
+
lexer.state.inLink = true;
|
|
8294
|
+
var token = {
|
|
8278
8295
|
type: 'link',
|
|
8279
8296
|
raw: raw,
|
|
8280
8297
|
href: href,
|
|
8281
8298
|
title: title,
|
|
8282
|
-
text: text
|
|
8283
|
-
|
|
8284
|
-
} else {
|
|
8285
|
-
return {
|
|
8286
|
-
type: 'image',
|
|
8287
|
-
raw: raw,
|
|
8288
|
-
href: href,
|
|
8289
|
-
title: title,
|
|
8290
|
-
text: _escape(text)
|
|
8299
|
+
text: text,
|
|
8300
|
+
tokens: lexer.inlineTokens(text)
|
|
8291
8301
|
};
|
|
8302
|
+
lexer.state.inLink = false;
|
|
8303
|
+
return token;
|
|
8292
8304
|
}
|
|
8305
|
+
return {
|
|
8306
|
+
type: 'image',
|
|
8307
|
+
raw: raw,
|
|
8308
|
+
href: href,
|
|
8309
|
+
title: title,
|
|
8310
|
+
text: escape(text)
|
|
8311
|
+
};
|
|
8293
8312
|
}
|
|
8294
|
-
|
|
8295
8313
|
function indentCodeCompensation(raw, text) {
|
|
8296
8314
|
var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
|
|
8297
|
-
|
|
8298
8315
|
if (matchIndentToCode === null) {
|
|
8299
8316
|
return text;
|
|
8300
8317
|
}
|
|
8301
|
-
|
|
8302
8318
|
var indentToCode = matchIndentToCode[1];
|
|
8303
8319
|
return text.split('\n').map(function (node) {
|
|
8304
8320
|
var matchIndentInNode = node.match(/^\s+/);
|
|
8305
|
-
|
|
8306
8321
|
if (matchIndentInNode === null) {
|
|
8307
8322
|
return node;
|
|
8308
8323
|
}
|
|
8309
|
-
|
|
8310
8324
|
var indentInNode = matchIndentInNode[0];
|
|
8311
|
-
|
|
8312
8325
|
if (indentInNode.length >= indentToCode.length) {
|
|
8313
8326
|
return node.slice(indentToCode.length);
|
|
8314
8327
|
}
|
|
8315
|
-
|
|
8316
8328
|
return node;
|
|
8317
8329
|
}).join('\n');
|
|
8318
8330
|
}
|
|
8331
|
+
|
|
8319
8332
|
/**
|
|
8320
8333
|
* Tokenizer
|
|
8321
8334
|
*/
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
var Tokenizer_1 = /*#__PURE__*/function () {
|
|
8335
|
+
var Tokenizer = /*#__PURE__*/function () {
|
|
8325
8336
|
function Tokenizer(options) {
|
|
8326
|
-
this.options = options || defaults
|
|
8337
|
+
this.options = options || exports.defaults;
|
|
8327
8338
|
}
|
|
8328
|
-
|
|
8329
8339
|
var _proto = Tokenizer.prototype;
|
|
8330
|
-
|
|
8331
8340
|
_proto.space = function space(src) {
|
|
8332
8341
|
var cap = this.rules.block.newline.exec(src);
|
|
8333
|
-
|
|
8334
|
-
if (cap) {
|
|
8335
|
-
if (cap[0].length > 1) {
|
|
8336
|
-
return {
|
|
8337
|
-
type: 'space',
|
|
8338
|
-
raw: cap[0]
|
|
8339
|
-
};
|
|
8340
|
-
}
|
|
8341
|
-
|
|
8342
|
+
if (cap && cap[0].length > 0) {
|
|
8342
8343
|
return {
|
|
8343
|
-
|
|
8344
|
+
type: 'space',
|
|
8345
|
+
raw: cap[0]
|
|
8344
8346
|
};
|
|
8345
8347
|
}
|
|
8346
8348
|
};
|
|
8347
|
-
|
|
8348
|
-
_proto.code = function code(src, tokens) {
|
|
8349
|
+
_proto.code = function code(src) {
|
|
8349
8350
|
var cap = this.rules.block.code.exec(src);
|
|
8350
|
-
|
|
8351
8351
|
if (cap) {
|
|
8352
|
-
var
|
|
8353
|
-
|
|
8354
|
-
if (lastToken && lastToken.type === 'paragraph') {
|
|
8355
|
-
return {
|
|
8356
|
-
raw: cap[0],
|
|
8357
|
-
text: cap[0].trimRight()
|
|
8358
|
-
};
|
|
8359
|
-
}
|
|
8360
|
-
|
|
8361
|
-
var text = cap[0].replace(/^ {4}/gm, '');
|
|
8352
|
+
var text = cap[0].replace(/^ {1,4}/gm, '');
|
|
8362
8353
|
return {
|
|
8363
8354
|
type: 'code',
|
|
8364
8355
|
raw: cap[0],
|
|
8365
8356
|
codeBlockStyle: 'indented',
|
|
8366
|
-
text: !this.options.pedantic ? rtrim
|
|
8357
|
+
text: !this.options.pedantic ? rtrim(text, '\n') : text
|
|
8367
8358
|
};
|
|
8368
8359
|
}
|
|
8369
8360
|
};
|
|
8370
|
-
|
|
8371
8361
|
_proto.fences = function fences(src) {
|
|
8372
8362
|
var cap = this.rules.block.fences.exec(src);
|
|
8373
|
-
|
|
8374
8363
|
if (cap) {
|
|
8375
8364
|
var raw = cap[0];
|
|
8376
8365
|
var text = indentCodeCompensation(raw, cap[3] || '');
|
|
8377
8366
|
return {
|
|
8378
8367
|
type: 'code',
|
|
8379
8368
|
raw: raw,
|
|
8380
|
-
lang: cap[2] ? cap[2].trim() : cap[2],
|
|
8369
|
+
lang: cap[2] ? cap[2].trim().replace(this.rules.inline._escapes, '$1') : cap[2],
|
|
8381
8370
|
text: text
|
|
8382
8371
|
};
|
|
8383
8372
|
}
|
|
8384
8373
|
};
|
|
8385
|
-
|
|
8386
8374
|
_proto.heading = function heading(src) {
|
|
8387
8375
|
var cap = this.rules.block.heading.exec(src);
|
|
8388
|
-
|
|
8389
8376
|
if (cap) {
|
|
8377
|
+
var text = cap[2].trim();
|
|
8378
|
+
|
|
8379
|
+
// remove trailing #s
|
|
8380
|
+
if (/#$/.test(text)) {
|
|
8381
|
+
var trimmed = rtrim(text, '#');
|
|
8382
|
+
if (this.options.pedantic) {
|
|
8383
|
+
text = trimmed.trim();
|
|
8384
|
+
} else if (!trimmed || / $/.test(trimmed)) {
|
|
8385
|
+
// CommonMark requires space before trailing #s
|
|
8386
|
+
text = trimmed.trim();
|
|
8387
|
+
}
|
|
8388
|
+
}
|
|
8390
8389
|
return {
|
|
8391
8390
|
type: 'heading',
|
|
8392
8391
|
raw: cap[0],
|
|
8393
8392
|
depth: cap[1].length,
|
|
8394
|
-
text:
|
|
8395
|
-
|
|
8396
|
-
}
|
|
8397
|
-
};
|
|
8398
|
-
|
|
8399
|
-
_proto.nptable = function nptable(src) {
|
|
8400
|
-
var cap = this.rules.block.nptable.exec(src);
|
|
8401
|
-
|
|
8402
|
-
if (cap) {
|
|
8403
|
-
var item = {
|
|
8404
|
-
type: 'table',
|
|
8405
|
-
header: splitCells$1(cap[1].replace(/^ *| *\| *$/g, '')),
|
|
8406
|
-
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
|
8407
|
-
cells: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : [],
|
|
8408
|
-
raw: cap[0]
|
|
8393
|
+
text: text,
|
|
8394
|
+
tokens: this.lexer.inline(text)
|
|
8409
8395
|
};
|
|
8410
|
-
|
|
8411
|
-
if (item.header.length === item.align.length) {
|
|
8412
|
-
var l = item.align.length;
|
|
8413
|
-
var i;
|
|
8414
|
-
|
|
8415
|
-
for (i = 0; i < l; i++) {
|
|
8416
|
-
if (/^ *-+: *$/.test(item.align[i])) {
|
|
8417
|
-
item.align[i] = 'right';
|
|
8418
|
-
} else if (/^ *:-+: *$/.test(item.align[i])) {
|
|
8419
|
-
item.align[i] = 'center';
|
|
8420
|
-
} else if (/^ *:-+ *$/.test(item.align[i])) {
|
|
8421
|
-
item.align[i] = 'left';
|
|
8422
|
-
} else {
|
|
8423
|
-
item.align[i] = null;
|
|
8424
|
-
}
|
|
8425
|
-
}
|
|
8426
|
-
|
|
8427
|
-
l = item.cells.length;
|
|
8428
|
-
|
|
8429
|
-
for (i = 0; i < l; i++) {
|
|
8430
|
-
item.cells[i] = splitCells$1(item.cells[i], item.header.length);
|
|
8431
|
-
}
|
|
8432
|
-
|
|
8433
|
-
return item;
|
|
8434
|
-
}
|
|
8435
8396
|
}
|
|
8436
8397
|
};
|
|
8437
|
-
|
|
8438
8398
|
_proto.hr = function hr(src) {
|
|
8439
8399
|
var cap = this.rules.block.hr.exec(src);
|
|
8440
|
-
|
|
8441
8400
|
if (cap) {
|
|
8442
8401
|
return {
|
|
8443
8402
|
type: 'hr',
|
|
@@ -8445,155 +8404,254 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8445
8404
|
};
|
|
8446
8405
|
}
|
|
8447
8406
|
};
|
|
8448
|
-
|
|
8449
8407
|
_proto.blockquote = function blockquote(src) {
|
|
8450
8408
|
var cap = this.rules.block.blockquote.exec(src);
|
|
8451
|
-
|
|
8452
8409
|
if (cap) {
|
|
8453
|
-
var text = cap[0].replace(/^ *> ?/gm, '');
|
|
8410
|
+
var text = cap[0].replace(/^ *>[ \t]?/gm, '');
|
|
8411
|
+
var top = this.lexer.state.top;
|
|
8412
|
+
this.lexer.state.top = true;
|
|
8413
|
+
var tokens = this.lexer.blockTokens(text);
|
|
8414
|
+
this.lexer.state.top = top;
|
|
8454
8415
|
return {
|
|
8455
8416
|
type: 'blockquote',
|
|
8456
8417
|
raw: cap[0],
|
|
8418
|
+
tokens: tokens,
|
|
8457
8419
|
text: text
|
|
8458
8420
|
};
|
|
8459
8421
|
}
|
|
8460
8422
|
};
|
|
8461
|
-
|
|
8462
8423
|
_proto.list = function list(src) {
|
|
8463
8424
|
var cap = this.rules.block.list.exec(src);
|
|
8464
|
-
|
|
8465
8425
|
if (cap) {
|
|
8466
|
-
var raw
|
|
8467
|
-
var bull = cap[
|
|
8426
|
+
var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
|
|
8427
|
+
var bull = cap[1].trim();
|
|
8468
8428
|
var isordered = bull.length > 1;
|
|
8469
|
-
var isparen = bull[bull.length - 1] === ')';
|
|
8470
8429
|
var list = {
|
|
8471
8430
|
type: 'list',
|
|
8472
|
-
raw:
|
|
8431
|
+
raw: '',
|
|
8473
8432
|
ordered: isordered,
|
|
8474
8433
|
start: isordered ? +bull.slice(0, -1) : '',
|
|
8475
8434
|
loose: false,
|
|
8476
8435
|
items: []
|
|
8477
|
-
};
|
|
8436
|
+
};
|
|
8437
|
+
bull = isordered ? "\\d{1,9}\\" + bull.slice(-1) : "\\" + bull;
|
|
8438
|
+
if (this.options.pedantic) {
|
|
8439
|
+
bull = isordered ? bull : '[*+-]';
|
|
8440
|
+
}
|
|
8478
8441
|
|
|
8479
|
-
|
|
8480
|
-
var
|
|
8481
|
-
item,
|
|
8482
|
-
space,
|
|
8483
|
-
b,
|
|
8484
|
-
addBack,
|
|
8485
|
-
loose,
|
|
8486
|
-
istask,
|
|
8487
|
-
ischecked;
|
|
8488
|
-
var l = itemMatch.length;
|
|
8442
|
+
// Get next list item
|
|
8443
|
+
var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[\t ][^\\n]*)?(?:\\n|$))");
|
|
8489
8444
|
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8445
|
+
// Check if current bullet point can start a new List Item
|
|
8446
|
+
while (src) {
|
|
8447
|
+
endEarly = false;
|
|
8448
|
+
if (!(cap = itemRegex.exec(src))) {
|
|
8449
|
+
break;
|
|
8450
|
+
}
|
|
8451
|
+
if (this.rules.block.hr.test(src)) {
|
|
8452
|
+
// End list if bullet was actually HR (possibly move into itemRegex?)
|
|
8453
|
+
break;
|
|
8454
|
+
}
|
|
8455
|
+
raw = cap[0];
|
|
8456
|
+
src = src.substring(raw.length);
|
|
8457
|
+
line = cap[2].split('\n', 1)[0].replace(/^\t+/, function (t) {
|
|
8458
|
+
return ' '.repeat(3 * t.length);
|
|
8459
|
+
});
|
|
8460
|
+
nextLine = src.split('\n', 1)[0];
|
|
8461
|
+
if (this.options.pedantic) {
|
|
8462
|
+
indent = 2;
|
|
8463
|
+
itemContents = line.trimLeft();
|
|
8464
|
+
} else {
|
|
8465
|
+
indent = cap[2].search(/[^ ]/); // Find first non-space char
|
|
8466
|
+
indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
|
|
8467
|
+
itemContents = line.slice(indent);
|
|
8468
|
+
indent += cap[1].length;
|
|
8469
|
+
}
|
|
8470
|
+
blankLine = false;
|
|
8471
|
+
if (!line && /^ *$/.test(nextLine)) {
|
|
8472
|
+
// Items begin with at most one blank line
|
|
8473
|
+
raw += nextLine + '\n';
|
|
8474
|
+
src = src.substring(nextLine.length + 1);
|
|
8475
|
+
endEarly = true;
|
|
8476
|
+
}
|
|
8477
|
+
if (!endEarly) {
|
|
8478
|
+
var nextBulletRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))");
|
|
8479
|
+
var hrRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)");
|
|
8480
|
+
var fencesBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:```|~~~)");
|
|
8481
|
+
var headingBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}#");
|
|
8482
|
+
|
|
8483
|
+
// Check if following lines should be included in List Item
|
|
8484
|
+
while (src) {
|
|
8485
|
+
rawLine = src.split('\n', 1)[0];
|
|
8486
|
+
nextLine = rawLine;
|
|
8487
|
+
|
|
8488
|
+
// Re-align to follow commonmark nesting rules
|
|
8489
|
+
if (this.options.pedantic) {
|
|
8490
|
+
nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
|
|
8491
|
+
}
|
|
8494
8492
|
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8493
|
+
// End list item if found code fences
|
|
8494
|
+
if (fencesBeginRegex.test(nextLine)) {
|
|
8495
|
+
break;
|
|
8496
|
+
}
|
|
8498
8497
|
|
|
8499
|
-
|
|
8500
|
-
|
|
8501
|
-
|
|
8502
|
-
|
|
8503
|
-
// Backpedal if it does not belong in this list.
|
|
8498
|
+
// End list item if found start of new heading
|
|
8499
|
+
if (headingBeginRegex.test(nextLine)) {
|
|
8500
|
+
break;
|
|
8501
|
+
}
|
|
8504
8502
|
|
|
8503
|
+
// End list item if found start of new bullet
|
|
8504
|
+
if (nextBulletRegex.test(nextLine)) {
|
|
8505
|
+
break;
|
|
8506
|
+
}
|
|
8505
8507
|
|
|
8506
|
-
|
|
8507
|
-
|
|
8508
|
+
// Horizontal rule found
|
|
8509
|
+
if (hrRegex.test(src)) {
|
|
8510
|
+
break;
|
|
8511
|
+
}
|
|
8512
|
+
if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
|
|
8513
|
+
// Dedent if possible
|
|
8514
|
+
itemContents += '\n' + nextLine.slice(indent);
|
|
8515
|
+
} else {
|
|
8516
|
+
// not enough indentation
|
|
8517
|
+
if (blankLine) {
|
|
8518
|
+
break;
|
|
8519
|
+
}
|
|
8508
8520
|
|
|
8509
|
-
|
|
8510
|
-
|
|
8511
|
-
|
|
8512
|
-
|
|
8521
|
+
// paragraph continuation unless last line was a different block level element
|
|
8522
|
+
if (line.search(/[^ ]/) >= 4) {
|
|
8523
|
+
// indented code block
|
|
8524
|
+
break;
|
|
8525
|
+
}
|
|
8526
|
+
if (fencesBeginRegex.test(line)) {
|
|
8527
|
+
break;
|
|
8528
|
+
}
|
|
8529
|
+
if (headingBeginRegex.test(line)) {
|
|
8530
|
+
break;
|
|
8531
|
+
}
|
|
8532
|
+
if (hrRegex.test(line)) {
|
|
8533
|
+
break;
|
|
8534
|
+
}
|
|
8535
|
+
itemContents += '\n' + nextLine;
|
|
8536
|
+
}
|
|
8537
|
+
if (!blankLine && !nextLine.trim()) {
|
|
8538
|
+
// Check if current line is blank
|
|
8539
|
+
blankLine = true;
|
|
8540
|
+
}
|
|
8541
|
+
raw += rawLine + '\n';
|
|
8542
|
+
src = src.substring(rawLine.length + 1);
|
|
8543
|
+
line = nextLine.slice(indent);
|
|
8513
8544
|
}
|
|
8514
|
-
} // Determine whether item is loose or not.
|
|
8515
|
-
// Use: /(^|\n)(?! )[^\n]+\n\n(?!\s*$)/
|
|
8516
|
-
// for discount behavior.
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
loose = next || /\n\n(?!\s*$)/.test(item);
|
|
8520
|
-
|
|
8521
|
-
if (i !== l - 1) {
|
|
8522
|
-
next = item.charAt(item.length - 1) === '\n';
|
|
8523
|
-
if (!loose) loose = next;
|
|
8524
8545
|
}
|
|
8525
|
-
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
|
|
8529
|
-
|
|
8530
|
-
|
|
8531
|
-
|
|
8532
|
-
ischecked = undefined;
|
|
8533
|
-
|
|
8534
|
-
if (istask) {
|
|
8535
|
-
ischecked = item[1] !== ' ';
|
|
8536
|
-
item = item.replace(/^\[[ xX]\] +/, '');
|
|
8546
|
+
if (!list.loose) {
|
|
8547
|
+
// If the previous item ended with a blank line, the list is loose
|
|
8548
|
+
if (endsWithBlankLine) {
|
|
8549
|
+
list.loose = true;
|
|
8550
|
+
} else if (/\n *\n *$/.test(raw)) {
|
|
8551
|
+
endsWithBlankLine = true;
|
|
8552
|
+
}
|
|
8537
8553
|
}
|
|
8538
8554
|
|
|
8555
|
+
// Check for task list items
|
|
8556
|
+
if (this.options.gfm) {
|
|
8557
|
+
istask = /^\[[ xX]\] /.exec(itemContents);
|
|
8558
|
+
if (istask) {
|
|
8559
|
+
ischecked = istask[0] !== '[ ] ';
|
|
8560
|
+
itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
|
|
8561
|
+
}
|
|
8562
|
+
}
|
|
8539
8563
|
list.items.push({
|
|
8540
8564
|
type: 'list_item',
|
|
8541
8565
|
raw: raw,
|
|
8542
|
-
task: istask,
|
|
8566
|
+
task: !!istask,
|
|
8543
8567
|
checked: ischecked,
|
|
8544
|
-
loose:
|
|
8545
|
-
text:
|
|
8568
|
+
loose: false,
|
|
8569
|
+
text: itemContents
|
|
8546
8570
|
});
|
|
8571
|
+
list.raw += raw;
|
|
8572
|
+
}
|
|
8573
|
+
|
|
8574
|
+
// Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
|
|
8575
|
+
list.items[list.items.length - 1].raw = raw.trimRight();
|
|
8576
|
+
list.items[list.items.length - 1].text = itemContents.trimRight();
|
|
8577
|
+
list.raw = list.raw.trimRight();
|
|
8578
|
+
var l = list.items.length;
|
|
8579
|
+
|
|
8580
|
+
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
8581
|
+
for (i = 0; i < l; i++) {
|
|
8582
|
+
this.lexer.state.top = false;
|
|
8583
|
+
list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
|
|
8584
|
+
if (!list.loose) {
|
|
8585
|
+
// Check if list should be loose
|
|
8586
|
+
var spacers = list.items[i].tokens.filter(function (t) {
|
|
8587
|
+
return t.type === 'space';
|
|
8588
|
+
});
|
|
8589
|
+
var hasMultipleLineBreaks = spacers.length > 0 && spacers.some(function (t) {
|
|
8590
|
+
return /\n.*\n/.test(t.raw);
|
|
8591
|
+
});
|
|
8592
|
+
list.loose = hasMultipleLineBreaks;
|
|
8593
|
+
}
|
|
8547
8594
|
}
|
|
8548
8595
|
|
|
8596
|
+
// Set all items to loose if list is loose
|
|
8597
|
+
if (list.loose) {
|
|
8598
|
+
for (i = 0; i < l; i++) {
|
|
8599
|
+
list.items[i].loose = true;
|
|
8600
|
+
}
|
|
8601
|
+
}
|
|
8549
8602
|
return list;
|
|
8550
8603
|
}
|
|
8551
8604
|
};
|
|
8552
|
-
|
|
8553
8605
|
_proto.html = function html(src) {
|
|
8554
8606
|
var cap = this.rules.block.html.exec(src);
|
|
8555
|
-
|
|
8556
8607
|
if (cap) {
|
|
8557
|
-
|
|
8558
|
-
type:
|
|
8608
|
+
var token = {
|
|
8609
|
+
type: 'html',
|
|
8559
8610
|
raw: cap[0],
|
|
8560
8611
|
pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
|
|
8561
|
-
text:
|
|
8612
|
+
text: cap[0]
|
|
8562
8613
|
};
|
|
8614
|
+
if (this.options.sanitize) {
|
|
8615
|
+
var text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
|
|
8616
|
+
token.type = 'paragraph';
|
|
8617
|
+
token.text = text;
|
|
8618
|
+
token.tokens = this.lexer.inline(text);
|
|
8619
|
+
}
|
|
8620
|
+
return token;
|
|
8563
8621
|
}
|
|
8564
8622
|
};
|
|
8565
|
-
|
|
8566
8623
|
_proto.def = function def(src) {
|
|
8567
8624
|
var cap = this.rules.block.def.exec(src);
|
|
8568
|
-
|
|
8569
8625
|
if (cap) {
|
|
8570
|
-
if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
|
|
8571
8626
|
var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
|
|
8627
|
+
var href = cap[2] ? cap[2].replace(/^<(.*)>$/, '$1').replace(this.rules.inline._escapes, '$1') : '';
|
|
8628
|
+
var title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline._escapes, '$1') : cap[3];
|
|
8572
8629
|
return {
|
|
8630
|
+
type: 'def',
|
|
8573
8631
|
tag: tag,
|
|
8574
8632
|
raw: cap[0],
|
|
8575
|
-
href:
|
|
8576
|
-
title:
|
|
8633
|
+
href: href,
|
|
8634
|
+
title: title
|
|
8577
8635
|
};
|
|
8578
8636
|
}
|
|
8579
8637
|
};
|
|
8580
|
-
|
|
8581
8638
|
_proto.table = function table(src) {
|
|
8582
8639
|
var cap = this.rules.block.table.exec(src);
|
|
8583
|
-
|
|
8584
8640
|
if (cap) {
|
|
8585
8641
|
var item = {
|
|
8586
8642
|
type: 'table',
|
|
8587
|
-
header: splitCells
|
|
8643
|
+
header: splitCells(cap[1]).map(function (c) {
|
|
8644
|
+
return {
|
|
8645
|
+
text: c
|
|
8646
|
+
};
|
|
8647
|
+
}),
|
|
8588
8648
|
align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
|
|
8589
|
-
|
|
8649
|
+
rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
|
|
8590
8650
|
};
|
|
8591
|
-
|
|
8592
8651
|
if (item.header.length === item.align.length) {
|
|
8593
8652
|
item.raw = cap[0];
|
|
8594
8653
|
var l = item.align.length;
|
|
8595
|
-
var i;
|
|
8596
|
-
|
|
8654
|
+
var i, j, k, row;
|
|
8597
8655
|
for (i = 0; i < l; i++) {
|
|
8598
8656
|
if (/^ *-+: *$/.test(item.align[i])) {
|
|
8599
8657
|
item.align[i] = 'right';
|
|
@@ -8605,149 +8663,161 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8605
8663
|
item.align[i] = null;
|
|
8606
8664
|
}
|
|
8607
8665
|
}
|
|
8666
|
+
l = item.rows.length;
|
|
8667
|
+
for (i = 0; i < l; i++) {
|
|
8668
|
+
item.rows[i] = splitCells(item.rows[i], item.header.length).map(function (c) {
|
|
8669
|
+
return {
|
|
8670
|
+
text: c
|
|
8671
|
+
};
|
|
8672
|
+
});
|
|
8673
|
+
}
|
|
8608
8674
|
|
|
8609
|
-
|
|
8675
|
+
// parse child tokens inside headers and cells
|
|
8610
8676
|
|
|
8611
|
-
|
|
8612
|
-
|
|
8677
|
+
// header child tokens
|
|
8678
|
+
l = item.header.length;
|
|
8679
|
+
for (j = 0; j < l; j++) {
|
|
8680
|
+
item.header[j].tokens = this.lexer.inline(item.header[j].text);
|
|
8613
8681
|
}
|
|
8614
8682
|
|
|
8683
|
+
// cell child tokens
|
|
8684
|
+
l = item.rows.length;
|
|
8685
|
+
for (j = 0; j < l; j++) {
|
|
8686
|
+
row = item.rows[j];
|
|
8687
|
+
for (k = 0; k < row.length; k++) {
|
|
8688
|
+
row[k].tokens = this.lexer.inline(row[k].text);
|
|
8689
|
+
}
|
|
8690
|
+
}
|
|
8615
8691
|
return item;
|
|
8616
8692
|
}
|
|
8617
8693
|
}
|
|
8618
8694
|
};
|
|
8619
|
-
|
|
8620
8695
|
_proto.lheading = function lheading(src) {
|
|
8621
8696
|
var cap = this.rules.block.lheading.exec(src);
|
|
8622
|
-
|
|
8623
8697
|
if (cap) {
|
|
8624
8698
|
return {
|
|
8625
8699
|
type: 'heading',
|
|
8626
8700
|
raw: cap[0],
|
|
8627
8701
|
depth: cap[2].charAt(0) === '=' ? 1 : 2,
|
|
8628
|
-
text: cap[1]
|
|
8702
|
+
text: cap[1],
|
|
8703
|
+
tokens: this.lexer.inline(cap[1])
|
|
8629
8704
|
};
|
|
8630
8705
|
}
|
|
8631
8706
|
};
|
|
8632
|
-
|
|
8633
8707
|
_proto.paragraph = function paragraph(src) {
|
|
8634
8708
|
var cap = this.rules.block.paragraph.exec(src);
|
|
8635
|
-
|
|
8636
8709
|
if (cap) {
|
|
8710
|
+
var text = cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1];
|
|
8637
8711
|
return {
|
|
8638
8712
|
type: 'paragraph',
|
|
8639
8713
|
raw: cap[0],
|
|
8640
|
-
text:
|
|
8714
|
+
text: text,
|
|
8715
|
+
tokens: this.lexer.inline(text)
|
|
8641
8716
|
};
|
|
8642
8717
|
}
|
|
8643
8718
|
};
|
|
8644
|
-
|
|
8645
|
-
_proto.text = function text(src, tokens) {
|
|
8719
|
+
_proto.text = function text(src) {
|
|
8646
8720
|
var cap = this.rules.block.text.exec(src);
|
|
8647
|
-
|
|
8648
8721
|
if (cap) {
|
|
8649
|
-
var lastToken = tokens[tokens.length - 1];
|
|
8650
|
-
|
|
8651
|
-
if (lastToken && lastToken.type === 'text') {
|
|
8652
|
-
return {
|
|
8653
|
-
raw: cap[0],
|
|
8654
|
-
text: cap[0]
|
|
8655
|
-
};
|
|
8656
|
-
}
|
|
8657
|
-
|
|
8658
8722
|
return {
|
|
8659
8723
|
type: 'text',
|
|
8660
8724
|
raw: cap[0],
|
|
8661
|
-
text: cap[0]
|
|
8725
|
+
text: cap[0],
|
|
8726
|
+
tokens: this.lexer.inline(cap[0])
|
|
8662
8727
|
};
|
|
8663
8728
|
}
|
|
8664
8729
|
};
|
|
8665
|
-
|
|
8666
|
-
_proto.escape = function escape(src) {
|
|
8730
|
+
_proto.escape = function escape$1(src) {
|
|
8667
8731
|
var cap = this.rules.inline.escape.exec(src);
|
|
8668
|
-
|
|
8669
8732
|
if (cap) {
|
|
8670
8733
|
return {
|
|
8671
8734
|
type: 'escape',
|
|
8672
8735
|
raw: cap[0],
|
|
8673
|
-
text:
|
|
8736
|
+
text: escape(cap[1])
|
|
8674
8737
|
};
|
|
8675
8738
|
}
|
|
8676
8739
|
};
|
|
8677
|
-
|
|
8678
|
-
_proto.tag = function tag(src, inLink, inRawBlock) {
|
|
8740
|
+
_proto.tag = function tag(src) {
|
|
8679
8741
|
var cap = this.rules.inline.tag.exec(src);
|
|
8680
|
-
|
|
8681
8742
|
if (cap) {
|
|
8682
|
-
if (!inLink && /^<a /i.test(cap[0])) {
|
|
8683
|
-
inLink = true;
|
|
8684
|
-
} else if (inLink && /^<\/a>/i.test(cap[0])) {
|
|
8685
|
-
inLink = false;
|
|
8743
|
+
if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
|
|
8744
|
+
this.lexer.state.inLink = true;
|
|
8745
|
+
} else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
|
|
8746
|
+
this.lexer.state.inLink = false;
|
|
8686
8747
|
}
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
inRawBlock = false;
|
|
8748
|
+
if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
|
8749
|
+
this.lexer.state.inRawBlock = true;
|
|
8750
|
+
} else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
|
8751
|
+
this.lexer.state.inRawBlock = false;
|
|
8692
8752
|
}
|
|
8693
|
-
|
|
8694
8753
|
return {
|
|
8695
8754
|
type: this.options.sanitize ? 'text' : 'html',
|
|
8696
8755
|
raw: cap[0],
|
|
8697
|
-
inLink: inLink,
|
|
8698
|
-
inRawBlock: inRawBlock,
|
|
8699
|
-
text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) :
|
|
8756
|
+
inLink: this.lexer.state.inLink,
|
|
8757
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
|
8758
|
+
text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]
|
|
8700
8759
|
};
|
|
8701
8760
|
}
|
|
8702
8761
|
};
|
|
8703
|
-
|
|
8704
8762
|
_proto.link = function link(src) {
|
|
8705
8763
|
var cap = this.rules.inline.link.exec(src);
|
|
8706
|
-
|
|
8707
8764
|
if (cap) {
|
|
8708
|
-
var
|
|
8765
|
+
var trimmedUrl = cap[2].trim();
|
|
8766
|
+
if (!this.options.pedantic && /^</.test(trimmedUrl)) {
|
|
8767
|
+
// commonmark requires matching angle brackets
|
|
8768
|
+
if (!/>$/.test(trimmedUrl)) {
|
|
8769
|
+
return;
|
|
8770
|
+
}
|
|
8709
8771
|
|
|
8710
|
-
|
|
8711
|
-
var
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8772
|
+
// ending angle bracket cannot be escaped
|
|
8773
|
+
var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
|
|
8774
|
+
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
|
8775
|
+
return;
|
|
8776
|
+
}
|
|
8777
|
+
} else {
|
|
8778
|
+
// find closing parenthesis
|
|
8779
|
+
var lastParenIndex = findClosingBracket(cap[2], '()');
|
|
8780
|
+
if (lastParenIndex > -1) {
|
|
8781
|
+
var start = cap[0].indexOf('!') === 0 ? 5 : 4;
|
|
8782
|
+
var linkLen = start + cap[1].length + lastParenIndex;
|
|
8783
|
+
cap[2] = cap[2].substring(0, lastParenIndex);
|
|
8784
|
+
cap[0] = cap[0].substring(0, linkLen).trim();
|
|
8785
|
+
cap[3] = '';
|
|
8786
|
+
}
|
|
8716
8787
|
}
|
|
8717
|
-
|
|
8718
8788
|
var href = cap[2];
|
|
8719
8789
|
var title = '';
|
|
8720
|
-
|
|
8721
8790
|
if (this.options.pedantic) {
|
|
8791
|
+
// split pedantic href and title
|
|
8722
8792
|
var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
|
|
8723
|
-
|
|
8724
8793
|
if (link) {
|
|
8725
8794
|
href = link[1];
|
|
8726
8795
|
title = link[3];
|
|
8727
|
-
} else {
|
|
8728
|
-
title = '';
|
|
8729
8796
|
}
|
|
8730
8797
|
} else {
|
|
8731
8798
|
title = cap[3] ? cap[3].slice(1, -1) : '';
|
|
8732
8799
|
}
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8800
|
+
href = href.trim();
|
|
8801
|
+
if (/^</.test(href)) {
|
|
8802
|
+
if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
|
|
8803
|
+
// pedantic allows starting angle bracket without ending angle bracket
|
|
8804
|
+
href = href.slice(1);
|
|
8805
|
+
} else {
|
|
8806
|
+
href = href.slice(1, -1);
|
|
8807
|
+
}
|
|
8808
|
+
}
|
|
8809
|
+
return outputLink(cap, {
|
|
8736
8810
|
href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
|
|
8737
8811
|
title: title ? title.replace(this.rules.inline._escapes, '$1') : title
|
|
8738
|
-
}, cap[0]);
|
|
8739
|
-
return token;
|
|
8812
|
+
}, cap[0], this.lexer);
|
|
8740
8813
|
}
|
|
8741
8814
|
};
|
|
8742
|
-
|
|
8743
8815
|
_proto.reflink = function reflink(src, links) {
|
|
8744
8816
|
var cap;
|
|
8745
|
-
|
|
8746
8817
|
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
|
|
8747
8818
|
var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
|
|
8748
8819
|
link = links[link.toLowerCase()];
|
|
8749
|
-
|
|
8750
|
-
if (!link || !link.href) {
|
|
8820
|
+
if (!link) {
|
|
8751
8821
|
var text = cap[0].charAt(0);
|
|
8752
8822
|
return {
|
|
8753
8823
|
type: 'text',
|
|
@@ -8755,79 +8825,86 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8755
8825
|
text: text
|
|
8756
8826
|
};
|
|
8757
8827
|
}
|
|
8758
|
-
|
|
8759
|
-
var token = outputLink(cap, link, cap[0]);
|
|
8760
|
-
return token;
|
|
8828
|
+
return outputLink(cap, link, cap[0], this.lexer);
|
|
8761
8829
|
}
|
|
8762
8830
|
};
|
|
8763
|
-
|
|
8764
|
-
_proto.strong = function strong(src, maskedSrc, prevChar) {
|
|
8831
|
+
_proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
|
|
8765
8832
|
if (prevChar === void 0) {
|
|
8766
8833
|
prevChar = '';
|
|
8767
8834
|
}
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
8835
|
+
var match = this.rules.inline.emStrong.lDelim.exec(src);
|
|
8836
|
+
if (!match) return;
|
|
8837
|
+
|
|
8838
|
+
// _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
|
|
8839
|
+
if (match[3] && prevChar.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/)) return;
|
|
8840
|
+
var nextChar = match[1] || match[2] || '';
|
|
8841
|
+
if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) {
|
|
8842
|
+
var lLength = match[0].length - 1;
|
|
8843
|
+
var rDelim,
|
|
8844
|
+
rLength,
|
|
8845
|
+
delimTotal = lLength,
|
|
8846
|
+
midDelimTotal = 0;
|
|
8847
|
+
var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
|
|
8774
8848
|
endReg.lastIndex = 0;
|
|
8775
|
-
var cap;
|
|
8776
8849
|
|
|
8850
|
+
// Clip maskedSrc to same section of string as src (move to lexer?)
|
|
8851
|
+
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
|
8777
8852
|
while ((match = endReg.exec(maskedSrc)) != null) {
|
|
8778
|
-
|
|
8853
|
+
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
|
8854
|
+
if (!rDelim) continue; // skip single * in __abc*abc__
|
|
8779
8855
|
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8856
|
+
rLength = rDelim.length;
|
|
8857
|
+
if (match[3] || match[4]) {
|
|
8858
|
+
// found another Left Delim
|
|
8859
|
+
delimTotal += rLength;
|
|
8860
|
+
continue;
|
|
8861
|
+
} else if (match[5] || match[6]) {
|
|
8862
|
+
// either Left or Right Delim
|
|
8863
|
+
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
|
8864
|
+
midDelimTotal += rLength;
|
|
8865
|
+
continue; // CommonMark Emphasis Rules 9-10
|
|
8866
|
+
}
|
|
8786
8867
|
}
|
|
8787
|
-
}
|
|
8788
|
-
}
|
|
8789
|
-
};
|
|
8790
|
-
|
|
8791
|
-
_proto.em = function em(src, maskedSrc, prevChar) {
|
|
8792
|
-
if (prevChar === void 0) {
|
|
8793
|
-
prevChar = '';
|
|
8794
|
-
}
|
|
8795
8868
|
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
if (match && (!match[1] || match[1] && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar)))) {
|
|
8799
|
-
maskedSrc = maskedSrc.slice(-1 * src.length);
|
|
8800
|
-
var endReg = match[0] === '*' ? this.rules.inline.em.endAst : this.rules.inline.em.endUnd;
|
|
8801
|
-
endReg.lastIndex = 0;
|
|
8802
|
-
var cap;
|
|
8869
|
+
delimTotal -= rLength;
|
|
8870
|
+
if (delimTotal > 0) continue; // Haven't found enough closing delimiters
|
|
8803
8871
|
|
|
8804
|
-
|
|
8805
|
-
|
|
8872
|
+
// Remove extra characters. *a*** -> *a*
|
|
8873
|
+
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
|
8874
|
+
var raw = src.slice(0, lLength + match.index + (match[0].length - rDelim.length) + rLength);
|
|
8806
8875
|
|
|
8807
|
-
if
|
|
8876
|
+
// Create `em` if smallest delimiter has odd char count. *a***
|
|
8877
|
+
if (Math.min(lLength, rLength) % 2) {
|
|
8878
|
+
var _text = raw.slice(1, -1);
|
|
8808
8879
|
return {
|
|
8809
8880
|
type: 'em',
|
|
8810
|
-
raw:
|
|
8811
|
-
text:
|
|
8881
|
+
raw: raw,
|
|
8882
|
+
text: _text,
|
|
8883
|
+
tokens: this.lexer.inlineTokens(_text)
|
|
8812
8884
|
};
|
|
8813
8885
|
}
|
|
8886
|
+
|
|
8887
|
+
// Create 'strong' if smallest delimiter has even char count. **a***
|
|
8888
|
+
var text = raw.slice(2, -2);
|
|
8889
|
+
return {
|
|
8890
|
+
type: 'strong',
|
|
8891
|
+
raw: raw,
|
|
8892
|
+
text: text,
|
|
8893
|
+
tokens: this.lexer.inlineTokens(text)
|
|
8894
|
+
};
|
|
8814
8895
|
}
|
|
8815
8896
|
}
|
|
8816
8897
|
};
|
|
8817
|
-
|
|
8818
8898
|
_proto.codespan = function codespan(src) {
|
|
8819
8899
|
var cap = this.rules.inline.code.exec(src);
|
|
8820
|
-
|
|
8821
8900
|
if (cap) {
|
|
8822
8901
|
var text = cap[2].replace(/\n/g, ' ');
|
|
8823
8902
|
var hasNonSpaceChars = /[^ ]/.test(text);
|
|
8824
|
-
var hasSpaceCharsOnBothEnds = text
|
|
8825
|
-
|
|
8903
|
+
var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
|
|
8826
8904
|
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
|
8827
8905
|
text = text.substring(1, text.length - 1);
|
|
8828
8906
|
}
|
|
8829
|
-
|
|
8830
|
-
text = _escape(text, true);
|
|
8907
|
+
text = escape(text, true);
|
|
8831
8908
|
return {
|
|
8832
8909
|
type: 'codespan',
|
|
8833
8910
|
raw: cap[0],
|
|
@@ -8835,10 +8912,8 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8835
8912
|
};
|
|
8836
8913
|
}
|
|
8837
8914
|
};
|
|
8838
|
-
|
|
8839
8915
|
_proto.br = function br(src) {
|
|
8840
8916
|
var cap = this.rules.inline.br.exec(src);
|
|
8841
|
-
|
|
8842
8917
|
if (cap) {
|
|
8843
8918
|
return {
|
|
8844
8919
|
type: 'br',
|
|
@@ -8846,33 +8921,28 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8846
8921
|
};
|
|
8847
8922
|
}
|
|
8848
8923
|
};
|
|
8849
|
-
|
|
8850
8924
|
_proto.del = function del(src) {
|
|
8851
8925
|
var cap = this.rules.inline.del.exec(src);
|
|
8852
|
-
|
|
8853
8926
|
if (cap) {
|
|
8854
8927
|
return {
|
|
8855
8928
|
type: 'del',
|
|
8856
8929
|
raw: cap[0],
|
|
8857
|
-
text: cap[
|
|
8930
|
+
text: cap[2],
|
|
8931
|
+
tokens: this.lexer.inlineTokens(cap[2])
|
|
8858
8932
|
};
|
|
8859
8933
|
}
|
|
8860
8934
|
};
|
|
8861
|
-
|
|
8862
8935
|
_proto.autolink = function autolink(src, mangle) {
|
|
8863
8936
|
var cap = this.rules.inline.autolink.exec(src);
|
|
8864
|
-
|
|
8865
8937
|
if (cap) {
|
|
8866
8938
|
var text, href;
|
|
8867
|
-
|
|
8868
8939
|
if (cap[2] === '@') {
|
|
8869
|
-
text =
|
|
8940
|
+
text = escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
|
|
8870
8941
|
href = 'mailto:' + text;
|
|
8871
8942
|
} else {
|
|
8872
|
-
text =
|
|
8943
|
+
text = escape(cap[1]);
|
|
8873
8944
|
href = text;
|
|
8874
8945
|
}
|
|
8875
|
-
|
|
8876
8946
|
return {
|
|
8877
8947
|
type: 'link',
|
|
8878
8948
|
raw: cap[0],
|
|
@@ -8886,34 +8956,27 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8886
8956
|
};
|
|
8887
8957
|
}
|
|
8888
8958
|
};
|
|
8889
|
-
|
|
8890
8959
|
_proto.url = function url(src, mangle) {
|
|
8891
8960
|
var cap;
|
|
8892
|
-
|
|
8893
8961
|
if (cap = this.rules.inline.url.exec(src)) {
|
|
8894
8962
|
var text, href;
|
|
8895
|
-
|
|
8896
8963
|
if (cap[2] === '@') {
|
|
8897
|
-
text =
|
|
8964
|
+
text = escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
|
|
8898
8965
|
href = 'mailto:' + text;
|
|
8899
8966
|
} else {
|
|
8900
8967
|
// do extended autolink path validation
|
|
8901
8968
|
var prevCapZero;
|
|
8902
|
-
|
|
8903
8969
|
do {
|
|
8904
8970
|
prevCapZero = cap[0];
|
|
8905
8971
|
cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
|
|
8906
8972
|
} while (prevCapZero !== cap[0]);
|
|
8907
|
-
|
|
8908
|
-
text = _escape(cap[0]);
|
|
8909
|
-
|
|
8973
|
+
text = escape(cap[0]);
|
|
8910
8974
|
if (cap[1] === 'www.') {
|
|
8911
|
-
href = 'http://' +
|
|
8975
|
+
href = 'http://' + cap[0];
|
|
8912
8976
|
} else {
|
|
8913
|
-
href =
|
|
8977
|
+
href = cap[0];
|
|
8914
8978
|
}
|
|
8915
8979
|
}
|
|
8916
|
-
|
|
8917
8980
|
return {
|
|
8918
8981
|
type: 'link',
|
|
8919
8982
|
raw: cap[0],
|
|
@@ -8927,19 +8990,15 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8927
8990
|
};
|
|
8928
8991
|
}
|
|
8929
8992
|
};
|
|
8930
|
-
|
|
8931
|
-
_proto.inlineText = function inlineText(src, inRawBlock, smartypants) {
|
|
8993
|
+
_proto.inlineText = function inlineText(src, smartypants) {
|
|
8932
8994
|
var cap = this.rules.inline.text.exec(src);
|
|
8933
|
-
|
|
8934
8995
|
if (cap) {
|
|
8935
8996
|
var text;
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : _escape(cap[0]) : cap[0];
|
|
8997
|
+
if (this.lexer.state.inRawBlock) {
|
|
8998
|
+
text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
|
|
8939
8999
|
} else {
|
|
8940
|
-
text =
|
|
9000
|
+
text = escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
|
|
8941
9001
|
}
|
|
8942
|
-
|
|
8943
9002
|
return {
|
|
8944
9003
|
type: 'text',
|
|
8945
9004
|
raw: cap[0],
|
|
@@ -8947,105 +9006,99 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
8947
9006
|
};
|
|
8948
9007
|
}
|
|
8949
9008
|
};
|
|
8950
|
-
|
|
8951
9009
|
return Tokenizer;
|
|
8952
9010
|
}();
|
|
8953
9011
|
|
|
8954
|
-
var noopTest$1 = helpers.noopTest,
|
|
8955
|
-
edit$1 = helpers.edit,
|
|
8956
|
-
merge$1 = helpers.merge;
|
|
8957
9012
|
/**
|
|
8958
9013
|
* Block-Level Grammar
|
|
8959
9014
|
*/
|
|
8960
|
-
|
|
8961
9015
|
var block = {
|
|
8962
|
-
newline:
|
|
8963
|
-
code: /^( {4}[^\n]
|
|
8964
|
-
fences: /^ {0,3}(`{3,}(?=[^`\n]
|
|
8965
|
-
hr: /^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,
|
|
8966
|
-
heading: /^ {0,3}(#{1,6})
|
|
9016
|
+
newline: /^(?: *(?:\n|$))+/,
|
|
9017
|
+
code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
|
|
9018
|
+
fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
|
|
9019
|
+
hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
|
|
9020
|
+
heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
|
|
8967
9021
|
blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
|
|
8968
|
-
list: /^( {0,3})(
|
|
9022
|
+
list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
|
|
8969
9023
|
html: '^ {0,3}(?:' // optional indentation
|
|
8970
|
-
+ '<(script|pre|style)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
|
9024
|
+
+ '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
|
|
8971
9025
|
+ '|comment[^\\n]*(\\n+|$)' // (2)
|
|
8972
|
-
+ '|<\\?[\\s\\S]
|
|
8973
|
-
+ '|<![A-Z][\\s\\S]
|
|
8974
|
-
+ '|<!\\[CDATA\\[[\\s\\S]
|
|
8975
|
-
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:\\n
|
|
8976
|
-
+ '|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n
|
|
8977
|
-
+ '|</(?!script|pre|style)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n
|
|
9026
|
+
+ '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
|
|
9027
|
+
+ '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
|
|
9028
|
+
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
|
|
9029
|
+
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
|
|
9030
|
+
+ '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
|
|
9031
|
+
+ '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
|
|
8978
9032
|
+ ')',
|
|
8979
|
-
def: /^ {0,3}\[(label)\]:
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
9033
|
+
def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
|
|
9034
|
+
table: noopTest,
|
|
9035
|
+
lheading: /^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
8983
9036
|
// regex template, placeholders will be replaced according to different paragraph
|
|
8984
9037
|
// interruption rules of commonmark and the original markdown spec:
|
|
8985
|
-
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,
|
|
9038
|
+
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
|
8986
9039
|
text: /^[^\n]+/
|
|
8987
9040
|
};
|
|
8988
|
-
block._label = /(?!\s*\])(
|
|
9041
|
+
block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
|
8989
9042
|
block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
|
|
8990
|
-
block.def = edit
|
|
9043
|
+
block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
|
|
8991
9044
|
block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
|
8992
|
-
block.
|
|
8993
|
-
block.
|
|
8994
|
-
block.list = edit$1(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
|
|
9045
|
+
block.listItemStart = edit(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
|
|
9046
|
+
block.list = edit(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
|
|
8995
9047
|
block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
|
|
8996
|
-
block._comment = /<!--(?!-?>)[\s\S]
|
|
8997
|
-
block.html = edit
|
|
8998
|
-
block.paragraph = edit
|
|
8999
|
-
.replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
9000
|
-
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
|
|
9048
|
+
block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
|
|
9049
|
+
block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
9050
|
+
block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
|
|
9051
|
+
.replace('|table', '').replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
9052
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
|
|
9001
9053
|
.getRegex();
|
|
9002
|
-
block.blockquote = edit
|
|
9054
|
+
block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
|
|
9055
|
+
|
|
9003
9056
|
/**
|
|
9004
9057
|
* Normal Block Grammar
|
|
9005
9058
|
*/
|
|
9006
9059
|
|
|
9007
|
-
block.normal =
|
|
9060
|
+
block.normal = _extends({}, block);
|
|
9061
|
+
|
|
9008
9062
|
/**
|
|
9009
9063
|
* GFM Block Grammar
|
|
9010
9064
|
*/
|
|
9011
9065
|
|
|
9012
|
-
block.gfm =
|
|
9013
|
-
|
|
9014
|
-
+ ' *(
|
|
9015
|
-
+ '(?:\\n((?:(
|
|
9016
|
-
// Cells
|
|
9017
|
-
table: '^ *\\|(.+)\\n' // Header
|
|
9018
|
-
+ ' *\\|?( *[-:]+[-| :]*)' // Align
|
|
9019
|
-
+ '(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
|
9020
|
-
|
|
9066
|
+
block.gfm = _extends({}, block.normal, {
|
|
9067
|
+
table: '^ *([^\\n ].*\\|.*)\\n' // Header
|
|
9068
|
+
+ ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?' // Align
|
|
9069
|
+
+ '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
|
|
9021
9070
|
});
|
|
9022
|
-
|
|
9023
|
-
.replace('
|
|
9071
|
+
|
|
9072
|
+
block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
9073
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
|
|
9024
9074
|
.getRegex();
|
|
9025
|
-
block.gfm.
|
|
9026
|
-
.replace('
|
|
9075
|
+
block.gfm.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
|
|
9076
|
+
.replace('table', block.gfm.table) // interrupt paragraphs with table
|
|
9077
|
+
.replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
|
|
9078
|
+
.replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
|
|
9027
9079
|
.getRegex();
|
|
9028
9080
|
/**
|
|
9029
9081
|
* Pedantic grammar (original John Gruber's loose markdown specification)
|
|
9030
9082
|
*/
|
|
9031
9083
|
|
|
9032
|
-
block.pedantic =
|
|
9033
|
-
html: edit
|
|
9084
|
+
block.pedantic = _extends({}, block.normal, {
|
|
9085
|
+
html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
|
|
9034
9086
|
+ '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
|
|
9035
9087
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
9036
|
-
heading: /^
|
|
9037
|
-
fences: noopTest
|
|
9088
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
9089
|
+
fences: noopTest,
|
|
9038
9090
|
// fences not supported
|
|
9039
|
-
|
|
9091
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
9092
|
+
paragraph: edit(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
|
|
9040
9093
|
});
|
|
9094
|
+
|
|
9041
9095
|
/**
|
|
9042
9096
|
* Inline-Level Grammar
|
|
9043
9097
|
*/
|
|
9044
|
-
|
|
9045
9098
|
var inline = {
|
|
9046
9099
|
escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
|
|
9047
9100
|
autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
|
|
9048
|
-
url: noopTest
|
|
9101
|
+
url: noopTest,
|
|
9049
9102
|
tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
|
|
9050
9103
|
+ '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
|
|
9051
9104
|
+ '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
|
|
@@ -9053,72 +9106,63 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
9053
9106
|
+ '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
|
|
9054
9107
|
// CDATA section
|
|
9055
9108
|
link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
|
|
9056
|
-
reflink: /^!?\[(label)\]\[(
|
|
9057
|
-
nolink: /^!?\[(
|
|
9109
|
+
reflink: /^!?\[(label)\]\[(ref)\]/,
|
|
9110
|
+
nolink: /^!?\[(ref)\](?:\[\])?/,
|
|
9058
9111
|
reflinkSearch: 'reflink|nolink(?!\\()',
|
|
9059
|
-
|
|
9060
|
-
|
|
9061
|
-
//
|
|
9062
|
-
|
|
9063
|
-
|
|
9064
|
-
|
|
9065
|
-
endUnd: /[^\s]__(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
|
|
9066
|
-
|
|
9112
|
+
emStrong: {
|
|
9113
|
+
lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
|
|
9114
|
+
// (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
|
|
9115
|
+
// () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
|
|
9116
|
+
rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,
|
|
9117
|
+
rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
|
|
9067
9118
|
},
|
|
9068
|
-
em: {
|
|
9069
|
-
start: /^(?:(\*(?=[punctuation]))|\*)(?![*\s])|_/,
|
|
9070
|
-
// (1) returns if starts w/ punctuation
|
|
9071
|
-
middle: /^\*(?:(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)|\*(?:(?!overlapSkip)(?:[^*]|\\\*)|overlapSkip)*?\*)+?\*$|^_(?![_\s])(?:(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)|_(?:(?!overlapSkip)(?:[^_]|\\_)|overlapSkip)*?_)+?_$/,
|
|
9072
|
-
endAst: /[^punctuation\s]\*(?!\*)|[punctuation]\*(?!\*)(?:(?=[punctuation\s]|$))/,
|
|
9073
|
-
// last char can't be punct, or final * must also be followed by punct (or endline)
|
|
9074
|
-
endUnd: /[^\s]_(?!_)(?:(?=[punctuation\s])|$)/ // last char can't be a space, and final _ must preceed punct or \s (or endline)
|
|
9075
9119
|
|
|
9076
|
-
},
|
|
9077
9120
|
code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
|
|
9078
9121
|
br: /^( {2,}|\\)\n(?!\s*$)/,
|
|
9079
|
-
del: noopTest
|
|
9080
|
-
text: /^(`+|[^`])(?:[\s\S]*?(?:(?=[\\<!\[`*]|\b_|$)|[^ ](?= {2,}\n))
|
|
9081
|
-
punctuation: /^([\
|
|
9082
|
-
};
|
|
9083
|
-
// without * and _ to workaround cases with double emphasis
|
|
9122
|
+
del: noopTest,
|
|
9123
|
+
text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
|
|
9124
|
+
punctuation: /^([\spunctuation])/
|
|
9125
|
+
};
|
|
9084
9126
|
|
|
9127
|
+
// list of punctuation marks from CommonMark spec
|
|
9128
|
+
// without * and _ to handle the different emphasis markers * and _
|
|
9085
9129
|
inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
|
|
9086
|
-
inline.punctuation = edit
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
inline.
|
|
9090
|
-
|
|
9091
|
-
inline.
|
|
9092
|
-
inline.
|
|
9093
|
-
inline.
|
|
9094
|
-
inline.
|
|
9095
|
-
inline.
|
|
9096
|
-
inline.
|
|
9097
|
-
inline.strong.endUnd = edit$1(inline.strong.endUnd, 'g').replace(/punctuation/g, inline._punctuation).getRegex();
|
|
9098
|
-
inline.blockSkip = edit$1(inline._blockSkip, 'g').getRegex();
|
|
9099
|
-
inline.overlapSkip = edit$1(inline._overlapSkip, 'g').getRegex();
|
|
9130
|
+
inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex();
|
|
9131
|
+
|
|
9132
|
+
// sequences em should skip over [title](link), `code`, <html>
|
|
9133
|
+
inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
|
|
9134
|
+
// lookbehind is not available on Safari as of version 16
|
|
9135
|
+
// inline.escapedEmSt = /(?<=(?:^|[^\\)(?:\\[^])*)\\[*_]/g;
|
|
9136
|
+
inline.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
|
|
9137
|
+
inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
|
|
9138
|
+
inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
|
|
9139
|
+
inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g').replace(/punct/g, inline._punctuation).getRegex();
|
|
9140
|
+
inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'g').replace(/punct/g, inline._punctuation).getRegex();
|
|
9100
9141
|
inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
|
|
9101
9142
|
inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
|
|
9102
9143
|
inline._email = /[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])?)+(?![-_])/;
|
|
9103
|
-
inline.autolink = edit
|
|
9144
|
+
inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
|
|
9104
9145
|
inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
|
|
9105
|
-
inline.tag = edit
|
|
9146
|
+
inline.tag = edit(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
|
|
9106
9147
|
inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
|
9107
|
-
inline._href = /<(
|
|
9148
|
+
inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
|
|
9108
9149
|
inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
|
|
9109
|
-
inline.link = edit
|
|
9110
|
-
inline.reflink = edit
|
|
9111
|
-
inline.
|
|
9150
|
+
inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
|
|
9151
|
+
inline.reflink = edit(inline.reflink).replace('label', inline._label).replace('ref', block._label).getRegex();
|
|
9152
|
+
inline.nolink = edit(inline.nolink).replace('ref', block._label).getRegex();
|
|
9153
|
+
inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
|
|
9154
|
+
|
|
9112
9155
|
/**
|
|
9113
9156
|
* Normal Inline Grammar
|
|
9114
9157
|
*/
|
|
9115
9158
|
|
|
9116
|
-
inline.normal =
|
|
9159
|
+
inline.normal = _extends({}, inline);
|
|
9160
|
+
|
|
9117
9161
|
/**
|
|
9118
9162
|
* Pedantic Inline Grammar
|
|
9119
9163
|
*/
|
|
9120
9164
|
|
|
9121
|
-
inline.pedantic =
|
|
9165
|
+
inline.pedantic = _extends({}, inline.normal, {
|
|
9122
9166
|
strong: {
|
|
9123
9167
|
start: /^__|\*\*/,
|
|
9124
9168
|
middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
|
|
@@ -9131,113 +9175,112 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
9131
9175
|
endAst: /\*(?!\*)/g,
|
|
9132
9176
|
endUnd: /_(?!_)/g
|
|
9133
9177
|
},
|
|
9134
|
-
link: edit
|
|
9135
|
-
reflink: edit
|
|
9178
|
+
link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
|
|
9179
|
+
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
|
|
9136
9180
|
});
|
|
9181
|
+
|
|
9137
9182
|
/**
|
|
9138
9183
|
* GFM Inline Grammar
|
|
9139
9184
|
*/
|
|
9140
9185
|
|
|
9141
|
-
inline.gfm =
|
|
9142
|
-
escape: edit
|
|
9186
|
+
inline.gfm = _extends({}, inline.normal, {
|
|
9187
|
+
escape: edit(inline.escape).replace('])', '~|])').getRegex(),
|
|
9143
9188
|
_extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
|
|
9144
9189
|
url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
|
|
9145
|
-
_backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
|
|
9146
|
-
del:
|
|
9147
|
-
text: /^(
|
|
9190
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
9191
|
+
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
|
9192
|
+
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
|
9148
9193
|
});
|
|
9149
|
-
inline.gfm.url = edit
|
|
9194
|
+
inline.gfm.url = edit(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
|
|
9150
9195
|
/**
|
|
9151
9196
|
* GFM + Line Breaks Inline Grammar
|
|
9152
9197
|
*/
|
|
9153
9198
|
|
|
9154
|
-
inline.breaks =
|
|
9155
|
-
br: edit
|
|
9156
|
-
text: edit
|
|
9199
|
+
inline.breaks = _extends({}, inline.gfm, {
|
|
9200
|
+
br: edit(inline.br).replace('{2,}', '*').getRegex(),
|
|
9201
|
+
text: edit(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
|
|
9157
9202
|
});
|
|
9158
|
-
var rules = {
|
|
9159
|
-
block: block,
|
|
9160
|
-
inline: inline
|
|
9161
|
-
};
|
|
9162
9203
|
|
|
9163
|
-
var defaults$2 = defaults.defaults;
|
|
9164
|
-
var block$1 = rules.block,
|
|
9165
|
-
inline$1 = rules.inline;
|
|
9166
9204
|
/**
|
|
9167
9205
|
* smartypants text replacement
|
|
9206
|
+
* @param {string} text
|
|
9168
9207
|
*/
|
|
9169
|
-
|
|
9170
9208
|
function smartypants(text) {
|
|
9171
|
-
return text
|
|
9172
|
-
|
|
9173
|
-
.replace(
|
|
9174
|
-
|
|
9175
|
-
.replace(
|
|
9176
|
-
|
|
9177
|
-
.replace(/"/g, "\
|
|
9209
|
+
return text
|
|
9210
|
+
// em-dashes
|
|
9211
|
+
.replace(/---/g, "\u2014")
|
|
9212
|
+
// en-dashes
|
|
9213
|
+
.replace(/--/g, "\u2013")
|
|
9214
|
+
// opening singles
|
|
9215
|
+
.replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018")
|
|
9216
|
+
// closing singles & apostrophes
|
|
9217
|
+
.replace(/'/g, "\u2019")
|
|
9218
|
+
// opening doubles
|
|
9219
|
+
.replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C")
|
|
9220
|
+
// closing doubles
|
|
9221
|
+
.replace(/"/g, "\u201D")
|
|
9222
|
+
// ellipses
|
|
9178
9223
|
.replace(/\.{3}/g, "\u2026");
|
|
9179
9224
|
}
|
|
9225
|
+
|
|
9180
9226
|
/**
|
|
9181
9227
|
* mangle email addresses
|
|
9228
|
+
* @param {string} text
|
|
9182
9229
|
*/
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
9230
|
function mangle(text) {
|
|
9186
9231
|
var out = '',
|
|
9187
|
-
|
|
9188
|
-
|
|
9232
|
+
i,
|
|
9233
|
+
ch;
|
|
9189
9234
|
var l = text.length;
|
|
9190
|
-
|
|
9191
9235
|
for (i = 0; i < l; i++) {
|
|
9192
9236
|
ch = text.charCodeAt(i);
|
|
9193
|
-
|
|
9194
9237
|
if (Math.random() > 0.5) {
|
|
9195
9238
|
ch = 'x' + ch.toString(16);
|
|
9196
9239
|
}
|
|
9197
|
-
|
|
9198
9240
|
out += '&#' + ch + ';';
|
|
9199
9241
|
}
|
|
9200
|
-
|
|
9201
9242
|
return out;
|
|
9202
9243
|
}
|
|
9244
|
+
|
|
9203
9245
|
/**
|
|
9204
9246
|
* Block Lexer
|
|
9205
9247
|
*/
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
var Lexer_1 = /*#__PURE__*/function () {
|
|
9248
|
+
var Lexer = /*#__PURE__*/function () {
|
|
9209
9249
|
function Lexer(options) {
|
|
9210
9250
|
this.tokens = [];
|
|
9211
9251
|
this.tokens.links = Object.create(null);
|
|
9212
|
-
this.options = options || defaults
|
|
9213
|
-
this.options.tokenizer = this.options.tokenizer || new
|
|
9252
|
+
this.options = options || exports.defaults;
|
|
9253
|
+
this.options.tokenizer = this.options.tokenizer || new Tokenizer();
|
|
9214
9254
|
this.tokenizer = this.options.tokenizer;
|
|
9215
9255
|
this.tokenizer.options = this.options;
|
|
9256
|
+
this.tokenizer.lexer = this;
|
|
9257
|
+
this.inlineQueue = [];
|
|
9258
|
+
this.state = {
|
|
9259
|
+
inLink: false,
|
|
9260
|
+
inRawBlock: false,
|
|
9261
|
+
top: true
|
|
9262
|
+
};
|
|
9216
9263
|
var rules = {
|
|
9217
|
-
block: block
|
|
9218
|
-
inline: inline
|
|
9264
|
+
block: block.normal,
|
|
9265
|
+
inline: inline.normal
|
|
9219
9266
|
};
|
|
9220
|
-
|
|
9221
9267
|
if (this.options.pedantic) {
|
|
9222
|
-
rules.block = block
|
|
9223
|
-
rules.inline = inline
|
|
9268
|
+
rules.block = block.pedantic;
|
|
9269
|
+
rules.inline = inline.pedantic;
|
|
9224
9270
|
} else if (this.options.gfm) {
|
|
9225
|
-
rules.block = block
|
|
9226
|
-
|
|
9271
|
+
rules.block = block.gfm;
|
|
9227
9272
|
if (this.options.breaks) {
|
|
9228
|
-
rules.inline = inline
|
|
9273
|
+
rules.inline = inline.breaks;
|
|
9229
9274
|
} else {
|
|
9230
|
-
rules.inline = inline
|
|
9275
|
+
rules.inline = inline.gfm;
|
|
9231
9276
|
}
|
|
9232
9277
|
}
|
|
9233
|
-
|
|
9234
9278
|
this.tokenizer.rules = rules;
|
|
9235
9279
|
}
|
|
9280
|
+
|
|
9236
9281
|
/**
|
|
9237
9282
|
* Expose Rules
|
|
9238
9283
|
*/
|
|
9239
|
-
|
|
9240
|
-
|
|
9241
9284
|
/**
|
|
9242
9285
|
* Static Lex Method
|
|
9243
9286
|
*/
|
|
@@ -9245,172 +9288,212 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
9245
9288
|
var lexer = new Lexer(options);
|
|
9246
9289
|
return lexer.lex(src);
|
|
9247
9290
|
}
|
|
9291
|
+
|
|
9248
9292
|
/**
|
|
9249
|
-
*
|
|
9250
|
-
|
|
9251
|
-
|
|
9293
|
+
* Static Lex Inline Method
|
|
9294
|
+
*/;
|
|
9295
|
+
Lexer.lexInline = function lexInline(src, options) {
|
|
9296
|
+
var lexer = new Lexer(options);
|
|
9297
|
+
return lexer.inlineTokens(src);
|
|
9298
|
+
}
|
|
9252
9299
|
|
|
9300
|
+
/**
|
|
9301
|
+
* Preprocessing
|
|
9302
|
+
*/;
|
|
9253
9303
|
var _proto = Lexer.prototype;
|
|
9254
|
-
|
|
9255
9304
|
_proto.lex = function lex(src) {
|
|
9256
|
-
src = src.replace(/\r\n|\r/g, '\n')
|
|
9257
|
-
this.blockTokens(src, this.tokens
|
|
9258
|
-
|
|
9305
|
+
src = src.replace(/\r\n|\r/g, '\n');
|
|
9306
|
+
this.blockTokens(src, this.tokens);
|
|
9307
|
+
var next;
|
|
9308
|
+
while (next = this.inlineQueue.shift()) {
|
|
9309
|
+
this.inlineTokens(next.src, next.tokens);
|
|
9310
|
+
}
|
|
9259
9311
|
return this.tokens;
|
|
9260
9312
|
}
|
|
9313
|
+
|
|
9261
9314
|
/**
|
|
9262
9315
|
* Lexing
|
|
9263
|
-
|
|
9264
|
-
|
|
9265
|
-
|
|
9266
|
-
_proto.blockTokens = function blockTokens(src, tokens, top) {
|
|
9316
|
+
*/;
|
|
9317
|
+
_proto.blockTokens = function blockTokens(src, tokens) {
|
|
9318
|
+
var _this = this;
|
|
9267
9319
|
if (tokens === void 0) {
|
|
9268
9320
|
tokens = [];
|
|
9269
9321
|
}
|
|
9270
|
-
|
|
9271
|
-
|
|
9272
|
-
|
|
9322
|
+
if (this.options.pedantic) {
|
|
9323
|
+
src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
|
|
9324
|
+
} else {
|
|
9325
|
+
src = src.replace(/^( *)(\t+)/gm, function (_, leading, tabs) {
|
|
9326
|
+
return leading + ' '.repeat(tabs.length);
|
|
9327
|
+
});
|
|
9273
9328
|
}
|
|
9274
|
-
|
|
9275
|
-
src = src.replace(/^ +$/gm, '');
|
|
9276
|
-
var token, i, l, lastToken;
|
|
9277
|
-
|
|
9329
|
+
var token, lastToken, cutSrc, lastParagraphClipped;
|
|
9278
9330
|
while (src) {
|
|
9331
|
+
if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(function (extTokenizer) {
|
|
9332
|
+
if (token = extTokenizer.call({
|
|
9333
|
+
lexer: _this
|
|
9334
|
+
}, src, tokens)) {
|
|
9335
|
+
src = src.substring(token.raw.length);
|
|
9336
|
+
tokens.push(token);
|
|
9337
|
+
return true;
|
|
9338
|
+
}
|
|
9339
|
+
return false;
|
|
9340
|
+
})) {
|
|
9341
|
+
continue;
|
|
9342
|
+
}
|
|
9343
|
+
|
|
9279
9344
|
// newline
|
|
9280
9345
|
if (token = this.tokenizer.space(src)) {
|
|
9281
9346
|
src = src.substring(token.raw.length);
|
|
9282
|
-
|
|
9283
|
-
|
|
9347
|
+
if (token.raw.length === 1 && tokens.length > 0) {
|
|
9348
|
+
// if there's a single \n as a spacer, it's terminating the last line,
|
|
9349
|
+
// so move it there so that we don't get unecessary paragraph tags
|
|
9350
|
+
tokens[tokens.length - 1].raw += '\n';
|
|
9351
|
+
} else {
|
|
9284
9352
|
tokens.push(token);
|
|
9285
9353
|
}
|
|
9286
|
-
|
|
9287
9354
|
continue;
|
|
9288
|
-
}
|
|
9289
|
-
|
|
9355
|
+
}
|
|
9290
9356
|
|
|
9291
|
-
|
|
9357
|
+
// code
|
|
9358
|
+
if (token = this.tokenizer.code(src)) {
|
|
9292
9359
|
src = src.substring(token.raw.length);
|
|
9293
|
-
|
|
9294
|
-
|
|
9295
|
-
|
|
9296
|
-
} else {
|
|
9297
|
-
lastToken = tokens[tokens.length - 1];
|
|
9360
|
+
lastToken = tokens[tokens.length - 1];
|
|
9361
|
+
// An indented code block cannot interrupt a paragraph.
|
|
9362
|
+
if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
|
9298
9363
|
lastToken.raw += '\n' + token.raw;
|
|
9299
9364
|
lastToken.text += '\n' + token.text;
|
|
9365
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
9366
|
+
} else {
|
|
9367
|
+
tokens.push(token);
|
|
9300
9368
|
}
|
|
9301
|
-
|
|
9302
9369
|
continue;
|
|
9303
|
-
}
|
|
9304
|
-
|
|
9370
|
+
}
|
|
9305
9371
|
|
|
9372
|
+
// fences
|
|
9306
9373
|
if (token = this.tokenizer.fences(src)) {
|
|
9307
9374
|
src = src.substring(token.raw.length);
|
|
9308
9375
|
tokens.push(token);
|
|
9309
9376
|
continue;
|
|
9310
|
-
}
|
|
9311
|
-
|
|
9377
|
+
}
|
|
9312
9378
|
|
|
9379
|
+
// heading
|
|
9313
9380
|
if (token = this.tokenizer.heading(src)) {
|
|
9314
9381
|
src = src.substring(token.raw.length);
|
|
9315
9382
|
tokens.push(token);
|
|
9316
9383
|
continue;
|
|
9317
|
-
}
|
|
9318
|
-
|
|
9319
|
-
|
|
9320
|
-
if (token = this.tokenizer.nptable(src)) {
|
|
9321
|
-
src = src.substring(token.raw.length);
|
|
9322
|
-
tokens.push(token);
|
|
9323
|
-
continue;
|
|
9324
|
-
} // hr
|
|
9325
|
-
|
|
9384
|
+
}
|
|
9326
9385
|
|
|
9386
|
+
// hr
|
|
9327
9387
|
if (token = this.tokenizer.hr(src)) {
|
|
9328
9388
|
src = src.substring(token.raw.length);
|
|
9329
9389
|
tokens.push(token);
|
|
9330
9390
|
continue;
|
|
9331
|
-
}
|
|
9332
|
-
|
|
9391
|
+
}
|
|
9333
9392
|
|
|
9393
|
+
// blockquote
|
|
9334
9394
|
if (token = this.tokenizer.blockquote(src)) {
|
|
9335
9395
|
src = src.substring(token.raw.length);
|
|
9336
|
-
token.tokens = this.blockTokens(token.text, [], top);
|
|
9337
9396
|
tokens.push(token);
|
|
9338
9397
|
continue;
|
|
9339
|
-
}
|
|
9340
|
-
|
|
9398
|
+
}
|
|
9341
9399
|
|
|
9400
|
+
// list
|
|
9342
9401
|
if (token = this.tokenizer.list(src)) {
|
|
9343
9402
|
src = src.substring(token.raw.length);
|
|
9344
|
-
l = token.items.length;
|
|
9345
|
-
|
|
9346
|
-
for (i = 0; i < l; i++) {
|
|
9347
|
-
token.items[i].tokens = this.blockTokens(token.items[i].text, [], false);
|
|
9348
|
-
}
|
|
9349
|
-
|
|
9350
9403
|
tokens.push(token);
|
|
9351
9404
|
continue;
|
|
9352
|
-
}
|
|
9353
|
-
|
|
9405
|
+
}
|
|
9354
9406
|
|
|
9407
|
+
// html
|
|
9355
9408
|
if (token = this.tokenizer.html(src)) {
|
|
9356
9409
|
src = src.substring(token.raw.length);
|
|
9357
9410
|
tokens.push(token);
|
|
9358
9411
|
continue;
|
|
9359
|
-
}
|
|
9360
|
-
|
|
9412
|
+
}
|
|
9361
9413
|
|
|
9362
|
-
|
|
9414
|
+
// def
|
|
9415
|
+
if (token = this.tokenizer.def(src)) {
|
|
9363
9416
|
src = src.substring(token.raw.length);
|
|
9364
|
-
|
|
9365
|
-
if (
|
|
9417
|
+
lastToken = tokens[tokens.length - 1];
|
|
9418
|
+
if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
|
9419
|
+
lastToken.raw += '\n' + token.raw;
|
|
9420
|
+
lastToken.text += '\n' + token.raw;
|
|
9421
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
9422
|
+
} else if (!this.tokens.links[token.tag]) {
|
|
9366
9423
|
this.tokens.links[token.tag] = {
|
|
9367
9424
|
href: token.href,
|
|
9368
9425
|
title: token.title
|
|
9369
9426
|
};
|
|
9370
9427
|
}
|
|
9371
|
-
|
|
9372
9428
|
continue;
|
|
9373
|
-
}
|
|
9374
|
-
|
|
9429
|
+
}
|
|
9375
9430
|
|
|
9431
|
+
// table (gfm)
|
|
9376
9432
|
if (token = this.tokenizer.table(src)) {
|
|
9377
9433
|
src = src.substring(token.raw.length);
|
|
9378
9434
|
tokens.push(token);
|
|
9379
9435
|
continue;
|
|
9380
|
-
}
|
|
9381
|
-
|
|
9436
|
+
}
|
|
9382
9437
|
|
|
9438
|
+
// lheading
|
|
9383
9439
|
if (token = this.tokenizer.lheading(src)) {
|
|
9384
9440
|
src = src.substring(token.raw.length);
|
|
9385
9441
|
tokens.push(token);
|
|
9386
9442
|
continue;
|
|
9387
|
-
}
|
|
9388
|
-
|
|
9443
|
+
}
|
|
9389
9444
|
|
|
9390
|
-
|
|
9445
|
+
// top-level paragraph
|
|
9446
|
+
// prevent paragraph consuming extensions by clipping 'src' to extension start
|
|
9447
|
+
cutSrc = src;
|
|
9448
|
+
if (this.options.extensions && this.options.extensions.startBlock) {
|
|
9449
|
+
(function () {
|
|
9450
|
+
var startIndex = Infinity;
|
|
9451
|
+
var tempSrc = src.slice(1);
|
|
9452
|
+
var tempStart = void 0;
|
|
9453
|
+
_this.options.extensions.startBlock.forEach(function (getStartIndex) {
|
|
9454
|
+
tempStart = getStartIndex.call({
|
|
9455
|
+
lexer: this
|
|
9456
|
+
}, tempSrc);
|
|
9457
|
+
if (typeof tempStart === 'number' && tempStart >= 0) {
|
|
9458
|
+
startIndex = Math.min(startIndex, tempStart);
|
|
9459
|
+
}
|
|
9460
|
+
});
|
|
9461
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
9462
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
9463
|
+
}
|
|
9464
|
+
})();
|
|
9465
|
+
}
|
|
9466
|
+
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
9467
|
+
lastToken = tokens[tokens.length - 1];
|
|
9468
|
+
if (lastParagraphClipped && lastToken.type === 'paragraph') {
|
|
9469
|
+
lastToken.raw += '\n' + token.raw;
|
|
9470
|
+
lastToken.text += '\n' + token.text;
|
|
9471
|
+
this.inlineQueue.pop();
|
|
9472
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
9473
|
+
} else {
|
|
9474
|
+
tokens.push(token);
|
|
9475
|
+
}
|
|
9476
|
+
lastParagraphClipped = cutSrc.length !== src.length;
|
|
9391
9477
|
src = src.substring(token.raw.length);
|
|
9392
|
-
tokens.push(token);
|
|
9393
9478
|
continue;
|
|
9394
|
-
}
|
|
9395
|
-
|
|
9479
|
+
}
|
|
9396
9480
|
|
|
9397
|
-
|
|
9481
|
+
// text
|
|
9482
|
+
if (token = this.tokenizer.text(src)) {
|
|
9398
9483
|
src = src.substring(token.raw.length);
|
|
9399
|
-
|
|
9400
|
-
if (
|
|
9401
|
-
tokens.push(token);
|
|
9402
|
-
} else {
|
|
9403
|
-
lastToken = tokens[tokens.length - 1];
|
|
9484
|
+
lastToken = tokens[tokens.length - 1];
|
|
9485
|
+
if (lastToken && lastToken.type === 'text') {
|
|
9404
9486
|
lastToken.raw += '\n' + token.raw;
|
|
9405
9487
|
lastToken.text += '\n' + token.text;
|
|
9488
|
+
this.inlineQueue.pop();
|
|
9489
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
9490
|
+
} else {
|
|
9491
|
+
tokens.push(token);
|
|
9406
9492
|
}
|
|
9407
|
-
|
|
9408
9493
|
continue;
|
|
9409
9494
|
}
|
|
9410
|
-
|
|
9411
9495
|
if (src) {
|
|
9412
9496
|
var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
|
9413
|
-
|
|
9414
9497
|
if (this.options.silent) {
|
|
9415
9498
|
console.error(errMsg);
|
|
9416
9499
|
break;
|
|
@@ -9419,226 +9502,197 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
9419
9502
|
}
|
|
9420
9503
|
}
|
|
9421
9504
|
}
|
|
9422
|
-
|
|
9505
|
+
this.state.top = true;
|
|
9423
9506
|
return tokens;
|
|
9424
9507
|
};
|
|
9508
|
+
_proto.inline = function inline(src, tokens) {
|
|
9509
|
+
if (tokens === void 0) {
|
|
9510
|
+
tokens = [];
|
|
9511
|
+
}
|
|
9512
|
+
this.inlineQueue.push({
|
|
9513
|
+
src: src,
|
|
9514
|
+
tokens: tokens
|
|
9515
|
+
});
|
|
9516
|
+
return tokens;
|
|
9517
|
+
}
|
|
9425
9518
|
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9519
|
+
/**
|
|
9520
|
+
* Lexing/Compiling
|
|
9521
|
+
*/;
|
|
9522
|
+
_proto.inlineTokens = function inlineTokens(src, tokens) {
|
|
9523
|
+
var _this2 = this;
|
|
9524
|
+
if (tokens === void 0) {
|
|
9525
|
+
tokens = [];
|
|
9526
|
+
}
|
|
9527
|
+
var token, lastToken, cutSrc;
|
|
9429
9528
|
|
|
9430
|
-
|
|
9431
|
-
|
|
9529
|
+
// String with links masked to avoid interference with em and strong
|
|
9530
|
+
var maskedSrc = src;
|
|
9531
|
+
var match;
|
|
9532
|
+
var keepPrevChar, prevChar;
|
|
9432
9533
|
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
break;
|
|
9441
|
-
}
|
|
9442
|
-
|
|
9443
|
-
case 'table':
|
|
9444
|
-
{
|
|
9445
|
-
token.tokens = {
|
|
9446
|
-
header: [],
|
|
9447
|
-
cells: []
|
|
9448
|
-
}; // header
|
|
9449
|
-
|
|
9450
|
-
l2 = token.header.length;
|
|
9451
|
-
|
|
9452
|
-
for (j = 0; j < l2; j++) {
|
|
9453
|
-
token.tokens.header[j] = [];
|
|
9454
|
-
this.inlineTokens(token.header[j], token.tokens.header[j]);
|
|
9455
|
-
} // cells
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
l2 = token.cells.length;
|
|
9459
|
-
|
|
9460
|
-
for (j = 0; j < l2; j++) {
|
|
9461
|
-
row = token.cells[j];
|
|
9462
|
-
token.tokens.cells[j] = [];
|
|
9463
|
-
|
|
9464
|
-
for (k = 0; k < row.length; k++) {
|
|
9465
|
-
token.tokens.cells[j][k] = [];
|
|
9466
|
-
this.inlineTokens(row[k], token.tokens.cells[j][k]);
|
|
9467
|
-
}
|
|
9468
|
-
}
|
|
9469
|
-
|
|
9470
|
-
break;
|
|
9471
|
-
}
|
|
9472
|
-
|
|
9473
|
-
case 'blockquote':
|
|
9474
|
-
{
|
|
9475
|
-
this.inline(token.tokens);
|
|
9476
|
-
break;
|
|
9477
|
-
}
|
|
9478
|
-
|
|
9479
|
-
case 'list':
|
|
9480
|
-
{
|
|
9481
|
-
l2 = token.items.length;
|
|
9482
|
-
|
|
9483
|
-
for (j = 0; j < l2; j++) {
|
|
9484
|
-
this.inline(token.items[j].tokens);
|
|
9485
|
-
}
|
|
9486
|
-
|
|
9487
|
-
break;
|
|
9534
|
+
// Mask out reflinks
|
|
9535
|
+
if (this.tokens.links) {
|
|
9536
|
+
var links = Object.keys(this.tokens.links);
|
|
9537
|
+
if (links.length > 0) {
|
|
9538
|
+
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
|
9539
|
+
if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
|
9540
|
+
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
9488
9541
|
}
|
|
9542
|
+
}
|
|
9489
9543
|
}
|
|
9490
9544
|
}
|
|
9491
|
-
|
|
9492
|
-
|
|
9493
|
-
|
|
9494
|
-
/**
|
|
9495
|
-
* Lexing/Compiling
|
|
9496
|
-
*/
|
|
9497
|
-
;
|
|
9498
|
-
|
|
9499
|
-
_proto.inlineTokens = function inlineTokens(src, tokens, inLink, inRawBlock, prevChar) {
|
|
9500
|
-
if (tokens === void 0) {
|
|
9501
|
-
tokens = [];
|
|
9502
|
-
}
|
|
9503
|
-
|
|
9504
|
-
if (inLink === void 0) {
|
|
9505
|
-
inLink = false;
|
|
9506
|
-
}
|
|
9507
|
-
|
|
9508
|
-
if (inRawBlock === void 0) {
|
|
9509
|
-
inRawBlock = false;
|
|
9545
|
+
// Mask out other blocks
|
|
9546
|
+
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
9547
|
+
maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
9510
9548
|
}
|
|
9511
9549
|
|
|
9512
|
-
|
|
9513
|
-
|
|
9550
|
+
// Mask out escaped em & strong delimiters
|
|
9551
|
+
while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
|
|
9552
|
+
maskedSrc = maskedSrc.slice(0, match.index + match[0].length - 2) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
|
|
9553
|
+
this.tokenizer.rules.inline.escapedEmSt.lastIndex--;
|
|
9514
9554
|
}
|
|
9555
|
+
while (src) {
|
|
9556
|
+
if (!keepPrevChar) {
|
|
9557
|
+
prevChar = '';
|
|
9558
|
+
}
|
|
9559
|
+
keepPrevChar = false;
|
|
9515
9560
|
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
|
|
9520
|
-
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
|
|
9524
|
-
if (links.length > 0) {
|
|
9525
|
-
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
|
9526
|
-
if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
|
|
9527
|
-
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
|
9528
|
-
}
|
|
9561
|
+
// extensions
|
|
9562
|
+
if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(function (extTokenizer) {
|
|
9563
|
+
if (token = extTokenizer.call({
|
|
9564
|
+
lexer: _this2
|
|
9565
|
+
}, src, tokens)) {
|
|
9566
|
+
src = src.substring(token.raw.length);
|
|
9567
|
+
tokens.push(token);
|
|
9568
|
+
return true;
|
|
9529
9569
|
}
|
|
9570
|
+
return false;
|
|
9571
|
+
})) {
|
|
9572
|
+
continue;
|
|
9530
9573
|
}
|
|
9531
|
-
} // Mask out other blocks
|
|
9532
|
-
|
|
9533
|
-
|
|
9534
|
-
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
|
9535
|
-
maskedSrc = maskedSrc.slice(0, match.index) + '[' + 'a'.repeat(match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
|
9536
|
-
}
|
|
9537
9574
|
|
|
9538
|
-
while (src) {
|
|
9539
9575
|
// escape
|
|
9540
9576
|
if (token = this.tokenizer.escape(src)) {
|
|
9541
9577
|
src = src.substring(token.raw.length);
|
|
9542
9578
|
tokens.push(token);
|
|
9543
9579
|
continue;
|
|
9544
|
-
}
|
|
9545
|
-
|
|
9580
|
+
}
|
|
9546
9581
|
|
|
9547
|
-
|
|
9582
|
+
// tag
|
|
9583
|
+
if (token = this.tokenizer.tag(src)) {
|
|
9548
9584
|
src = src.substring(token.raw.length);
|
|
9549
|
-
|
|
9550
|
-
|
|
9551
|
-
|
|
9585
|
+
lastToken = tokens[tokens.length - 1];
|
|
9586
|
+
if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
9587
|
+
lastToken.raw += token.raw;
|
|
9588
|
+
lastToken.text += token.text;
|
|
9589
|
+
} else {
|
|
9590
|
+
tokens.push(token);
|
|
9591
|
+
}
|
|
9552
9592
|
continue;
|
|
9553
|
-
}
|
|
9554
|
-
|
|
9593
|
+
}
|
|
9555
9594
|
|
|
9595
|
+
// link
|
|
9556
9596
|
if (token = this.tokenizer.link(src)) {
|
|
9557
9597
|
src = src.substring(token.raw.length);
|
|
9558
|
-
|
|
9559
|
-
if (token.type === 'link') {
|
|
9560
|
-
token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
|
|
9561
|
-
}
|
|
9562
|
-
|
|
9563
9598
|
tokens.push(token);
|
|
9564
9599
|
continue;
|
|
9565
|
-
}
|
|
9566
|
-
|
|
9600
|
+
}
|
|
9567
9601
|
|
|
9602
|
+
// reflink, nolink
|
|
9568
9603
|
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
9569
9604
|
src = src.substring(token.raw.length);
|
|
9570
|
-
|
|
9571
|
-
if (token.type === '
|
|
9572
|
-
|
|
9605
|
+
lastToken = tokens[tokens.length - 1];
|
|
9606
|
+
if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
9607
|
+
lastToken.raw += token.raw;
|
|
9608
|
+
lastToken.text += token.text;
|
|
9609
|
+
} else {
|
|
9610
|
+
tokens.push(token);
|
|
9573
9611
|
}
|
|
9574
|
-
|
|
9575
|
-
tokens.push(token);
|
|
9576
9612
|
continue;
|
|
9577
|
-
}
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
if (token = this.tokenizer.strong(src, maskedSrc, prevChar)) {
|
|
9581
|
-
src = src.substring(token.raw.length);
|
|
9582
|
-
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
|
|
9583
|
-
tokens.push(token);
|
|
9584
|
-
continue;
|
|
9585
|
-
} // em
|
|
9586
|
-
|
|
9613
|
+
}
|
|
9587
9614
|
|
|
9588
|
-
|
|
9615
|
+
// em & strong
|
|
9616
|
+
if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
9589
9617
|
src = src.substring(token.raw.length);
|
|
9590
|
-
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
|
|
9591
9618
|
tokens.push(token);
|
|
9592
9619
|
continue;
|
|
9593
|
-
}
|
|
9594
|
-
|
|
9620
|
+
}
|
|
9595
9621
|
|
|
9622
|
+
// code
|
|
9596
9623
|
if (token = this.tokenizer.codespan(src)) {
|
|
9597
9624
|
src = src.substring(token.raw.length);
|
|
9598
9625
|
tokens.push(token);
|
|
9599
9626
|
continue;
|
|
9600
|
-
}
|
|
9601
|
-
|
|
9627
|
+
}
|
|
9602
9628
|
|
|
9629
|
+
// br
|
|
9603
9630
|
if (token = this.tokenizer.br(src)) {
|
|
9604
9631
|
src = src.substring(token.raw.length);
|
|
9605
9632
|
tokens.push(token);
|
|
9606
9633
|
continue;
|
|
9607
|
-
}
|
|
9608
|
-
|
|
9634
|
+
}
|
|
9609
9635
|
|
|
9636
|
+
// del (gfm)
|
|
9610
9637
|
if (token = this.tokenizer.del(src)) {
|
|
9611
9638
|
src = src.substring(token.raw.length);
|
|
9612
|
-
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
|
|
9613
9639
|
tokens.push(token);
|
|
9614
9640
|
continue;
|
|
9615
|
-
}
|
|
9616
|
-
|
|
9641
|
+
}
|
|
9617
9642
|
|
|
9643
|
+
// autolink
|
|
9618
9644
|
if (token = this.tokenizer.autolink(src, mangle)) {
|
|
9619
9645
|
src = src.substring(token.raw.length);
|
|
9620
9646
|
tokens.push(token);
|
|
9621
9647
|
continue;
|
|
9622
|
-
}
|
|
9623
|
-
|
|
9648
|
+
}
|
|
9624
9649
|
|
|
9625
|
-
|
|
9650
|
+
// url (gfm)
|
|
9651
|
+
if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
|
|
9626
9652
|
src = src.substring(token.raw.length);
|
|
9627
9653
|
tokens.push(token);
|
|
9628
9654
|
continue;
|
|
9629
|
-
}
|
|
9630
|
-
|
|
9655
|
+
}
|
|
9631
9656
|
|
|
9632
|
-
|
|
9657
|
+
// text
|
|
9658
|
+
// prevent inlineText consuming extensions by clipping 'src' to extension start
|
|
9659
|
+
cutSrc = src;
|
|
9660
|
+
if (this.options.extensions && this.options.extensions.startInline) {
|
|
9661
|
+
(function () {
|
|
9662
|
+
var startIndex = Infinity;
|
|
9663
|
+
var tempSrc = src.slice(1);
|
|
9664
|
+
var tempStart = void 0;
|
|
9665
|
+
_this2.options.extensions.startInline.forEach(function (getStartIndex) {
|
|
9666
|
+
tempStart = getStartIndex.call({
|
|
9667
|
+
lexer: this
|
|
9668
|
+
}, tempSrc);
|
|
9669
|
+
if (typeof tempStart === 'number' && tempStart >= 0) {
|
|
9670
|
+
startIndex = Math.min(startIndex, tempStart);
|
|
9671
|
+
}
|
|
9672
|
+
});
|
|
9673
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
9674
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
9675
|
+
}
|
|
9676
|
+
})();
|
|
9677
|
+
}
|
|
9678
|
+
if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
|
|
9633
9679
|
src = src.substring(token.raw.length);
|
|
9634
|
-
|
|
9635
|
-
|
|
9680
|
+
if (token.raw.slice(-1) !== '_') {
|
|
9681
|
+
// Track prevChar before string of ____ started
|
|
9682
|
+
prevChar = token.raw.slice(-1);
|
|
9683
|
+
}
|
|
9684
|
+
keepPrevChar = true;
|
|
9685
|
+
lastToken = tokens[tokens.length - 1];
|
|
9686
|
+
if (lastToken && lastToken.type === 'text') {
|
|
9687
|
+
lastToken.raw += token.raw;
|
|
9688
|
+
lastToken.text += token.text;
|
|
9689
|
+
} else {
|
|
9690
|
+
tokens.push(token);
|
|
9691
|
+
}
|
|
9636
9692
|
continue;
|
|
9637
9693
|
}
|
|
9638
|
-
|
|
9639
9694
|
if (src) {
|
|
9640
9695
|
var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
|
|
9641
|
-
|
|
9642
9696
|
if (this.options.silent) {
|
|
9643
9697
|
console.error(errMsg);
|
|
9644
9698
|
break;
|
|
@@ -9647,169 +9701,186 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
9647
9701
|
}
|
|
9648
9702
|
}
|
|
9649
9703
|
}
|
|
9650
|
-
|
|
9651
9704
|
return tokens;
|
|
9652
9705
|
};
|
|
9653
|
-
|
|
9654
9706
|
_createClass(Lexer, null, [{
|
|
9655
9707
|
key: "rules",
|
|
9656
9708
|
get: function get() {
|
|
9657
9709
|
return {
|
|
9658
|
-
block: block
|
|
9659
|
-
inline: inline
|
|
9710
|
+
block: block,
|
|
9711
|
+
inline: inline
|
|
9660
9712
|
};
|
|
9661
9713
|
}
|
|
9662
9714
|
}]);
|
|
9663
|
-
|
|
9664
9715
|
return Lexer;
|
|
9665
9716
|
}();
|
|
9666
9717
|
|
|
9667
|
-
var defaults$3 = defaults.defaults;
|
|
9668
|
-
var cleanUrl$1 = helpers.cleanUrl,
|
|
9669
|
-
escape$1 = helpers.escape;
|
|
9670
9718
|
/**
|
|
9671
9719
|
* Renderer
|
|
9672
9720
|
*/
|
|
9673
|
-
|
|
9674
|
-
var Renderer_1 = /*#__PURE__*/function () {
|
|
9721
|
+
var Renderer = /*#__PURE__*/function () {
|
|
9675
9722
|
function Renderer(options) {
|
|
9676
|
-
this.options = options || defaults
|
|
9723
|
+
this.options = options || exports.defaults;
|
|
9677
9724
|
}
|
|
9678
|
-
|
|
9679
9725
|
var _proto = Renderer.prototype;
|
|
9680
|
-
|
|
9681
9726
|
_proto.code = function code(_code, infostring, escaped) {
|
|
9682
9727
|
var lang = (infostring || '').match(/\S*/)[0];
|
|
9683
|
-
|
|
9684
9728
|
if (this.options.highlight) {
|
|
9685
9729
|
var out = this.options.highlight(_code, lang);
|
|
9686
|
-
|
|
9687
9730
|
if (out != null && out !== _code) {
|
|
9688
9731
|
escaped = true;
|
|
9689
9732
|
_code = out;
|
|
9690
9733
|
}
|
|
9691
9734
|
}
|
|
9692
|
-
|
|
9735
|
+
_code = _code.replace(/\n$/, '') + '\n';
|
|
9693
9736
|
if (!lang) {
|
|
9694
|
-
return '<pre><code>' + (escaped ? _code : escape
|
|
9737
|
+
return '<pre><code>' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
|
|
9695
9738
|
}
|
|
9739
|
+
return '<pre><code class="' + this.options.langPrefix + escape(lang) + '">' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
|
|
9740
|
+
}
|
|
9696
9741
|
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9742
|
+
/**
|
|
9743
|
+
* @param {string} quote
|
|
9744
|
+
*/;
|
|
9700
9745
|
_proto.blockquote = function blockquote(quote) {
|
|
9701
|
-
return
|
|
9746
|
+
return "<blockquote>\n" + quote + "</blockquote>\n";
|
|
9702
9747
|
};
|
|
9703
|
-
|
|
9704
9748
|
_proto.html = function html(_html) {
|
|
9705
9749
|
return _html;
|
|
9706
|
-
}
|
|
9750
|
+
}
|
|
9707
9751
|
|
|
9752
|
+
/**
|
|
9753
|
+
* @param {string} text
|
|
9754
|
+
* @param {string} level
|
|
9755
|
+
* @param {string} raw
|
|
9756
|
+
* @param {any} slugger
|
|
9757
|
+
*/;
|
|
9708
9758
|
_proto.heading = function heading(text, level, raw, slugger) {
|
|
9709
9759
|
if (this.options.headerIds) {
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9760
|
+
var id = this.options.headerPrefix + slugger.slug(raw);
|
|
9761
|
+
return "<h" + level + " id=\"" + id + "\">" + text + "</h" + level + ">\n";
|
|
9762
|
+
}
|
|
9713
9763
|
|
|
9714
|
-
|
|
9764
|
+
// ignore IDs
|
|
9765
|
+
return "<h" + level + ">" + text + "</h" + level + ">\n";
|
|
9715
9766
|
};
|
|
9716
|
-
|
|
9717
9767
|
_proto.hr = function hr() {
|
|
9718
9768
|
return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
|
|
9719
9769
|
};
|
|
9720
|
-
|
|
9721
9770
|
_proto.list = function list(body, ordered, start) {
|
|
9722
9771
|
var type = ordered ? 'ol' : 'ul',
|
|
9723
|
-
|
|
9772
|
+
startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
|
|
9724
9773
|
return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
|
|
9725
|
-
}
|
|
9774
|
+
}
|
|
9726
9775
|
|
|
9776
|
+
/**
|
|
9777
|
+
* @param {string} text
|
|
9778
|
+
*/;
|
|
9727
9779
|
_proto.listitem = function listitem(text) {
|
|
9728
|
-
return
|
|
9780
|
+
return "<li>" + text + "</li>\n";
|
|
9729
9781
|
};
|
|
9730
|
-
|
|
9731
9782
|
_proto.checkbox = function checkbox(checked) {
|
|
9732
9783
|
return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
|
|
9733
|
-
}
|
|
9784
|
+
}
|
|
9734
9785
|
|
|
9786
|
+
/**
|
|
9787
|
+
* @param {string} text
|
|
9788
|
+
*/;
|
|
9735
9789
|
_proto.paragraph = function paragraph(text) {
|
|
9736
|
-
return
|
|
9737
|
-
}
|
|
9790
|
+
return "<p>" + text + "</p>\n";
|
|
9791
|
+
}
|
|
9738
9792
|
|
|
9793
|
+
/**
|
|
9794
|
+
* @param {string} header
|
|
9795
|
+
* @param {string} body
|
|
9796
|
+
*/;
|
|
9739
9797
|
_proto.table = function table(header, body) {
|
|
9740
|
-
if (body) body =
|
|
9798
|
+
if (body) body = "<tbody>" + body + "</tbody>";
|
|
9741
9799
|
return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
|
|
9742
|
-
}
|
|
9800
|
+
}
|
|
9743
9801
|
|
|
9802
|
+
/**
|
|
9803
|
+
* @param {string} content
|
|
9804
|
+
*/;
|
|
9744
9805
|
_proto.tablerow = function tablerow(content) {
|
|
9745
|
-
return
|
|
9806
|
+
return "<tr>\n" + content + "</tr>\n";
|
|
9746
9807
|
};
|
|
9747
|
-
|
|
9748
9808
|
_proto.tablecell = function tablecell(content, flags) {
|
|
9749
9809
|
var type = flags.header ? 'th' : 'td';
|
|
9750
|
-
var tag = flags.align ?
|
|
9751
|
-
return tag + content +
|
|
9752
|
-
}
|
|
9753
|
-
;
|
|
9810
|
+
var tag = flags.align ? "<" + type + " align=\"" + flags.align + "\">" : "<" + type + ">";
|
|
9811
|
+
return tag + content + ("</" + type + ">\n");
|
|
9812
|
+
}
|
|
9754
9813
|
|
|
9814
|
+
/**
|
|
9815
|
+
* span level renderer
|
|
9816
|
+
* @param {string} text
|
|
9817
|
+
*/;
|
|
9755
9818
|
_proto.strong = function strong(text) {
|
|
9756
|
-
return
|
|
9757
|
-
}
|
|
9819
|
+
return "<strong>" + text + "</strong>";
|
|
9820
|
+
}
|
|
9758
9821
|
|
|
9822
|
+
/**
|
|
9823
|
+
* @param {string} text
|
|
9824
|
+
*/;
|
|
9759
9825
|
_proto.em = function em(text) {
|
|
9760
|
-
return
|
|
9761
|
-
}
|
|
9826
|
+
return "<em>" + text + "</em>";
|
|
9827
|
+
}
|
|
9762
9828
|
|
|
9829
|
+
/**
|
|
9830
|
+
* @param {string} text
|
|
9831
|
+
*/;
|
|
9763
9832
|
_proto.codespan = function codespan(text) {
|
|
9764
|
-
return
|
|
9833
|
+
return "<code>" + text + "</code>";
|
|
9765
9834
|
};
|
|
9766
|
-
|
|
9767
9835
|
_proto.br = function br() {
|
|
9768
9836
|
return this.options.xhtml ? '<br/>' : '<br>';
|
|
9769
|
-
}
|
|
9837
|
+
}
|
|
9770
9838
|
|
|
9839
|
+
/**
|
|
9840
|
+
* @param {string} text
|
|
9841
|
+
*/;
|
|
9771
9842
|
_proto.del = function del(text) {
|
|
9772
|
-
return
|
|
9773
|
-
}
|
|
9843
|
+
return "<del>" + text + "</del>";
|
|
9844
|
+
}
|
|
9774
9845
|
|
|
9846
|
+
/**
|
|
9847
|
+
* @param {string} href
|
|
9848
|
+
* @param {string} title
|
|
9849
|
+
* @param {string} text
|
|
9850
|
+
*/;
|
|
9775
9851
|
_proto.link = function link(href, title, text) {
|
|
9776
|
-
href = cleanUrl
|
|
9777
|
-
|
|
9852
|
+
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
9778
9853
|
if (href === null) {
|
|
9779
9854
|
return text;
|
|
9780
9855
|
}
|
|
9781
|
-
|
|
9782
|
-
var out = '<a href="' + escape$1(href) + '"';
|
|
9783
|
-
|
|
9856
|
+
var out = '<a href="' + href + '"';
|
|
9784
9857
|
if (title) {
|
|
9785
9858
|
out += ' title="' + title + '"';
|
|
9786
9859
|
}
|
|
9787
|
-
|
|
9788
9860
|
out += '>' + text + '</a>';
|
|
9789
9861
|
return out;
|
|
9790
|
-
}
|
|
9862
|
+
}
|
|
9791
9863
|
|
|
9864
|
+
/**
|
|
9865
|
+
* @param {string} href
|
|
9866
|
+
* @param {string} title
|
|
9867
|
+
* @param {string} text
|
|
9868
|
+
*/;
|
|
9792
9869
|
_proto.image = function image(href, title, text) {
|
|
9793
|
-
href = cleanUrl
|
|
9794
|
-
|
|
9870
|
+
href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
|
|
9795
9871
|
if (href === null) {
|
|
9796
9872
|
return text;
|
|
9797
9873
|
}
|
|
9798
|
-
|
|
9799
|
-
var out = '<img src="' + href + '" alt="' + text + '"';
|
|
9800
|
-
|
|
9874
|
+
var out = "<img src=\"" + href + "\" alt=\"" + text + "\"";
|
|
9801
9875
|
if (title) {
|
|
9802
|
-
out +=
|
|
9876
|
+
out += " title=\"" + title + "\"";
|
|
9803
9877
|
}
|
|
9804
|
-
|
|
9805
9878
|
out += this.options.xhtml ? '/>' : '>';
|
|
9806
9879
|
return out;
|
|
9807
9880
|
};
|
|
9808
|
-
|
|
9809
9881
|
_proto.text = function text(_text) {
|
|
9810
9882
|
return _text;
|
|
9811
9883
|
};
|
|
9812
|
-
|
|
9813
9884
|
return Renderer;
|
|
9814
9885
|
}();
|
|
9815
9886
|
|
|
@@ -9817,214 +9888,226 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
9817
9888
|
* TextRenderer
|
|
9818
9889
|
* returns only the textual part of the token
|
|
9819
9890
|
*/
|
|
9820
|
-
var
|
|
9891
|
+
var TextRenderer = /*#__PURE__*/function () {
|
|
9821
9892
|
function TextRenderer() {}
|
|
9822
|
-
|
|
9823
9893
|
var _proto = TextRenderer.prototype;
|
|
9824
|
-
|
|
9825
9894
|
// no need for block level renderers
|
|
9826
9895
|
_proto.strong = function strong(text) {
|
|
9827
9896
|
return text;
|
|
9828
9897
|
};
|
|
9829
|
-
|
|
9830
9898
|
_proto.em = function em(text) {
|
|
9831
9899
|
return text;
|
|
9832
9900
|
};
|
|
9833
|
-
|
|
9834
9901
|
_proto.codespan = function codespan(text) {
|
|
9835
9902
|
return text;
|
|
9836
9903
|
};
|
|
9837
|
-
|
|
9838
9904
|
_proto.del = function del(text) {
|
|
9839
9905
|
return text;
|
|
9840
9906
|
};
|
|
9841
|
-
|
|
9842
9907
|
_proto.html = function html(text) {
|
|
9843
9908
|
return text;
|
|
9844
9909
|
};
|
|
9845
|
-
|
|
9846
9910
|
_proto.text = function text(_text) {
|
|
9847
9911
|
return _text;
|
|
9848
9912
|
};
|
|
9849
|
-
|
|
9850
9913
|
_proto.link = function link(href, title, text) {
|
|
9851
9914
|
return '' + text;
|
|
9852
9915
|
};
|
|
9853
|
-
|
|
9854
9916
|
_proto.image = function image(href, title, text) {
|
|
9855
9917
|
return '' + text;
|
|
9856
9918
|
};
|
|
9857
|
-
|
|
9858
9919
|
_proto.br = function br() {
|
|
9859
9920
|
return '';
|
|
9860
9921
|
};
|
|
9861
|
-
|
|
9862
9922
|
return TextRenderer;
|
|
9863
9923
|
}();
|
|
9864
9924
|
|
|
9865
9925
|
/**
|
|
9866
9926
|
* Slugger generates header id
|
|
9867
9927
|
*/
|
|
9868
|
-
var
|
|
9928
|
+
var Slugger = /*#__PURE__*/function () {
|
|
9869
9929
|
function Slugger() {
|
|
9870
9930
|
this.seen = {};
|
|
9871
9931
|
}
|
|
9932
|
+
|
|
9872
9933
|
/**
|
|
9873
|
-
*
|
|
9934
|
+
* @param {string} value
|
|
9874
9935
|
*/
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
9936
|
var _proto = Slugger.prototype;
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
.replace(/<[!\/a-z].*?>/ig, '')
|
|
9937
|
+
_proto.serialize = function serialize(value) {
|
|
9938
|
+
return value.toLowerCase().trim()
|
|
9939
|
+
// remove html tags
|
|
9940
|
+
.replace(/<[!\/a-z].*?>/ig, '')
|
|
9941
|
+
// remove unwanted chars
|
|
9882
9942
|
.replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
|
|
9943
|
+
}
|
|
9883
9944
|
|
|
9945
|
+
/**
|
|
9946
|
+
* Finds the next safe (unique) slug to use
|
|
9947
|
+
* @param {string} originalSlug
|
|
9948
|
+
* @param {boolean} isDryRun
|
|
9949
|
+
*/;
|
|
9950
|
+
_proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
|
|
9951
|
+
var slug = originalSlug;
|
|
9952
|
+
var occurenceAccumulator = 0;
|
|
9884
9953
|
if (this.seen.hasOwnProperty(slug)) {
|
|
9885
|
-
|
|
9886
|
-
|
|
9954
|
+
occurenceAccumulator = this.seen[originalSlug];
|
|
9887
9955
|
do {
|
|
9888
|
-
|
|
9889
|
-
slug = originalSlug + '-' +
|
|
9956
|
+
occurenceAccumulator++;
|
|
9957
|
+
slug = originalSlug + '-' + occurenceAccumulator;
|
|
9890
9958
|
} while (this.seen.hasOwnProperty(slug));
|
|
9891
9959
|
}
|
|
9892
|
-
|
|
9893
|
-
|
|
9960
|
+
if (!isDryRun) {
|
|
9961
|
+
this.seen[originalSlug] = occurenceAccumulator;
|
|
9962
|
+
this.seen[slug] = 0;
|
|
9963
|
+
}
|
|
9894
9964
|
return slug;
|
|
9895
|
-
}
|
|
9965
|
+
}
|
|
9896
9966
|
|
|
9967
|
+
/**
|
|
9968
|
+
* Convert string to unique id
|
|
9969
|
+
* @param {object} [options]
|
|
9970
|
+
* @param {boolean} [options.dryrun] Generates the next unique slug without
|
|
9971
|
+
* updating the internal accumulator.
|
|
9972
|
+
*/;
|
|
9973
|
+
_proto.slug = function slug(value, options) {
|
|
9974
|
+
if (options === void 0) {
|
|
9975
|
+
options = {};
|
|
9976
|
+
}
|
|
9977
|
+
var slug = this.serialize(value);
|
|
9978
|
+
return this.getNextSafeSlug(slug, options.dryrun);
|
|
9979
|
+
};
|
|
9897
9980
|
return Slugger;
|
|
9898
9981
|
}();
|
|
9899
9982
|
|
|
9900
|
-
var defaults$4 = defaults.defaults;
|
|
9901
|
-
var unescape$1 = helpers.unescape;
|
|
9902
9983
|
/**
|
|
9903
9984
|
* Parsing & Compiling
|
|
9904
9985
|
*/
|
|
9905
|
-
|
|
9906
|
-
var Parser_1 = /*#__PURE__*/function () {
|
|
9986
|
+
var Parser = /*#__PURE__*/function () {
|
|
9907
9987
|
function Parser(options) {
|
|
9908
|
-
this.options = options || defaults
|
|
9909
|
-
this.options.renderer = this.options.renderer || new
|
|
9988
|
+
this.options = options || exports.defaults;
|
|
9989
|
+
this.options.renderer = this.options.renderer || new Renderer();
|
|
9910
9990
|
this.renderer = this.options.renderer;
|
|
9911
9991
|
this.renderer.options = this.options;
|
|
9912
|
-
this.textRenderer = new
|
|
9913
|
-
this.slugger = new
|
|
9992
|
+
this.textRenderer = new TextRenderer();
|
|
9993
|
+
this.slugger = new Slugger();
|
|
9914
9994
|
}
|
|
9995
|
+
|
|
9915
9996
|
/**
|
|
9916
9997
|
* Static Parse Method
|
|
9917
9998
|
*/
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
9999
|
Parser.parse = function parse(tokens, options) {
|
|
9921
10000
|
var parser = new Parser(options);
|
|
9922
10001
|
return parser.parse(tokens);
|
|
9923
10002
|
}
|
|
10003
|
+
|
|
9924
10004
|
/**
|
|
9925
|
-
* Parse
|
|
9926
|
-
|
|
9927
|
-
|
|
10005
|
+
* Static Parse Inline Method
|
|
10006
|
+
*/;
|
|
10007
|
+
Parser.parseInline = function parseInline(tokens, options) {
|
|
10008
|
+
var parser = new Parser(options);
|
|
10009
|
+
return parser.parseInline(tokens);
|
|
10010
|
+
}
|
|
9928
10011
|
|
|
10012
|
+
/**
|
|
10013
|
+
* Parse Loop
|
|
10014
|
+
*/;
|
|
9929
10015
|
var _proto = Parser.prototype;
|
|
9930
|
-
|
|
9931
10016
|
_proto.parse = function parse(tokens, top) {
|
|
9932
10017
|
if (top === void 0) {
|
|
9933
10018
|
top = true;
|
|
9934
10019
|
}
|
|
9935
|
-
|
|
9936
10020
|
var out = '',
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
|
|
9948
|
-
|
|
9949
|
-
|
|
9950
|
-
|
|
9951
|
-
|
|
9952
|
-
|
|
9953
|
-
|
|
9954
|
-
|
|
10021
|
+
i,
|
|
10022
|
+
j,
|
|
10023
|
+
k,
|
|
10024
|
+
l2,
|
|
10025
|
+
l3,
|
|
10026
|
+
row,
|
|
10027
|
+
cell,
|
|
10028
|
+
header,
|
|
10029
|
+
body,
|
|
10030
|
+
token,
|
|
10031
|
+
ordered,
|
|
10032
|
+
start,
|
|
10033
|
+
loose,
|
|
10034
|
+
itemBody,
|
|
10035
|
+
item,
|
|
10036
|
+
checked,
|
|
10037
|
+
task,
|
|
10038
|
+
checkbox,
|
|
10039
|
+
ret;
|
|
9955
10040
|
var l = tokens.length;
|
|
9956
|
-
|
|
9957
10041
|
for (i = 0; i < l; i++) {
|
|
9958
10042
|
token = tokens[i];
|
|
9959
10043
|
|
|
10044
|
+
// Run any renderer extensions
|
|
10045
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
|
10046
|
+
ret = this.options.extensions.renderers[token.type].call({
|
|
10047
|
+
parser: this
|
|
10048
|
+
}, token);
|
|
10049
|
+
if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
|
|
10050
|
+
out += ret || '';
|
|
10051
|
+
continue;
|
|
10052
|
+
}
|
|
10053
|
+
}
|
|
9960
10054
|
switch (token.type) {
|
|
9961
10055
|
case 'space':
|
|
9962
10056
|
{
|
|
9963
10057
|
continue;
|
|
9964
10058
|
}
|
|
9965
|
-
|
|
9966
10059
|
case 'hr':
|
|
9967
10060
|
{
|
|
9968
10061
|
out += this.renderer.hr();
|
|
9969
10062
|
continue;
|
|
9970
10063
|
}
|
|
9971
|
-
|
|
9972
10064
|
case 'heading':
|
|
9973
10065
|
{
|
|
9974
|
-
out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape
|
|
10066
|
+
out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
|
|
9975
10067
|
continue;
|
|
9976
10068
|
}
|
|
9977
|
-
|
|
9978
10069
|
case 'code':
|
|
9979
10070
|
{
|
|
9980
10071
|
out += this.renderer.code(token.text, token.lang, token.escaped);
|
|
9981
10072
|
continue;
|
|
9982
10073
|
}
|
|
9983
|
-
|
|
9984
10074
|
case 'table':
|
|
9985
10075
|
{
|
|
9986
|
-
header = '';
|
|
10076
|
+
header = '';
|
|
9987
10077
|
|
|
10078
|
+
// header
|
|
9988
10079
|
cell = '';
|
|
9989
10080
|
l2 = token.header.length;
|
|
9990
|
-
|
|
9991
10081
|
for (j = 0; j < l2; j++) {
|
|
9992
|
-
cell += this.renderer.tablecell(this.parseInline(token.
|
|
10082
|
+
cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), {
|
|
9993
10083
|
header: true,
|
|
9994
10084
|
align: token.align[j]
|
|
9995
10085
|
});
|
|
9996
10086
|
}
|
|
9997
|
-
|
|
9998
10087
|
header += this.renderer.tablerow(cell);
|
|
9999
10088
|
body = '';
|
|
10000
|
-
l2 = token.
|
|
10001
|
-
|
|
10089
|
+
l2 = token.rows.length;
|
|
10002
10090
|
for (j = 0; j < l2; j++) {
|
|
10003
|
-
row = token.
|
|
10091
|
+
row = token.rows[j];
|
|
10004
10092
|
cell = '';
|
|
10005
10093
|
l3 = row.length;
|
|
10006
|
-
|
|
10007
10094
|
for (k = 0; k < l3; k++) {
|
|
10008
|
-
cell += this.renderer.tablecell(this.parseInline(row[k]), {
|
|
10095
|
+
cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
|
|
10009
10096
|
header: false,
|
|
10010
10097
|
align: token.align[k]
|
|
10011
10098
|
});
|
|
10012
10099
|
}
|
|
10013
|
-
|
|
10014
10100
|
body += this.renderer.tablerow(cell);
|
|
10015
10101
|
}
|
|
10016
|
-
|
|
10017
10102
|
out += this.renderer.table(header, body);
|
|
10018
10103
|
continue;
|
|
10019
10104
|
}
|
|
10020
|
-
|
|
10021
10105
|
case 'blockquote':
|
|
10022
10106
|
{
|
|
10023
10107
|
body = this.parse(token.tokens);
|
|
10024
10108
|
out += this.renderer.blockquote(body);
|
|
10025
10109
|
continue;
|
|
10026
10110
|
}
|
|
10027
|
-
|
|
10028
10111
|
case 'list':
|
|
10029
10112
|
{
|
|
10030
10113
|
ordered = token.ordered;
|
|
@@ -10032,20 +10115,16 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
10032
10115
|
loose = token.loose;
|
|
10033
10116
|
l2 = token.items.length;
|
|
10034
10117
|
body = '';
|
|
10035
|
-
|
|
10036
10118
|
for (j = 0; j < l2; j++) {
|
|
10037
10119
|
item = token.items[j];
|
|
10038
10120
|
checked = item.checked;
|
|
10039
10121
|
task = item.task;
|
|
10040
10122
|
itemBody = '';
|
|
10041
|
-
|
|
10042
10123
|
if (item.task) {
|
|
10043
10124
|
checkbox = this.renderer.checkbox(checked);
|
|
10044
|
-
|
|
10045
10125
|
if (loose) {
|
|
10046
|
-
if (item.tokens.length > 0 && item.tokens[0].type === '
|
|
10126
|
+
if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
|
|
10047
10127
|
item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
|
|
10048
|
-
|
|
10049
10128
|
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
|
|
10050
10129
|
item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
|
|
10051
10130
|
}
|
|
@@ -10059,45 +10138,36 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
10059
10138
|
itemBody += checkbox;
|
|
10060
10139
|
}
|
|
10061
10140
|
}
|
|
10062
|
-
|
|
10063
10141
|
itemBody += this.parse(item.tokens, loose);
|
|
10064
10142
|
body += this.renderer.listitem(itemBody, task, checked);
|
|
10065
10143
|
}
|
|
10066
|
-
|
|
10067
10144
|
out += this.renderer.list(body, ordered, start);
|
|
10068
10145
|
continue;
|
|
10069
10146
|
}
|
|
10070
|
-
|
|
10071
10147
|
case 'html':
|
|
10072
10148
|
{
|
|
10073
10149
|
// TODO parse inline content if parameter markdown=1
|
|
10074
10150
|
out += this.renderer.html(token.text);
|
|
10075
10151
|
continue;
|
|
10076
10152
|
}
|
|
10077
|
-
|
|
10078
10153
|
case 'paragraph':
|
|
10079
10154
|
{
|
|
10080
10155
|
out += this.renderer.paragraph(this.parseInline(token.tokens));
|
|
10081
10156
|
continue;
|
|
10082
10157
|
}
|
|
10083
|
-
|
|
10084
10158
|
case 'text':
|
|
10085
10159
|
{
|
|
10086
10160
|
body = token.tokens ? this.parseInline(token.tokens) : token.text;
|
|
10087
|
-
|
|
10088
10161
|
while (i + 1 < l && tokens[i + 1].type === 'text') {
|
|
10089
10162
|
token = tokens[++i];
|
|
10090
10163
|
body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
|
|
10091
10164
|
}
|
|
10092
|
-
|
|
10093
10165
|
out += top ? this.renderer.paragraph(body) : body;
|
|
10094
10166
|
continue;
|
|
10095
10167
|
}
|
|
10096
|
-
|
|
10097
10168
|
default:
|
|
10098
10169
|
{
|
|
10099
10170
|
var errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
10100
|
-
|
|
10101
10171
|
if (this.options.silent) {
|
|
10102
10172
|
console.error(errMsg);
|
|
10103
10173
|
return;
|
|
@@ -10107,89 +10177,86 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
10107
10177
|
}
|
|
10108
10178
|
}
|
|
10109
10179
|
}
|
|
10110
|
-
|
|
10111
10180
|
return out;
|
|
10112
10181
|
}
|
|
10182
|
+
|
|
10113
10183
|
/**
|
|
10114
10184
|
* Parse Inline Tokens
|
|
10115
|
-
|
|
10116
|
-
;
|
|
10117
|
-
|
|
10185
|
+
*/;
|
|
10118
10186
|
_proto.parseInline = function parseInline(tokens, renderer) {
|
|
10119
10187
|
renderer = renderer || this.renderer;
|
|
10120
10188
|
var out = '',
|
|
10121
|
-
|
|
10122
|
-
|
|
10189
|
+
i,
|
|
10190
|
+
token,
|
|
10191
|
+
ret;
|
|
10123
10192
|
var l = tokens.length;
|
|
10124
|
-
|
|
10125
10193
|
for (i = 0; i < l; i++) {
|
|
10126
10194
|
token = tokens[i];
|
|
10127
10195
|
|
|
10196
|
+
// Run any renderer extensions
|
|
10197
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
|
10198
|
+
ret = this.options.extensions.renderers[token.type].call({
|
|
10199
|
+
parser: this
|
|
10200
|
+
}, token);
|
|
10201
|
+
if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
|
|
10202
|
+
out += ret || '';
|
|
10203
|
+
continue;
|
|
10204
|
+
}
|
|
10205
|
+
}
|
|
10128
10206
|
switch (token.type) {
|
|
10129
10207
|
case 'escape':
|
|
10130
10208
|
{
|
|
10131
10209
|
out += renderer.text(token.text);
|
|
10132
10210
|
break;
|
|
10133
10211
|
}
|
|
10134
|
-
|
|
10135
10212
|
case 'html':
|
|
10136
10213
|
{
|
|
10137
10214
|
out += renderer.html(token.text);
|
|
10138
10215
|
break;
|
|
10139
10216
|
}
|
|
10140
|
-
|
|
10141
10217
|
case 'link':
|
|
10142
10218
|
{
|
|
10143
10219
|
out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
|
|
10144
10220
|
break;
|
|
10145
10221
|
}
|
|
10146
|
-
|
|
10147
10222
|
case 'image':
|
|
10148
10223
|
{
|
|
10149
10224
|
out += renderer.image(token.href, token.title, token.text);
|
|
10150
10225
|
break;
|
|
10151
10226
|
}
|
|
10152
|
-
|
|
10153
10227
|
case 'strong':
|
|
10154
10228
|
{
|
|
10155
10229
|
out += renderer.strong(this.parseInline(token.tokens, renderer));
|
|
10156
10230
|
break;
|
|
10157
10231
|
}
|
|
10158
|
-
|
|
10159
10232
|
case 'em':
|
|
10160
10233
|
{
|
|
10161
10234
|
out += renderer.em(this.parseInline(token.tokens, renderer));
|
|
10162
10235
|
break;
|
|
10163
10236
|
}
|
|
10164
|
-
|
|
10165
10237
|
case 'codespan':
|
|
10166
10238
|
{
|
|
10167
10239
|
out += renderer.codespan(token.text);
|
|
10168
10240
|
break;
|
|
10169
10241
|
}
|
|
10170
|
-
|
|
10171
10242
|
case 'br':
|
|
10172
10243
|
{
|
|
10173
10244
|
out += renderer.br();
|
|
10174
10245
|
break;
|
|
10175
10246
|
}
|
|
10176
|
-
|
|
10177
10247
|
case 'del':
|
|
10178
10248
|
{
|
|
10179
10249
|
out += renderer.del(this.parseInline(token.tokens, renderer));
|
|
10180
10250
|
break;
|
|
10181
10251
|
}
|
|
10182
|
-
|
|
10183
10252
|
case 'text':
|
|
10184
10253
|
{
|
|
10185
10254
|
out += renderer.text(token.text);
|
|
10186
10255
|
break;
|
|
10187
10256
|
}
|
|
10188
|
-
|
|
10189
10257
|
default:
|
|
10190
10258
|
{
|
|
10191
10259
|
var errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
10192
|
-
|
|
10193
10260
|
if (this.options.silent) {
|
|
10194
10261
|
console.error(errMsg);
|
|
10195
10262
|
return;
|
|
@@ -10199,280 +10266,464 @@ var marked = _commonjsHelpers.createCommonjsModule(function (module, exports) {
|
|
|
10199
10266
|
}
|
|
10200
10267
|
}
|
|
10201
10268
|
}
|
|
10202
|
-
|
|
10203
10269
|
return out;
|
|
10204
10270
|
};
|
|
10205
|
-
|
|
10206
10271
|
return Parser;
|
|
10207
10272
|
}();
|
|
10208
10273
|
|
|
10209
|
-
var
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
var getDefaults = defaults.getDefaults,
|
|
10213
|
-
changeDefaults = defaults.changeDefaults,
|
|
10214
|
-
defaults$5 = defaults.defaults;
|
|
10215
|
-
/**
|
|
10216
|
-
* Marked
|
|
10217
|
-
*/
|
|
10218
|
-
|
|
10219
|
-
function marked(src, opt, callback) {
|
|
10220
|
-
// throw error in case of non string input
|
|
10221
|
-
if (typeof src === 'undefined' || src === null) {
|
|
10222
|
-
throw new Error('marked(): input parameter is undefined or null');
|
|
10274
|
+
var Hooks = /*#__PURE__*/function () {
|
|
10275
|
+
function Hooks(options) {
|
|
10276
|
+
this.options = options || exports.defaults;
|
|
10223
10277
|
}
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
callback = opt;
|
|
10231
|
-
opt = null;
|
|
10278
|
+
var _proto = Hooks.prototype;
|
|
10279
|
+
/**
|
|
10280
|
+
* Process markdown before marked
|
|
10281
|
+
*/
|
|
10282
|
+
_proto.preprocess = function preprocess(markdown) {
|
|
10283
|
+
return markdown;
|
|
10232
10284
|
}
|
|
10233
10285
|
|
|
10234
|
-
|
|
10235
|
-
|
|
10236
|
-
|
|
10237
|
-
|
|
10238
|
-
|
|
10239
|
-
|
|
10286
|
+
/**
|
|
10287
|
+
* Process HTML after marked is finished
|
|
10288
|
+
*/;
|
|
10289
|
+
_proto.postprocess = function postprocess(html) {
|
|
10290
|
+
return html;
|
|
10291
|
+
};
|
|
10292
|
+
return Hooks;
|
|
10293
|
+
}();
|
|
10294
|
+
Hooks.passThroughHooks = new Set(['preprocess', 'postprocess']);
|
|
10240
10295
|
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10296
|
+
function onError(silent, async, callback) {
|
|
10297
|
+
return function (e) {
|
|
10298
|
+
e.message += '\nPlease report this to https://github.com/markedjs/marked.';
|
|
10299
|
+
if (silent) {
|
|
10300
|
+
var msg = '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
|
|
10301
|
+
if (async) {
|
|
10302
|
+
return Promise.resolve(msg);
|
|
10303
|
+
}
|
|
10304
|
+
if (callback) {
|
|
10305
|
+
callback(null, msg);
|
|
10306
|
+
return;
|
|
10307
|
+
}
|
|
10308
|
+
return msg;
|
|
10245
10309
|
}
|
|
10310
|
+
if (async) {
|
|
10311
|
+
return Promise.reject(e);
|
|
10312
|
+
}
|
|
10313
|
+
if (callback) {
|
|
10314
|
+
callback(e);
|
|
10315
|
+
return;
|
|
10316
|
+
}
|
|
10317
|
+
throw e;
|
|
10318
|
+
};
|
|
10319
|
+
}
|
|
10320
|
+
function parseMarkdown(lexer, parser) {
|
|
10321
|
+
return function (src, opt, callback) {
|
|
10322
|
+
if (typeof opt === 'function') {
|
|
10323
|
+
callback = opt;
|
|
10324
|
+
opt = null;
|
|
10325
|
+
}
|
|
10326
|
+
var origOpt = _extends({}, opt);
|
|
10327
|
+
opt = _extends({}, marked.defaults, origOpt);
|
|
10328
|
+
var throwError = onError(opt.silent, opt.async, callback);
|
|
10246
10329
|
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10330
|
+
// throw error in case of non string input
|
|
10331
|
+
if (typeof src === 'undefined' || src === null) {
|
|
10332
|
+
return throwError(new Error('marked(): input parameter is undefined or null'));
|
|
10333
|
+
}
|
|
10334
|
+
if (typeof src !== 'string') {
|
|
10335
|
+
return throwError(new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected'));
|
|
10336
|
+
}
|
|
10337
|
+
checkSanitizeDeprecation(opt);
|
|
10338
|
+
if (opt.hooks) {
|
|
10339
|
+
opt.hooks.options = opt;
|
|
10340
|
+
}
|
|
10341
|
+
if (callback) {
|
|
10342
|
+
var highlight = opt.highlight;
|
|
10343
|
+
var tokens;
|
|
10344
|
+
try {
|
|
10345
|
+
if (opt.hooks) {
|
|
10346
|
+
src = opt.hooks.preprocess(src);
|
|
10255
10347
|
}
|
|
10348
|
+
tokens = lexer(src, opt);
|
|
10349
|
+
} catch (e) {
|
|
10350
|
+
return throwError(e);
|
|
10256
10351
|
}
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
return done();
|
|
10264
|
-
}
|
|
10265
|
-
|
|
10266
|
-
delete opt.highlight;
|
|
10267
|
-
if (!tokens.length) return done();
|
|
10268
|
-
var pending = 0;
|
|
10269
|
-
marked.walkTokens(tokens, function (token) {
|
|
10270
|
-
if (token.type === 'code') {
|
|
10271
|
-
pending++;
|
|
10272
|
-
setTimeout(function () {
|
|
10273
|
-
highlight(token.text, token.lang, function (err, code) {
|
|
10274
|
-
if (err) {
|
|
10275
|
-
return done(err);
|
|
10276
|
-
}
|
|
10277
|
-
|
|
10278
|
-
if (code != null && code !== token.text) {
|
|
10279
|
-
token.text = code;
|
|
10280
|
-
token.escaped = true;
|
|
10352
|
+
var done = function done(err) {
|
|
10353
|
+
var out;
|
|
10354
|
+
if (!err) {
|
|
10355
|
+
try {
|
|
10356
|
+
if (opt.walkTokens) {
|
|
10357
|
+
marked.walkTokens(tokens, opt.walkTokens);
|
|
10281
10358
|
}
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10285
|
-
if (pending === 0) {
|
|
10286
|
-
done();
|
|
10359
|
+
out = parser(tokens, opt);
|
|
10360
|
+
if (opt.hooks) {
|
|
10361
|
+
out = opt.hooks.postprocess(out);
|
|
10287
10362
|
}
|
|
10288
|
-
})
|
|
10289
|
-
|
|
10363
|
+
} catch (e) {
|
|
10364
|
+
err = e;
|
|
10365
|
+
}
|
|
10366
|
+
}
|
|
10367
|
+
opt.highlight = highlight;
|
|
10368
|
+
return err ? throwError(err) : callback(null, out);
|
|
10369
|
+
};
|
|
10370
|
+
if (!highlight || highlight.length < 3) {
|
|
10371
|
+
return done();
|
|
10372
|
+
}
|
|
10373
|
+
delete opt.highlight;
|
|
10374
|
+
if (!tokens.length) return done();
|
|
10375
|
+
var pending = 0;
|
|
10376
|
+
marked.walkTokens(tokens, function (token) {
|
|
10377
|
+
if (token.type === 'code') {
|
|
10378
|
+
pending++;
|
|
10379
|
+
setTimeout(function () {
|
|
10380
|
+
highlight(token.text, token.lang, function (err, code) {
|
|
10381
|
+
if (err) {
|
|
10382
|
+
return done(err);
|
|
10383
|
+
}
|
|
10384
|
+
if (code != null && code !== token.text) {
|
|
10385
|
+
token.text = code;
|
|
10386
|
+
token.escaped = true;
|
|
10387
|
+
}
|
|
10388
|
+
pending--;
|
|
10389
|
+
if (pending === 0) {
|
|
10390
|
+
done();
|
|
10391
|
+
}
|
|
10392
|
+
});
|
|
10393
|
+
}, 0);
|
|
10394
|
+
}
|
|
10395
|
+
});
|
|
10396
|
+
if (pending === 0) {
|
|
10397
|
+
done();
|
|
10290
10398
|
}
|
|
10291
|
-
|
|
10292
|
-
|
|
10293
|
-
if (pending === 0) {
|
|
10294
|
-
done();
|
|
10399
|
+
return;
|
|
10295
10400
|
}
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10401
|
+
if (opt.async) {
|
|
10402
|
+
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then(function (src) {
|
|
10403
|
+
return lexer(src, opt);
|
|
10404
|
+
}).then(function (tokens) {
|
|
10405
|
+
return opt.walkTokens ? Promise.all(marked.walkTokens(tokens, opt.walkTokens)).then(function () {
|
|
10406
|
+
return tokens;
|
|
10407
|
+
}) : tokens;
|
|
10408
|
+
}).then(function (tokens) {
|
|
10409
|
+
return parser(tokens, opt);
|
|
10410
|
+
}).then(function (html) {
|
|
10411
|
+
return opt.hooks ? opt.hooks.postprocess(html) : html;
|
|
10412
|
+
})["catch"](throwError);
|
|
10305
10413
|
}
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10414
|
+
try {
|
|
10415
|
+
if (opt.hooks) {
|
|
10416
|
+
src = opt.hooks.preprocess(src);
|
|
10417
|
+
}
|
|
10418
|
+
var _tokens = lexer(src, opt);
|
|
10419
|
+
if (opt.walkTokens) {
|
|
10420
|
+
marked.walkTokens(_tokens, opt.walkTokens);
|
|
10421
|
+
}
|
|
10422
|
+
var html = parser(_tokens, opt);
|
|
10423
|
+
if (opt.hooks) {
|
|
10424
|
+
html = opt.hooks.postprocess(html);
|
|
10425
|
+
}
|
|
10426
|
+
return html;
|
|
10427
|
+
} catch (e) {
|
|
10428
|
+
return throwError(e);
|
|
10313
10429
|
}
|
|
10430
|
+
};
|
|
10431
|
+
}
|
|
10314
10432
|
|
|
10315
|
-
|
|
10316
|
-
|
|
10433
|
+
/**
|
|
10434
|
+
* Marked
|
|
10435
|
+
*/
|
|
10436
|
+
function marked(src, opt, callback) {
|
|
10437
|
+
return parseMarkdown(Lexer.lex, Parser.parse)(src, opt, callback);
|
|
10317
10438
|
}
|
|
10439
|
+
|
|
10318
10440
|
/**
|
|
10319
10441
|
* Options
|
|
10320
10442
|
*/
|
|
10321
10443
|
|
|
10322
|
-
|
|
10323
10444
|
marked.options = marked.setOptions = function (opt) {
|
|
10324
|
-
|
|
10445
|
+
marked.defaults = _extends({}, marked.defaults, opt);
|
|
10325
10446
|
changeDefaults(marked.defaults);
|
|
10326
10447
|
return marked;
|
|
10327
10448
|
};
|
|
10328
|
-
|
|
10329
10449
|
marked.getDefaults = getDefaults;
|
|
10330
|
-
marked.defaults = defaults
|
|
10450
|
+
marked.defaults = exports.defaults;
|
|
10451
|
+
|
|
10331
10452
|
/**
|
|
10332
10453
|
* Use Extension
|
|
10333
10454
|
*/
|
|
10334
10455
|
|
|
10335
|
-
marked.use = function (
|
|
10336
|
-
var
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10456
|
+
marked.use = function () {
|
|
10457
|
+
var extensions = marked.defaults.extensions || {
|
|
10458
|
+
renderers: {},
|
|
10459
|
+
childTokens: {}
|
|
10460
|
+
};
|
|
10461
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
10462
|
+
args[_key] = arguments[_key];
|
|
10463
|
+
}
|
|
10464
|
+
args.forEach(function (pack) {
|
|
10465
|
+
// copy options to new object
|
|
10466
|
+
var opts = _extends({}, pack);
|
|
10341
10467
|
|
|
10342
|
-
|
|
10343
|
-
|
|
10468
|
+
// set async to true if it was set to true before
|
|
10469
|
+
opts.async = marked.defaults.async || opts.async || false;
|
|
10344
10470
|
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10471
|
+
// ==-- Parse "addon" extensions --== //
|
|
10472
|
+
if (pack.extensions) {
|
|
10473
|
+
pack.extensions.forEach(function (ext) {
|
|
10474
|
+
if (!ext.name) {
|
|
10475
|
+
throw new Error('extension name required');
|
|
10476
|
+
}
|
|
10477
|
+
if (ext.renderer) {
|
|
10478
|
+
// Renderer extensions
|
|
10479
|
+
var prevRenderer = extensions.renderers[ext.name];
|
|
10480
|
+
if (prevRenderer) {
|
|
10481
|
+
// Replace extension with func to run new extension but fall back if false
|
|
10482
|
+
extensions.renderers[ext.name] = function () {
|
|
10483
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
10484
|
+
args[_key2] = arguments[_key2];
|
|
10485
|
+
}
|
|
10486
|
+
var ret = ext.renderer.apply(this, args);
|
|
10487
|
+
if (ret === false) {
|
|
10488
|
+
ret = prevRenderer.apply(this, args);
|
|
10489
|
+
}
|
|
10490
|
+
return ret;
|
|
10491
|
+
};
|
|
10492
|
+
} else {
|
|
10493
|
+
extensions.renderers[ext.name] = ext.renderer;
|
|
10348
10494
|
}
|
|
10349
|
-
|
|
10350
|
-
|
|
10351
|
-
|
|
10352
|
-
if (
|
|
10353
|
-
|
|
10495
|
+
}
|
|
10496
|
+
if (ext.tokenizer) {
|
|
10497
|
+
// Tokenizer Extensions
|
|
10498
|
+
if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
|
|
10499
|
+
throw new Error("extension level must be 'block' or 'inline'");
|
|
10354
10500
|
}
|
|
10355
|
-
|
|
10356
|
-
|
|
10357
|
-
|
|
10358
|
-
|
|
10359
|
-
|
|
10360
|
-
for (var prop in extension.renderer) {
|
|
10361
|
-
_loop(prop);
|
|
10362
|
-
}
|
|
10363
|
-
|
|
10364
|
-
opts.renderer = renderer;
|
|
10365
|
-
})();
|
|
10366
|
-
}
|
|
10367
|
-
|
|
10368
|
-
if (extension.tokenizer) {
|
|
10369
|
-
(function () {
|
|
10370
|
-
var tokenizer = marked.defaults.tokenizer || new Tokenizer_1();
|
|
10371
|
-
|
|
10372
|
-
var _loop2 = function _loop2(prop) {
|
|
10373
|
-
var prevTokenizer = tokenizer[prop];
|
|
10374
|
-
|
|
10375
|
-
tokenizer[prop] = function () {
|
|
10376
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
10377
|
-
args[_key2] = arguments[_key2];
|
|
10501
|
+
if (extensions[ext.level]) {
|
|
10502
|
+
extensions[ext.level].unshift(ext.tokenizer);
|
|
10503
|
+
} else {
|
|
10504
|
+
extensions[ext.level] = [ext.tokenizer];
|
|
10378
10505
|
}
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10506
|
+
if (ext.start) {
|
|
10507
|
+
// Function to check for start of token
|
|
10508
|
+
if (ext.level === 'block') {
|
|
10509
|
+
if (extensions.startBlock) {
|
|
10510
|
+
extensions.startBlock.push(ext.start);
|
|
10511
|
+
} else {
|
|
10512
|
+
extensions.startBlock = [ext.start];
|
|
10513
|
+
}
|
|
10514
|
+
} else if (ext.level === 'inline') {
|
|
10515
|
+
if (extensions.startInline) {
|
|
10516
|
+
extensions.startInline.push(ext.start);
|
|
10517
|
+
} else {
|
|
10518
|
+
extensions.startInline = [ext.start];
|
|
10519
|
+
}
|
|
10520
|
+
}
|
|
10384
10521
|
}
|
|
10522
|
+
}
|
|
10523
|
+
if (ext.childTokens) {
|
|
10524
|
+
// Child tokens to be visited by walkTokens
|
|
10525
|
+
extensions.childTokens[ext.name] = ext.childTokens;
|
|
10526
|
+
}
|
|
10527
|
+
});
|
|
10528
|
+
opts.extensions = extensions;
|
|
10529
|
+
}
|
|
10385
10530
|
|
|
10386
|
-
|
|
10531
|
+
// ==-- Parse "overwrite" extensions --== //
|
|
10532
|
+
if (pack.renderer) {
|
|
10533
|
+
(function () {
|
|
10534
|
+
var renderer = marked.defaults.renderer || new Renderer();
|
|
10535
|
+
var _loop = function _loop(prop) {
|
|
10536
|
+
var prevRenderer = renderer[prop];
|
|
10537
|
+
// Replace renderer with func to run extension, but fall back if false
|
|
10538
|
+
renderer[prop] = function () {
|
|
10539
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
10540
|
+
args[_key3] = arguments[_key3];
|
|
10541
|
+
}
|
|
10542
|
+
var ret = pack.renderer[prop].apply(renderer, args);
|
|
10543
|
+
if (ret === false) {
|
|
10544
|
+
ret = prevRenderer.apply(renderer, args);
|
|
10545
|
+
}
|
|
10546
|
+
return ret;
|
|
10547
|
+
};
|
|
10387
10548
|
};
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10392
|
-
}
|
|
10393
|
-
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10549
|
+
for (var prop in pack.renderer) {
|
|
10550
|
+
_loop(prop);
|
|
10551
|
+
}
|
|
10552
|
+
opts.renderer = renderer;
|
|
10553
|
+
})();
|
|
10554
|
+
}
|
|
10555
|
+
if (pack.tokenizer) {
|
|
10556
|
+
(function () {
|
|
10557
|
+
var tokenizer = marked.defaults.tokenizer || new Tokenizer();
|
|
10558
|
+
var _loop2 = function _loop2(prop) {
|
|
10559
|
+
var prevTokenizer = tokenizer[prop];
|
|
10560
|
+
// Replace tokenizer with func to run extension, but fall back if false
|
|
10561
|
+
tokenizer[prop] = function () {
|
|
10562
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
10563
|
+
args[_key4] = arguments[_key4];
|
|
10564
|
+
}
|
|
10565
|
+
var ret = pack.tokenizer[prop].apply(tokenizer, args);
|
|
10566
|
+
if (ret === false) {
|
|
10567
|
+
ret = prevTokenizer.apply(tokenizer, args);
|
|
10568
|
+
}
|
|
10569
|
+
return ret;
|
|
10570
|
+
};
|
|
10571
|
+
};
|
|
10572
|
+
for (var prop in pack.tokenizer) {
|
|
10573
|
+
_loop2(prop);
|
|
10574
|
+
}
|
|
10575
|
+
opts.tokenizer = tokenizer;
|
|
10576
|
+
})();
|
|
10577
|
+
}
|
|
10403
10578
|
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10579
|
+
// ==-- Parse Hooks extensions --== //
|
|
10580
|
+
if (pack.hooks) {
|
|
10581
|
+
(function () {
|
|
10582
|
+
var hooks = marked.defaults.hooks || new Hooks();
|
|
10583
|
+
var _loop3 = function _loop3(prop) {
|
|
10584
|
+
var prevHook = hooks[prop];
|
|
10585
|
+
if (Hooks.passThroughHooks.has(prop)) {
|
|
10586
|
+
hooks[prop] = function (arg) {
|
|
10587
|
+
if (marked.defaults.async) {
|
|
10588
|
+
return Promise.resolve(pack.hooks[prop].call(hooks, arg)).then(function (ret) {
|
|
10589
|
+
return prevHook.call(hooks, ret);
|
|
10590
|
+
});
|
|
10591
|
+
}
|
|
10592
|
+
var ret = pack.hooks[prop].call(hooks, arg);
|
|
10593
|
+
return prevHook.call(hooks, ret);
|
|
10594
|
+
};
|
|
10595
|
+
} else {
|
|
10596
|
+
hooks[prop] = function () {
|
|
10597
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
10598
|
+
args[_key5] = arguments[_key5];
|
|
10599
|
+
}
|
|
10600
|
+
var ret = pack.hooks[prop].apply(hooks, args);
|
|
10601
|
+
if (ret === false) {
|
|
10602
|
+
ret = prevHook.apply(hooks, args);
|
|
10603
|
+
}
|
|
10604
|
+
return ret;
|
|
10605
|
+
};
|
|
10606
|
+
}
|
|
10607
|
+
};
|
|
10608
|
+
for (var prop in pack.hooks) {
|
|
10609
|
+
_loop3(prop);
|
|
10610
|
+
}
|
|
10611
|
+
opts.hooks = hooks;
|
|
10612
|
+
})();
|
|
10613
|
+
}
|
|
10409
10614
|
|
|
10410
|
-
|
|
10615
|
+
// ==-- Parse WalkTokens extensions --== //
|
|
10616
|
+
if (pack.walkTokens) {
|
|
10617
|
+
var _walkTokens = marked.defaults.walkTokens;
|
|
10618
|
+
opts.walkTokens = function (token) {
|
|
10619
|
+
var values = [];
|
|
10620
|
+
values.push(pack.walkTokens.call(this, token));
|
|
10621
|
+
if (_walkTokens) {
|
|
10622
|
+
values = values.concat(_walkTokens.call(this, token));
|
|
10623
|
+
}
|
|
10624
|
+
return values;
|
|
10625
|
+
};
|
|
10626
|
+
}
|
|
10627
|
+
marked.setOptions(opts);
|
|
10628
|
+
});
|
|
10411
10629
|
};
|
|
10630
|
+
|
|
10412
10631
|
/**
|
|
10413
10632
|
* Run callback for every token
|
|
10414
10633
|
*/
|
|
10415
10634
|
|
|
10416
|
-
|
|
10417
10635
|
marked.walkTokens = function (tokens, callback) {
|
|
10418
|
-
|
|
10636
|
+
var values = [];
|
|
10637
|
+
var _loop4 = function _loop4() {
|
|
10419
10638
|
var token = _step.value;
|
|
10420
|
-
callback(token);
|
|
10421
|
-
|
|
10639
|
+
values = values.concat(callback.call(marked, token));
|
|
10422
10640
|
switch (token.type) {
|
|
10423
10641
|
case 'table':
|
|
10424
10642
|
{
|
|
10425
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(token.
|
|
10643
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(token.header), _step2; !(_step2 = _iterator2()).done;) {
|
|
10426
10644
|
var cell = _step2.value;
|
|
10427
|
-
marked.walkTokens(cell, callback);
|
|
10645
|
+
values = values.concat(marked.walkTokens(cell.tokens, callback));
|
|
10428
10646
|
}
|
|
10429
|
-
|
|
10430
|
-
for (var _iterator3 = _createForOfIteratorHelperLoose(token.tokens.cells), _step3; !(_step3 = _iterator3()).done;) {
|
|
10647
|
+
for (var _iterator3 = _createForOfIteratorHelperLoose(token.rows), _step3; !(_step3 = _iterator3()).done;) {
|
|
10431
10648
|
var row = _step3.value;
|
|
10432
|
-
|
|
10433
10649
|
for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
|
|
10434
10650
|
var _cell = _step4.value;
|
|
10435
|
-
marked.walkTokens(_cell, callback);
|
|
10651
|
+
values = values.concat(marked.walkTokens(_cell.tokens, callback));
|
|
10436
10652
|
}
|
|
10437
10653
|
}
|
|
10438
|
-
|
|
10439
10654
|
break;
|
|
10440
10655
|
}
|
|
10441
|
-
|
|
10442
10656
|
case 'list':
|
|
10443
10657
|
{
|
|
10444
|
-
marked.walkTokens(token.items, callback);
|
|
10658
|
+
values = values.concat(marked.walkTokens(token.items, callback));
|
|
10445
10659
|
break;
|
|
10446
10660
|
}
|
|
10447
|
-
|
|
10448
10661
|
default:
|
|
10449
10662
|
{
|
|
10450
|
-
if (token.
|
|
10451
|
-
|
|
10663
|
+
if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
|
|
10664
|
+
// Walk any extensions
|
|
10665
|
+
marked.defaults.extensions.childTokens[token.type].forEach(function (childTokens) {
|
|
10666
|
+
values = values.concat(marked.walkTokens(token[childTokens], callback));
|
|
10667
|
+
});
|
|
10668
|
+
} else if (token.tokens) {
|
|
10669
|
+
values = values.concat(marked.walkTokens(token.tokens, callback));
|
|
10452
10670
|
}
|
|
10453
10671
|
}
|
|
10454
10672
|
}
|
|
10673
|
+
};
|
|
10674
|
+
for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
|
|
10675
|
+
_loop4();
|
|
10455
10676
|
}
|
|
10677
|
+
return values;
|
|
10456
10678
|
};
|
|
10679
|
+
|
|
10457
10680
|
/**
|
|
10458
|
-
*
|
|
10681
|
+
* Parse Inline
|
|
10682
|
+
* @param {string} src
|
|
10459
10683
|
*/
|
|
10684
|
+
marked.parseInline = parseMarkdown(Lexer.lexInline, Parser.parseInline);
|
|
10460
10685
|
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
marked.
|
|
10465
|
-
marked.
|
|
10466
|
-
marked.
|
|
10467
|
-
marked.
|
|
10468
|
-
marked.
|
|
10469
|
-
marked.
|
|
10686
|
+
/**
|
|
10687
|
+
* Expose
|
|
10688
|
+
*/
|
|
10689
|
+
marked.Parser = Parser;
|
|
10690
|
+
marked.parser = Parser.parse;
|
|
10691
|
+
marked.Renderer = Renderer;
|
|
10692
|
+
marked.TextRenderer = TextRenderer;
|
|
10693
|
+
marked.Lexer = Lexer;
|
|
10694
|
+
marked.lexer = Lexer.lex;
|
|
10695
|
+
marked.Tokenizer = Tokenizer;
|
|
10696
|
+
marked.Slugger = Slugger;
|
|
10697
|
+
marked.Hooks = Hooks;
|
|
10470
10698
|
marked.parse = marked;
|
|
10471
|
-
var
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10699
|
+
var options = marked.options;
|
|
10700
|
+
var setOptions = marked.setOptions;
|
|
10701
|
+
var use = marked.use;
|
|
10702
|
+
var walkTokens = marked.walkTokens;
|
|
10703
|
+
var parseInline = marked.parseInline;
|
|
10704
|
+
var parse = marked;
|
|
10705
|
+
var parser = Parser.parse;
|
|
10706
|
+
var lexer = Lexer.lex;
|
|
10707
|
+
|
|
10708
|
+
exports.Hooks = Hooks;
|
|
10709
|
+
exports.Lexer = Lexer;
|
|
10710
|
+
exports.Parser = Parser;
|
|
10711
|
+
exports.Renderer = Renderer;
|
|
10712
|
+
exports.Slugger = Slugger;
|
|
10713
|
+
exports.TextRenderer = TextRenderer;
|
|
10714
|
+
exports.Tokenizer = Tokenizer;
|
|
10715
|
+
exports.getDefaults = getDefaults;
|
|
10716
|
+
exports.lexer = lexer;
|
|
10717
|
+
exports.marked = marked;
|
|
10718
|
+
exports.options = options;
|
|
10719
|
+
exports.parse = parse;
|
|
10720
|
+
exports.parseInline = parseInline;
|
|
10721
|
+
exports.parser = parser;
|
|
10722
|
+
exports.setOptions = setOptions;
|
|
10723
|
+
exports.use = use;
|
|
10724
|
+
exports.walkTokens = walkTokens;
|
|
10725
|
+
|
|
10726
|
+
}));
|
|
10476
10727
|
});
|
|
10477
10728
|
|
|
10478
10729
|
const textComponentCss = "sqh-text-component{display:block}sqh-text-component p{margin:0}";
|
|
@@ -10482,7 +10733,6 @@ const TextComponent = class {
|
|
|
10482
10733
|
index.registerInstance(this, hostRef);
|
|
10483
10734
|
}
|
|
10484
10735
|
render() {
|
|
10485
|
-
const regex = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;
|
|
10486
10736
|
const textStyle = css `
|
|
10487
10737
|
font-family: ${this.fontfamily || "inherit"};
|
|
10488
10738
|
font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
|
|
@@ -10497,14 +10747,14 @@ const TextComponent = class {
|
|
|
10497
10747
|
`;
|
|
10498
10748
|
const divStyle = css `
|
|
10499
10749
|
background: ${this.background
|
|
10500
|
-
? this.background
|
|
10750
|
+
? isUrl(this.background)
|
|
10501
10751
|
? `url(${this.background}) no-repeat center center;`
|
|
10502
10752
|
: this.background
|
|
10503
10753
|
: "inherit"};
|
|
10504
10754
|
height: ${this.height || "inherit"};
|
|
10505
10755
|
background-size: contain;
|
|
10506
10756
|
`;
|
|
10507
|
-
const content = this.ismarkdown ? (index.h("div", { innerHTML: marked(this.text) })) : (this.text);
|
|
10757
|
+
const content = this.ismarkdown ? (index.h("div", { innerHTML: marked_umd.marked.parse(this.text) })) : (this.text);
|
|
10508
10758
|
return (!this.ishidden && (index.h("div", { class: divStyle }, index.h("p", { class: textStyle }, content))));
|
|
10509
10759
|
}
|
|
10510
10760
|
get textEl() { return index.getElement(this); }
|