@clevertask/scribe 0.1.25 → 0.1.26
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/{BarMenu-CP5BJhc-.js → BarMenu-BGWT4Oyk.js} +1 -1
- package/dist/assets/index.css +1 -1
- package/dist/components/Menu/BarMenu.js +1 -1
- package/dist/components/Menu/BubbleMenu.js +2 -2
- package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
- package/dist/components/Menu/LinkBubbleMenu.js +2 -2
- package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
- package/dist/components/Menu/TableBubbleMenu.js +2 -2
- package/dist/components/Scribe/extension/emoji/suggest.js +2 -2
- package/dist/components/Scribe/extension/extension-markdown-paste.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +2 -2
- package/dist/components/Scribe/index.js +4 -4
- package/dist/{dist-Cwbl2Okw.js → dist-BiognBi4.js} +2 -1
- package/dist/{extension-9Oc-QD39.js → extension-BFPlsViw.js} +1 -1
- package/dist/{html-to-markdown-CKpceHDk.js → html-to-markdown-BpR-7GtJ.js} +1 -1
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-zj2j0HLf.js → markdown-to-html-BoK5O_j-.js} +183 -143
- package/dist/{menus-B0uyLVhs.js → menus-BDXjZsFU.js} +1 -1
- package/dist/{purify.es-CpMrJENN.js → purify.es-q6CUdJQi.js} +251 -190
- package/dist/{schema-extensions-LzyMpyWW.js → schema-extensions-BryyErmk.js} +2 -2
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{tippy.esm-8vSV0zL7.js → tippy.esm-MjWnmeEn.js} +0 -3
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +11 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { normalizeExternalLinkPreviewsInTree as e } from "./components/Scribe/extension/external-link-preview/serialization.js";
|
|
2
|
-
import { t } from "./purify.es-
|
|
3
|
-
//#region node_modules/.pnpm/marked@18.0.
|
|
2
|
+
import { t } from "./purify.es-q6CUdJQi.js";
|
|
3
|
+
//#region node_modules/.pnpm/marked@18.0.14/node_modules/marked/lib/marked.esm.js
|
|
4
4
|
function n() {
|
|
5
5
|
return {
|
|
6
6
|
async: !1,
|
|
@@ -44,7 +44,7 @@ var c = ((e = "") => {
|
|
|
44
44
|
return !1;
|
|
45
45
|
}
|
|
46
46
|
})(), l = {
|
|
47
|
-
codeRemoveIndent: /^(?: {
|
|
47
|
+
codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm,
|
|
48
48
|
outputLinkReplace: /\\([\[\]])/g,
|
|
49
49
|
indentCodeCompensation: /^(\s+)(?:```)/,
|
|
50
50
|
beginningSpace: /^\s+/,
|
|
@@ -55,6 +55,7 @@ var c = ((e = "") => {
|
|
|
55
55
|
nonSpaceChar: /[^ ]/,
|
|
56
56
|
newLineCharGlobal: /\n/g,
|
|
57
57
|
tabCharGlobal: /\t/g,
|
|
58
|
+
leadingSpaceTab: /^[ \t]+/,
|
|
58
59
|
multipleSpaceGlobal: /\s+/g,
|
|
59
60
|
blankLine: /^[ \t]*$/,
|
|
60
61
|
doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
|
|
@@ -81,6 +82,7 @@ var c = ((e = "") => {
|
|
|
81
82
|
endAngleBracket: />$/,
|
|
82
83
|
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
83
84
|
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
85
|
+
numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,
|
|
84
86
|
escapeTest: /[&<>"']/,
|
|
85
87
|
escapeReplace: /[&<>"']/g,
|
|
86
88
|
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
@@ -96,13 +98,13 @@ var c = ((e = "") => {
|
|
|
96
98
|
endingNewline: /\n$/,
|
|
97
99
|
listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),
|
|
98
100
|
nextBulletRegex: o((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),
|
|
99
|
-
hrRegex: o((e) => RegExp(`^ {0,${e}}((?:-
|
|
101
|
+
hrRegex: o((e) => RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),
|
|
100
102
|
fencesBeginRegex: o((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
|
|
101
103
|
headingBeginRegex: o((e) => RegExp(`^ {0,${e}}#`)),
|
|
102
|
-
htmlBeginRegex: o((e) => RegExp(`^ {0,${e}}
|
|
104
|
+
htmlBeginRegex: o((e) => RegExp(`^ {0,${e}}(?:</?(?:${b})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")),
|
|
103
105
|
blockquoteBeginRegex: o((e) => RegExp(`^ {0,${e}}>`))
|
|
104
|
-
}, u = /^(?:[ \t]*(?:\n|$))+/, d = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, f = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, p = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, m = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, h = / {0,3}(?:[*+-]|\d{1,9}[.)])/, g = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |
|
|
105
|
-
blockquote: s(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",
|
|
106
|
+
}, u = /^(?:[ \t]*(?:\n|$))+/, d = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, f = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, p = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, m = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, h = / {0,3}(?:[*+-]|\d{1,9}[.)])/, g = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, _ = s(g).replace(/bull/g, h).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), ee = s(g).replace(/bull/g, h).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), v = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, te = /^[^\n]+/, y = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, ne = s(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", y).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), re = s(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, h).getRegex(), b = "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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", x = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ie = s("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", x).replace("tag", b).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), S = (e) => s(v).replace("hr", p).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", b).getRegex(), ae = S(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), oe = S(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), C = {
|
|
107
|
+
blockquote: s(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", oe).getRegex(),
|
|
106
108
|
code: d,
|
|
107
109
|
def: ne,
|
|
108
110
|
fences: f,
|
|
@@ -112,88 +114,94 @@ var c = ((e = "") => {
|
|
|
112
114
|
lheading: _,
|
|
113
115
|
list: re,
|
|
114
116
|
newline: u,
|
|
115
|
-
paragraph:
|
|
117
|
+
paragraph: ae,
|
|
116
118
|
table: a,
|
|
117
119
|
text: te
|
|
118
|
-
},
|
|
119
|
-
...
|
|
120
|
+
}, w = s("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", p).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", b).getRegex(), se = {
|
|
121
|
+
...C,
|
|
120
122
|
lheading: ee,
|
|
121
|
-
table:
|
|
122
|
-
paragraph: s(v).replace("hr", p).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table",
|
|
123
|
-
},
|
|
124
|
-
...
|
|
123
|
+
table: w,
|
|
124
|
+
paragraph: s(v).replace("hr", p).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", w).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", b).getRegex()
|
|
125
|
+
}, ce = {
|
|
126
|
+
...C,
|
|
125
127
|
html: s("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", x).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(),
|
|
126
128
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
127
129
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
128
130
|
fences: a,
|
|
129
131
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
130
132
|
paragraph: s(v).replace("hr", p).replace("heading", " *#{1,6} *[^\n]").replace("lheading", _).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
131
|
-
},
|
|
133
|
+
}, le = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ue = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, T = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, de = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, E = /[\p{P}\p{S}]/u, D = /[\s\p{P}\p{S}]/u, O = /[^\s\p{P}\p{S}]/u, fe = s(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, D).getRegex(), pe = /[\p{Pi}\p{Ps}"']/u, k = /(?!~)[\p{P}\p{S}]/u, me = /(?!~)[\s\p{P}\p{S}]/u, he = /(?:[^\s\p{P}\p{S}]|~)/u, ge = s(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", c ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), A = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, _e = s(A, "u").replace(/punct/g, E).getRegex(), ve = s(A, "u").replace(/punct/g, k).getRegex(), ye = s(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, pe).replace(/punct/g, E).getRegex(), j = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", be = s(j, "gu").replace(/notPunctSpace/g, O).replace(/punctSpace/g, D).replace(/punct/g, E).getRegex(), xe = s(j, "gu").replace(/notPunctSpace/g, he).replace(/punctSpace/g, me).replace(/punct/g, k).getRegex(), Se = s("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, O).replace(/punctSpace/g, D).replace(/punct/g, E).getRegex(), Ce = s("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, O).replace(/punctSpace/g, D).replace(/punct/g, E).getRegex(), we = s("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, O).replace(/punctSpace/g, D).replace(/punct/g, E).getRegex(), Te = s(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, E).getRegex(), Ee = s("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, O).replace(/punctSpace/g, D).replace(/punct/g, E).getRegex(), De = s(/\\(punct)/, "gu").replace(/punct/g, E).getRegex(), Oe = s(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("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])?)+(?![-_])/).getRegex(), ke = s(x).replace("(?:-->|$)", "-->").getRegex(), Ae = s("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ke).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), M = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, N = s(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", M).getRegex(), je = s(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", N).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Me = s(/^!?\[(label)\]\[(ref)\]/).replace("label", N).replace("ref", y).getRegex(), Ne = s(/^!?\[(ref)\](?:\[\])?/).replace("ref", y).getRegex(), P = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, Pe = s(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", M).getRegex(), Fe = s("reflink|nolink(?!\\()", "g").replace("reflink", s(/^!?\[(label)\]\[(ref)\]/).replace("label", Pe).replace("ref", P).getRegex()).replace("nolink", s(/^!?\[(ref)\](?:\[\])?/).replace("ref", P).getRegex()).getRegex(), F = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Ie = s(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), I = {
|
|
132
134
|
_backpedal: a,
|
|
133
|
-
anyPunctuation:
|
|
134
|
-
autolink:
|
|
135
|
-
blockSkip:
|
|
136
|
-
br:
|
|
137
|
-
code:
|
|
135
|
+
anyPunctuation: De,
|
|
136
|
+
autolink: Oe,
|
|
137
|
+
blockSkip: ge,
|
|
138
|
+
br: T,
|
|
139
|
+
code: ue,
|
|
138
140
|
del: a,
|
|
139
141
|
delLDelim: a,
|
|
140
142
|
delRDelim: a,
|
|
141
|
-
emStrongLDelim:
|
|
142
|
-
emStrongRDelimAst:
|
|
143
|
-
emStrongRDelimUnd:
|
|
144
|
-
escape:
|
|
145
|
-
link:
|
|
146
|
-
nolink:
|
|
147
|
-
punctuation:
|
|
148
|
-
reflink:
|
|
149
|
-
reflinkSearch:
|
|
150
|
-
tag:
|
|
151
|
-
text:
|
|
143
|
+
emStrongLDelim: _e,
|
|
144
|
+
emStrongRDelimAst: be,
|
|
145
|
+
emStrongRDelimUnd: Ce,
|
|
146
|
+
escape: le,
|
|
147
|
+
link: je,
|
|
148
|
+
nolink: Ne,
|
|
149
|
+
punctuation: fe,
|
|
150
|
+
reflink: Me,
|
|
151
|
+
reflinkSearch: Fe,
|
|
152
|
+
tag: Ae,
|
|
153
|
+
text: de,
|
|
152
154
|
url: a
|
|
153
|
-
},
|
|
154
|
-
...
|
|
155
|
-
emStrongLDelim: be,
|
|
156
|
-
emStrongRDelimAst: Ce,
|
|
157
|
-
emStrongRDelimUnd: Te,
|
|
158
|
-
link: s(/^!?\[(label)\]\((.*?)\)/).replace("label", j).getRegex(),
|
|
159
|
-
reflink: s(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", j).getRegex()
|
|
160
|
-
}, I = {
|
|
161
|
-
...F,
|
|
162
|
-
emStrongRDelimAst: Se,
|
|
155
|
+
}, Le = {
|
|
156
|
+
...I,
|
|
163
157
|
emStrongLDelim: ye,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
158
|
+
emStrongRDelimAst: Se,
|
|
159
|
+
emStrongRDelimUnd: we,
|
|
160
|
+
link: s(/^!?\[(label)\]\((.*?)\)/).replace("label", N).getRegex(),
|
|
161
|
+
reflink: s(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", N).getRegex()
|
|
162
|
+
}, L = {
|
|
163
|
+
...I,
|
|
164
|
+
emStrongRDelimAst: xe,
|
|
165
|
+
emStrongLDelim: ve,
|
|
166
|
+
delLDelim: Te,
|
|
167
|
+
delRDelim: Ee,
|
|
168
|
+
url: s(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Ie).replace("protocol", F).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),
|
|
167
169
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
168
170
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
169
|
-
text: s(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",
|
|
170
|
-
},
|
|
171
|
-
...
|
|
172
|
-
br: s(
|
|
173
|
-
text: s(
|
|
174
|
-
}, L = {
|
|
175
|
-
normal: S,
|
|
176
|
-
gfm: ce,
|
|
177
|
-
pedantic: le
|
|
171
|
+
text: s(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", F).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex()
|
|
172
|
+
}, Re = {
|
|
173
|
+
...L,
|
|
174
|
+
br: s(T).replace("{2,}", "*").getRegex(),
|
|
175
|
+
text: s(L.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
178
176
|
}, R = {
|
|
179
|
-
normal:
|
|
180
|
-
gfm:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
normal: C,
|
|
178
|
+
gfm: se,
|
|
179
|
+
pedantic: ce
|
|
180
|
+
}, z = {
|
|
181
|
+
normal: I,
|
|
182
|
+
gfm: L,
|
|
183
|
+
breaks: Re,
|
|
184
|
+
pedantic: Le
|
|
185
|
+
}, ze = {
|
|
184
186
|
"&": "&",
|
|
185
187
|
"<": "<",
|
|
186
188
|
">": ">",
|
|
187
189
|
"\"": """,
|
|
188
190
|
"'": "'"
|
|
189
|
-
},
|
|
190
|
-
function
|
|
191
|
+
}, B = (e) => ze[e];
|
|
192
|
+
function V(e, t) {
|
|
191
193
|
if (t) {
|
|
192
|
-
if (l.escapeTest.test(e)) return e.replace(l.escapeReplace,
|
|
193
|
-
} else if (l.escapeTestNoEncode.test(e)) return e.replace(l.escapeReplaceNoEncode,
|
|
194
|
+
if (l.escapeTest.test(e)) return e.replace(l.escapeReplace, B);
|
|
195
|
+
} else if (l.escapeTestNoEncode.test(e)) return e.replace(l.escapeReplaceNoEncode, B);
|
|
194
196
|
return e;
|
|
195
197
|
}
|
|
196
|
-
function
|
|
198
|
+
function Be(e) {
|
|
199
|
+
return e.replace(l.numericCharacterReference, (e, t, n) => {
|
|
200
|
+
let r = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
|
|
201
|
+
return r === 0 || r > 1114111 || r >= 55296 && r <= 57343 ? "�" : String.fromCodePoint(r);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function H(e) {
|
|
197
205
|
try {
|
|
198
206
|
e = encodeURI(e).replace(l.percentDecode, "%");
|
|
199
207
|
} catch {
|
|
@@ -201,7 +209,7 @@ function V(e) {
|
|
|
201
209
|
}
|
|
202
210
|
return e;
|
|
203
211
|
}
|
|
204
|
-
function
|
|
212
|
+
function U(e, t) {
|
|
205
213
|
let n = e.replace(l.findPipe, (e, t, n) => {
|
|
206
214
|
let r = !1, i = t;
|
|
207
215
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
@@ -214,7 +222,7 @@ function H(e, t) {
|
|
|
214
222
|
for (; r < n.length; r++) n[r] = n[r].trim().replace(l.slashPipe, "|");
|
|
215
223
|
return n;
|
|
216
224
|
}
|
|
217
|
-
function
|
|
225
|
+
function W(e, t, n) {
|
|
218
226
|
let r = e.length;
|
|
219
227
|
if (r === 0) return "";
|
|
220
228
|
let i = 0;
|
|
@@ -226,12 +234,15 @@ function U(e, t, n) {
|
|
|
226
234
|
}
|
|
227
235
|
return e.slice(0, r - i);
|
|
228
236
|
}
|
|
229
|
-
function
|
|
237
|
+
function Ve(e) {
|
|
230
238
|
let t = e.split("\n"), n = t.length - 1;
|
|
231
239
|
for (; n >= 0 && l.blankLine.test(t[n]);) n--;
|
|
232
240
|
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
233
241
|
}
|
|
234
|
-
function
|
|
242
|
+
function G(e) {
|
|
243
|
+
return e.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
244
|
+
}
|
|
245
|
+
function He(e, t) {
|
|
235
246
|
if (e.indexOf(t[1]) === -1) return -1;
|
|
236
247
|
let n = 0;
|
|
237
248
|
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
@@ -239,7 +250,7 @@ function Le(e, t) {
|
|
|
239
250
|
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
240
251
|
return n > 0 ? -2 : -1;
|
|
241
252
|
}
|
|
242
|
-
function
|
|
253
|
+
function Ue(e, t = 0) {
|
|
243
254
|
let n = t, r = "";
|
|
244
255
|
for (let t of e) if (t === " ") {
|
|
245
256
|
let e = 4 - n % 4;
|
|
@@ -247,7 +258,7 @@ function Re(e, t = 0) {
|
|
|
247
258
|
} else r += t, n++;
|
|
248
259
|
return r;
|
|
249
260
|
}
|
|
250
|
-
function
|
|
261
|
+
function We(e, t, n, r, i) {
|
|
251
262
|
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1"), c = e[0].charAt(0) === "!";
|
|
252
263
|
r.state.inLink = !0;
|
|
253
264
|
let l = r.state.linkEmitted, u = r.state.inRawBlock;
|
|
@@ -269,7 +280,7 @@ function G(e, t, n, r, i) {
|
|
|
269
280
|
tokens: d
|
|
270
281
|
};
|
|
271
282
|
}
|
|
272
|
-
function
|
|
283
|
+
function Ge(e, t, n) {
|
|
273
284
|
let r = e.match(n.other.indentCodeCompensation);
|
|
274
285
|
if (r === null) return t;
|
|
275
286
|
let i = r[1];
|
|
@@ -280,6 +291,29 @@ function ze(e, t, n) {
|
|
|
280
291
|
return e.slice(Math.min(r.length, i.length));
|
|
281
292
|
}).join("\n");
|
|
282
293
|
}
|
|
294
|
+
function Ke(e, t, n, r) {
|
|
295
|
+
if (!t.includes("<")) return !1;
|
|
296
|
+
for (let i = 0; i < t.length; i++) {
|
|
297
|
+
if (t[i] === "\\") {
|
|
298
|
+
i++;
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
if (t[i] === "`") {
|
|
302
|
+
let e = r.inline.code.exec(t.slice(i));
|
|
303
|
+
if (e) {
|
|
304
|
+
i += e[0].length - 1;
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
if (t[i] !== "<") continue;
|
|
309
|
+
let a = e.slice(n + i), o = r.inline.tag.exec(a) || r.inline.autolink.exec(a);
|
|
310
|
+
if (o) {
|
|
311
|
+
if (o[0].length > t.length - i) return !0;
|
|
312
|
+
i += o[0].length - 1;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
return !1;
|
|
316
|
+
}
|
|
283
317
|
var K = class {
|
|
284
318
|
options;
|
|
285
319
|
rules;
|
|
@@ -297,7 +331,7 @@ var K = class {
|
|
|
297
331
|
code(e) {
|
|
298
332
|
let t = this.rules.block.code.exec(e);
|
|
299
333
|
if (t) {
|
|
300
|
-
let e = this.options.pedantic ? t[0] :
|
|
334
|
+
let e = this.options.pedantic ? t[0] : Ve(t[0]);
|
|
301
335
|
return {
|
|
302
336
|
type: "code",
|
|
303
337
|
raw: e,
|
|
@@ -309,7 +343,7 @@ var K = class {
|
|
|
309
343
|
fences(e) {
|
|
310
344
|
let t = this.rules.block.fences.exec(e);
|
|
311
345
|
if (t) {
|
|
312
|
-
let e = t[0], n =
|
|
346
|
+
let e = t[0], n = Ge(e, t[3] || "", this.rules);
|
|
313
347
|
return {
|
|
314
348
|
type: "code",
|
|
315
349
|
raw: e,
|
|
@@ -323,12 +357,12 @@ var K = class {
|
|
|
323
357
|
if (t) {
|
|
324
358
|
let e = t[2].trim();
|
|
325
359
|
if (this.rules.other.endingHash.test(e)) {
|
|
326
|
-
let t =
|
|
360
|
+
let t = W(e, "#");
|
|
327
361
|
(this.options.pedantic || !t || this.rules.other.endingSpaceTabChar.test(t)) && (e = t.trim());
|
|
328
362
|
}
|
|
329
363
|
return {
|
|
330
364
|
type: "heading",
|
|
331
|
-
raw:
|
|
365
|
+
raw: W(t[0], "\n"),
|
|
332
366
|
depth: t[1].length,
|
|
333
367
|
text: e,
|
|
334
368
|
tokens: this.lexer.inline(e)
|
|
@@ -339,13 +373,13 @@ var K = class {
|
|
|
339
373
|
let t = this.rules.block.hr.exec(e);
|
|
340
374
|
if (t) return {
|
|
341
375
|
type: "hr",
|
|
342
|
-
raw:
|
|
376
|
+
raw: W(t[0], "\n")
|
|
343
377
|
};
|
|
344
378
|
}
|
|
345
379
|
blockquote(e) {
|
|
346
380
|
let t = this.rules.block.blockquote.exec(e);
|
|
347
381
|
if (t) {
|
|
348
|
-
let e =
|
|
382
|
+
let e = W(t[0], "\n").split("\n"), n = "", r = "", i = [];
|
|
349
383
|
for (; e.length > 0;) {
|
|
350
384
|
let t = !1, a = [], o = 0;
|
|
351
385
|
for (; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
|
|
@@ -362,8 +396,10 @@ ${c}` : c;
|
|
|
362
396
|
if (u?.type === "code") break;
|
|
363
397
|
if (u?.type === "blockquote") {
|
|
364
398
|
let t = u, a = e.join("\n"), o = t.raw + "\n" + a.replace(this.rules.other.blockquoteSetextReplace2, ""), s = this.blockquote(o);
|
|
365
|
-
i[i.length - 1] = s
|
|
366
|
-
|
|
399
|
+
i[i.length - 1] = s;
|
|
400
|
+
let c = o.substring(s.raw.length).replace(/^\n/, ""), l = c ? c.split("\n").length : 0, d = l ? e.slice(0, -l) : e;
|
|
401
|
+
d.length > 0 && (n = `${n}
|
|
402
|
+
${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
367
403
|
break;
|
|
368
404
|
}
|
|
369
405
|
if (u?.type === "list") {
|
|
@@ -397,18 +433,18 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
397
433
|
let n = !1, r = "", s = "";
|
|
398
434
|
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
399
435
|
r = t[0], e = e.substring(r.length);
|
|
400
|
-
let c =
|
|
401
|
-
if (this.options.pedantic ? (
|
|
402
|
-
let t = this.rules.other.nextBulletRegex(
|
|
436
|
+
let c = t[2].split("\n", 1)[0], l = t[1].length, u = this.options.pedantic ? Ue(c, l) : c.replace(this.rules.other.leadingSpaceTab, (e) => Ue(e, l)), d = e.split("\n", 1)[0], f = !u.trim(), p = 0;
|
|
437
|
+
if (this.options.pedantic ? (p = 2, s = u.trimStart()) : f ? p = l + 1 : (p = u.search(this.rules.other.nonSpaceChar), p = p > 4 ? 1 : p, s = u.slice(p), p += l), f && this.rules.other.blankLine.test(d) && (r += d + "\n", e = e.substring(d.length + 1), n = !0), !n) {
|
|
438
|
+
let t = this.rules.other.nextBulletRegex(p), n = this.rules.other.hrRegex(p), i = this.rules.other.fencesBeginRegex(p), a = this.rules.other.headingBeginRegex(p), o = this.rules.other.htmlBeginRegex(p), c = this.rules.other.blockquoteBeginRegex(p);
|
|
403
439
|
for (; e;) {
|
|
404
|
-
let
|
|
405
|
-
if (
|
|
406
|
-
if (m.search(this.rules.other.nonSpaceChar) >=
|
|
440
|
+
let l = e.split("\n", 1)[0], m;
|
|
441
|
+
if (d = l, this.options.pedantic ? (d = d.replace(this.rules.other.listReplaceNesting, " "), m = d) : m = d.replace(this.rules.other.leadingSpaceTab, (e) => e.replace(this.rules.other.tabCharGlobal, " ")), i.test(d) || a.test(d) || o.test(d) || c.test(d) || t.test(d) || n.test(d)) break;
|
|
442
|
+
if (m.search(this.rules.other.nonSpaceChar) >= p || !d.trim()) s += "\n" + m.slice(p);
|
|
407
443
|
else {
|
|
408
|
-
if (
|
|
409
|
-
s += "\n" +
|
|
444
|
+
if (f || u.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(u) || a.test(u) || n.test(u)) break;
|
|
445
|
+
s += "\n" + d;
|
|
410
446
|
}
|
|
411
|
-
|
|
447
|
+
f = !d.trim(), r += l + "\n", e = e.substring(l.length + 1), u = m.slice(p);
|
|
412
448
|
}
|
|
413
449
|
}
|
|
414
450
|
i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
|
|
@@ -462,7 +498,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
462
498
|
html(e) {
|
|
463
499
|
let t = this.rules.block.html.exec(e);
|
|
464
500
|
if (t) {
|
|
465
|
-
let e =
|
|
501
|
+
let e = Ve(t[0]);
|
|
466
502
|
return {
|
|
467
503
|
type: "html",
|
|
468
504
|
block: !0,
|
|
@@ -475,11 +511,11 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
475
511
|
def(e) {
|
|
476
512
|
let t = this.rules.block.def.exec(e);
|
|
477
513
|
if (t) {
|
|
478
|
-
let e = t[1]
|
|
514
|
+
let e = G(t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
479
515
|
return {
|
|
480
516
|
type: "def",
|
|
481
517
|
tag: e,
|
|
482
|
-
raw:
|
|
518
|
+
raw: W(t[0], "\n"),
|
|
483
519
|
href: n,
|
|
484
520
|
title: r
|
|
485
521
|
};
|
|
@@ -488,9 +524,9 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
488
524
|
table(e) {
|
|
489
525
|
let t = this.rules.block.table.exec(e);
|
|
490
526
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
491
|
-
let n =
|
|
527
|
+
let n = U(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
|
|
492
528
|
type: "table",
|
|
493
|
-
raw:
|
|
529
|
+
raw: W(t[0], "\n"),
|
|
494
530
|
header: [],
|
|
495
531
|
align: [],
|
|
496
532
|
rows: []
|
|
@@ -503,7 +539,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
503
539
|
header: !0,
|
|
504
540
|
align: a.align[e]
|
|
505
541
|
});
|
|
506
|
-
for (let e of i) a.rows.push(
|
|
542
|
+
for (let e of i) a.rows.push(U(e, a.header.length).map((e, t) => ({
|
|
507
543
|
text: e,
|
|
508
544
|
tokens: this.lexer.inline(e),
|
|
509
545
|
header: !1,
|
|
@@ -518,7 +554,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
518
554
|
let e = t[1].trim();
|
|
519
555
|
return {
|
|
520
556
|
type: "heading",
|
|
521
|
-
raw:
|
|
557
|
+
raw: W(t[0], "\n"),
|
|
522
558
|
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
523
559
|
text: e,
|
|
524
560
|
tokens: this.lexer.inline(e)
|
|
@@ -568,35 +604,39 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
568
604
|
link(e) {
|
|
569
605
|
let t = this.rules.inline.link.exec(e);
|
|
570
606
|
if (t) {
|
|
571
|
-
let
|
|
572
|
-
if (!this.options.pedantic && this.rules
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
if (
|
|
607
|
+
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
608
|
+
if (!this.options.pedantic && Ke(e, t[1], n, this.rules)) return;
|
|
609
|
+
let r = t[2].trim();
|
|
610
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
|
|
611
|
+
if (!this.rules.other.endAngleBracket.test(r)) return;
|
|
612
|
+
let e = W(r.slice(0, -1), "\\");
|
|
613
|
+
if ((r.length - e.length) % 2 == 0) return;
|
|
576
614
|
} else {
|
|
577
|
-
let e =
|
|
615
|
+
let e = He(t[2], "()");
|
|
578
616
|
if (e === -2) return;
|
|
579
617
|
if (e > -1) {
|
|
580
618
|
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
581
619
|
t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
|
|
582
620
|
}
|
|
583
621
|
}
|
|
584
|
-
let
|
|
622
|
+
let i = t[2], a = "";
|
|
585
623
|
if (this.options.pedantic) {
|
|
586
|
-
let e = this.rules.other.pedanticHrefTitle.exec(
|
|
587
|
-
e && (
|
|
588
|
-
} else
|
|
589
|
-
return
|
|
590
|
-
href:
|
|
591
|
-
title:
|
|
624
|
+
let e = this.rules.other.pedanticHrefTitle.exec(i);
|
|
625
|
+
e && (i = e[1], a = e[3]);
|
|
626
|
+
} else a = t[3] ? t[3].slice(1, -1) : "";
|
|
627
|
+
return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (i = this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? i.slice(1) : i.slice(1, -1)), We(t, {
|
|
628
|
+
href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
629
|
+
title: a && a.replace(this.rules.inline.anyPunctuation, "$1")
|
|
592
630
|
}, t[0], this.lexer, this.rules);
|
|
593
631
|
}
|
|
594
632
|
}
|
|
595
633
|
reflink(e, t) {
|
|
596
634
|
let n;
|
|
597
635
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
598
|
-
let
|
|
599
|
-
if (!e)
|
|
636
|
+
let r = n[0].charAt(0) === "!" ? 2 : 1;
|
|
637
|
+
if (!this.options.pedantic && Ke(e, n[1], r, this.rules)) return;
|
|
638
|
+
let i = t[G((n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "))];
|
|
639
|
+
if (!i) {
|
|
600
640
|
let e = n[0].charAt(0);
|
|
601
641
|
return {
|
|
602
642
|
type: "text",
|
|
@@ -604,7 +644,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
604
644
|
text: e
|
|
605
645
|
};
|
|
606
646
|
}
|
|
607
|
-
return
|
|
647
|
+
return We(n, i, n[0], this.lexer, this.rules);
|
|
608
648
|
}
|
|
609
649
|
}
|
|
610
650
|
emStrong(e, t, n = "") {
|
|
@@ -737,7 +777,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
737
777
|
return {
|
|
738
778
|
type: "text",
|
|
739
779
|
raw: t[0],
|
|
740
|
-
text: t[0],
|
|
780
|
+
text: e ? t[0] : Be(t[0]),
|
|
741
781
|
escaped: e
|
|
742
782
|
};
|
|
743
783
|
}
|
|
@@ -757,15 +797,15 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
757
797
|
};
|
|
758
798
|
let t = {
|
|
759
799
|
other: l,
|
|
760
|
-
block:
|
|
761
|
-
inline:
|
|
800
|
+
block: R.normal,
|
|
801
|
+
inline: z.normal
|
|
762
802
|
};
|
|
763
|
-
this.options.pedantic ? (t.block =
|
|
803
|
+
this.options.pedantic ? (t.block = R.pedantic, t.inline = z.pedantic) : this.options.gfm && (t.block = R.gfm, t.inline = this.options.breaks ? z.breaks : z.gfm), this.tokenizer.rules = t;
|
|
764
804
|
}
|
|
765
805
|
static get rules() {
|
|
766
806
|
return {
|
|
767
|
-
block:
|
|
768
|
-
inline:
|
|
807
|
+
block: R,
|
|
808
|
+
inline: z
|
|
769
809
|
};
|
|
770
810
|
}
|
|
771
811
|
static lex(t, n) {
|
|
@@ -883,7 +923,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
883
923
|
for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return !0;
|
|
884
924
|
for (let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
885
925
|
let e = t[0], n = e.lastIndexOf("[");
|
|
886
|
-
if (e.charAt(0) !== "!" && Object.hasOwn(this.tokens.links, e.slice(n + 1, -1)) && !(n > 1 && this.linkInText(e.slice(1, n - 1)))) return !0;
|
|
926
|
+
if (e.charAt(0) !== "!" && Object.hasOwn(this.tokens.links, G(e.slice(n + 1, -1))) && !(n > 1 && this.linkInText(e.slice(1, n - 1)))) return !0;
|
|
887
927
|
}
|
|
888
928
|
return !1;
|
|
889
929
|
}
|
|
@@ -893,7 +933,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
893
933
|
if (this.tokens.links && e.includes("[")) {
|
|
894
934
|
let e = this.tokenizer.rules.inline.reflinkSearch, t = (n) => {
|
|
895
935
|
let r = n.lastIndexOf("[");
|
|
896
|
-
if (!Object.hasOwn(this.tokens.links, n.slice(r + 1, -1))) return n;
|
|
936
|
+
if (!Object.hasOwn(this.tokens.links, G(n.slice(r + 1, -1)))) return n;
|
|
897
937
|
if (r > 1 && n.charAt(0) !== "!") {
|
|
898
938
|
let i = n.slice(1, r - 1);
|
|
899
939
|
if (this.linkInText(i)) return "[" + i.replace(e, t) + "][" + "a".repeat(n.length - r - 2) + "]";
|
|
@@ -994,7 +1034,7 @@ ${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
994
1034
|
}
|
|
995
1035
|
code({ text: e, lang: t, escaped: n }) {
|
|
996
1036
|
let r = (t || "").match(l.notSpaceStart)?.[0], i = e ? e.replace(l.endingNewline, "") + "\n" : "";
|
|
997
|
-
return r ? "<pre><code class=\"language-" +
|
|
1037
|
+
return r ? "<pre><code class=\"language-" + V(r) + "\">" + (n ? i : V(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : V(i, !0)) + "</code></pre>\n";
|
|
998
1038
|
}
|
|
999
1039
|
blockquote({ tokens: e }) {
|
|
1000
1040
|
return `<blockquote>
|
|
@@ -1064,7 +1104,7 @@ ${e}</tr>
|
|
|
1064
1104
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1065
1105
|
}
|
|
1066
1106
|
codespan({ text: e }) {
|
|
1067
|
-
return `<code>${
|
|
1107
|
+
return `<code>${V(e, !0)}</code>`;
|
|
1068
1108
|
}
|
|
1069
1109
|
br(e) {
|
|
1070
1110
|
return "<br>";
|
|
@@ -1073,22 +1113,22 @@ ${e}</tr>
|
|
|
1073
1113
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1074
1114
|
}
|
|
1075
1115
|
link({ href: e, title: t, text: n, tokens: r, autolink: i }) {
|
|
1076
|
-
let a = i ?
|
|
1116
|
+
let a = i ? V(n, !0) : this.parser.parseInline(r), o = H(e);
|
|
1077
1117
|
if (o === null) return a;
|
|
1078
|
-
e =
|
|
1118
|
+
e = V(o, i);
|
|
1079
1119
|
let s = "<a href=\"" + e + "\"";
|
|
1080
|
-
return t && (s += " title=\"" +
|
|
1120
|
+
return t && (s += " title=\"" + V(t) + "\""), s += ">" + a + "</a>", s;
|
|
1081
1121
|
}
|
|
1082
1122
|
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1083
1123
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1084
|
-
let i =
|
|
1085
|
-
if (i === null) return
|
|
1124
|
+
let i = H(e);
|
|
1125
|
+
if (i === null) return V(n);
|
|
1086
1126
|
e = i;
|
|
1087
|
-
let a = `<img src="${
|
|
1088
|
-
return t && (a += ` title="${
|
|
1127
|
+
let a = `<img src="${V(e)}" alt="${V(n)}"`;
|
|
1128
|
+
return t && (a += ` title="${V(t)}"`), a += ">", a;
|
|
1089
1129
|
}
|
|
1090
1130
|
text(e) {
|
|
1091
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text :
|
|
1131
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : V(e.text);
|
|
1092
1132
|
}
|
|
1093
1133
|
}, Y = class {
|
|
1094
1134
|
strong({ text: e }) {
|
|
@@ -1477,7 +1517,7 @@ ${e}</tr>
|
|
|
1477
1517
|
onError(e, t) {
|
|
1478
1518
|
return (n) => {
|
|
1479
1519
|
if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
|
|
1480
|
-
let e = "<p>An error occurred:</p><pre>" +
|
|
1520
|
+
let e = "<p>An error occurred:</p><pre>" + V(n.message + "", !0) + "</pre>";
|
|
1481
1521
|
return t ? Promise.resolve(e) : e;
|
|
1482
1522
|
}
|
|
1483
1523
|
if (t) return Promise.reject(n);
|
|
@@ -1491,47 +1531,47 @@ function $(e, t) {
|
|
|
1491
1531
|
$.options = $.setOptions = function(e) {
|
|
1492
1532
|
return Q.setOptions(e), $.defaults = Q.defaults, i($.defaults), $;
|
|
1493
1533
|
}, $.getDefaults = n, $.defaults = r;
|
|
1494
|
-
function
|
|
1534
|
+
function qe(...e) {
|
|
1495
1535
|
return Q.use(...e), $.defaults = Q.defaults, i($.defaults), $;
|
|
1496
1536
|
}
|
|
1497
|
-
$.use =
|
|
1537
|
+
$.use = qe, $.walkTokens = function(e, t) {
|
|
1498
1538
|
return Q.walkTokens(e, t);
|
|
1499
1539
|
}, $.parseInline = Q.parseInline, $.Parser = X, $.parser = X.parse, $.Renderer = J, $.TextRenderer = Y, $.Lexer = q, $.lexer = q.lex, $.Tokenizer = K, $.Hooks = Z, $.parse = $, $.options, $.setOptions, $.walkTokens, $.parseInline, X.parse, q.lex;
|
|
1500
1540
|
//#endregion
|
|
1501
1541
|
//#region lib/utils/markdown-to-html.ts
|
|
1502
|
-
var
|
|
1542
|
+
var Je = /* @__PURE__ */ new Set([
|
|
1503
1543
|
"info",
|
|
1504
1544
|
"tip",
|
|
1505
1545
|
"warning",
|
|
1506
1546
|
"caution"
|
|
1507
|
-
]),
|
|
1547
|
+
]), Ye = [
|
|
1508
1548
|
"width",
|
|
1509
1549
|
"min-width",
|
|
1510
1550
|
"max-width",
|
|
1511
1551
|
"text-align"
|
|
1512
|
-
],
|
|
1552
|
+
], Xe = (e) => {
|
|
1513
1553
|
let t = e?.trim().toLowerCase();
|
|
1514
|
-
return t &&
|
|
1515
|
-
},
|
|
1516
|
-
let t = e.matches("table, col, th, td") ?
|
|
1554
|
+
return t && Je.has(t) ? t : "info";
|
|
1555
|
+
}, Ze = (e) => {
|
|
1556
|
+
let t = e.matches("table, col, th, td") ? Ye.map((t) => [t, e.style.getPropertyValue(t)]).filter(([, e]) => !!e) : [];
|
|
1517
1557
|
e.removeAttribute("style"), t.forEach(([t, n]) => {
|
|
1518
1558
|
e.style.setProperty(t, n);
|
|
1519
1559
|
});
|
|
1520
|
-
},
|
|
1560
|
+
}, Qe = (e) => {
|
|
1521
1561
|
let t = document.createElement("div");
|
|
1522
1562
|
return t.innerHTML = e, t.querySelectorAll("aside[data-type=\"callout\"]").forEach((e) => {
|
|
1523
|
-
let t =
|
|
1563
|
+
let t = Xe(e.getAttribute("data-variant"));
|
|
1524
1564
|
Array.from(e.attributes).forEach((t) => {
|
|
1525
1565
|
t.name !== "data-type" && t.name !== "data-variant" && t.name !== "role" && e.removeAttribute(t.name);
|
|
1526
1566
|
}), e.setAttribute("data-type", "callout"), e.setAttribute("data-variant", t), e.setAttribute("role", "note"), [e, ...Array.from(e.querySelectorAll("*"))].forEach((e) => {
|
|
1527
|
-
|
|
1567
|
+
Ze(e), Array.from(e.attributes).forEach((t) => {
|
|
1528
1568
|
t.name.toLowerCase().startsWith("on") && e.removeAttribute(t.name);
|
|
1529
1569
|
});
|
|
1530
1570
|
});
|
|
1531
1571
|
}), t.innerHTML;
|
|
1532
|
-
},
|
|
1572
|
+
}, $e = (t) => {
|
|
1533
1573
|
let n = document.createElement("div");
|
|
1534
1574
|
return n.innerHTML = t, e(n), n.innerHTML;
|
|
1535
|
-
},
|
|
1575
|
+
}, et = (e) => $e(Qe(t.sanitize($.parse(e, { async: !1 }), { ADD_ATTR: ["colwidth"] })));
|
|
1536
1576
|
//#endregion
|
|
1537
|
-
export { $ as n,
|
|
1577
|
+
export { $ as n, et as t };
|