@clevertask/scribe 0.1.31 → 0.1.33
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-Bm5IfWVV.js → BarMenu-KDCTLxwU.js} +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 +3 -3
- package/dist/components/Menu/TableHeightSettings.js +1 -1
- package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
- package/dist/components/Scribe/extension/callout.js +1 -1
- package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
- package/dist/components/Scribe/extension/extension-link.js +1 -1
- package/dist/components/Scribe/extension/extension-markdown-paste.js +2 -2
- package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
- package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
- package/dist/components/Scribe/extension/index.js +1 -1
- package/dist/components/Scribe/extension/resizable-table.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3 -3
- package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
- package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
- package/dist/components/Scribe/extension/table-layout.js +1 -1
- package/dist/components/Scribe/extension/tableOfContents.js +1 -1
- package/dist/components/Scribe/index.d.ts.map +1 -1
- package/dist/components/Scribe/index.js +5 -5
- package/dist/{dist-BoAzo5MN.js → dist-B0QTAeBQ.js} +816 -644
- package/dist/{dist-SM4NoN4h.js → dist-D2ylH0wL.js} +144 -126
- package/dist/{dist-BqlzKS-_.js → dist-Dn1WHiQf.js} +2 -2
- package/dist/document-node-capabilities.js +1 -1
- package/dist/{extension-dz0CIf3r.js → extension-BpvJtqXe.js} +2 -2
- package/dist/{extension-link-DxIXGCtV.js → extension-link-DvMmKOua.js} +2 -2
- package/dist/{html-to-markdown-DeRG9OPm.js → html-to-markdown-CsSZIegJ.js} +1 -1
- package/dist/main.js +2 -2
- package/dist/{markdown-to-html-tCPjQ5u6.js → markdown-to-html-YkhBwkrX.js} +225 -217
- package/dist/{menus-BKxcTUsl.js → menus-DcCI3Z7f.js} +5 -5
- package/dist/purify.es-BpCmlcgS.js +877 -0
- package/dist/{rolldown-runtime-CtkjhSXr.js → rolldown-runtime-gFifre8I.js} +1 -1
- package/dist/{schema-extensions-B9hR1VrD.js → schema-extensions-CROueYL8.js} +6 -6
- package/dist/schema-extensions.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/{table-layout-ClqaGg1E.js → table-layout-CARP38M-.js} +2 -2
- package/dist/utils/html-to-markdown.js +1 -1
- package/dist/utils/index.js +4 -4
- package/dist/utils/markdown-to-html.js +1 -1
- package/package.json +52 -52
- package/dist/purify.es-CSWcs7f1.js +0 -844
|
@@ -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.1.
|
|
2
|
+
import { t } from "./purify.es-BpCmlcgS.js";
|
|
3
|
+
//#region node_modules/.pnpm/marked@18.1.1/node_modules/marked/lib/marked.esm.js
|
|
4
4
|
function n() {
|
|
5
5
|
return {
|
|
6
6
|
async: !1,
|
|
@@ -82,7 +82,8 @@ var c = ((e = "") => {
|
|
|
82
82
|
endAngleBracket: />$/,
|
|
83
83
|
pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
|
|
84
84
|
unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
|
|
85
|
-
numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}))
|
|
85
|
+
numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,
|
|
86
|
+
numericCharacterReferenceOrAmpersand: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
|
|
86
87
|
escapeTest: /[&<>"']/,
|
|
87
88
|
escapeReplace: /[&<>"']/g,
|
|
88
89
|
escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
|
|
@@ -101,107 +102,109 @@ var c = ((e = "") => {
|
|
|
101
102
|
hrRegex: o((e) => RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),
|
|
102
103
|
fencesBeginRegex: o((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
|
|
103
104
|
headingBeginRegex: o((e) => RegExp(`^ {0,${e}}#`)),
|
|
104
|
-
htmlBeginRegex: o((e) => RegExp(`^ {0,${e}}(?:</?(?:${
|
|
105
|
+
htmlBeginRegex: o((e) => RegExp(`^ {0,${e}}(?:</?(?:${y})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`, "i")),
|
|
105
106
|
blockquoteBeginRegex: o((e) => RegExp(`^ {0,${e}}>`))
|
|
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+|$)/,
|
|
107
|
-
blockquote: s(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",
|
|
107
|
+
}, 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+|$)/, 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, "").getRegex(), te = 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(), _ = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, ne = /^[^\n]+/, v = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, re = s(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", v).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), ie = s(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, h).getRegex(), y = "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", b = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, ae = 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-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", b).replace("tag", y).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), x = (e) => s(_).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", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", y).getRegex(), oe = x(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), se = x(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), S = {
|
|
108
|
+
blockquote: s(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", se).getRegex(),
|
|
108
109
|
code: d,
|
|
109
|
-
def:
|
|
110
|
+
def: re,
|
|
110
111
|
fences: f,
|
|
111
112
|
heading: m,
|
|
112
113
|
hr: p,
|
|
113
|
-
html:
|
|
114
|
-
lheading:
|
|
115
|
-
list:
|
|
114
|
+
html: ae,
|
|
115
|
+
lheading: ee,
|
|
116
|
+
list: ie,
|
|
116
117
|
newline: u,
|
|
117
|
-
paragraph:
|
|
118
|
+
paragraph: oe,
|
|
118
119
|
table: a,
|
|
119
|
-
text:
|
|
120
|
-
},
|
|
121
|
-
...
|
|
122
|
-
lheading:
|
|
123
|
-
table:
|
|
124
|
-
paragraph: s(
|
|
125
|
-
},
|
|
126
|
-
...
|
|
127
|
-
html: s("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",
|
|
120
|
+
text: ne
|
|
121
|
+
}, ce = 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", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", y).getRegex(), le = {
|
|
122
|
+
...S,
|
|
123
|
+
lheading: te,
|
|
124
|
+
table: ce,
|
|
125
|
+
paragraph: s(_).replace("hr", p).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ce).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", " {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)").replace("tag", y).getRegex()
|
|
126
|
+
}, ue = {
|
|
127
|
+
...S,
|
|
128
|
+
html: s("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", b).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(),
|
|
128
129
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
129
130
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
130
131
|
fences: a,
|
|
131
132
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
132
|
-
paragraph: s(
|
|
133
|
-
},
|
|
133
|
+
paragraph: s(_).replace("hr", p).replace("heading", " *#{1,6} *[^\n]").replace("lheading", ee).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
134
|
+
}, de = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, fe = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, C = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, pe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, w = /[\p{P}\p{S}]/u, T = /[\s\p{P}\p{S}]/u, E = /[^\s\p{P}\p{S}]/u, me = s(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, T).getRegex(), he = /[\p{Pi}\p{Ps}"']/u, D = /(?!~)[\p{P}\p{S}]/u, ge = /(?!~)[\s\p{P}\p{S}]/u, _e = /(?:[^\s\p{P}\p{S}]|~)/u, ve = 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(), O = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, ye = s(O, "u").replace(/punct/g, w).getRegex(), be = s(O, "u").replace(/punct/g, D).getRegex(), xe = s(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, he).replace(/punct/g, w).getRegex(), Se = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ce = s(Se, "gu").replace(/notPunctSpace/g, E).replace(/punctSpace/g, T).replace(/punct/g, w).getRegex(), we = s(Se, "gu").replace(/notPunctSpace/g, _e).replace(/punctSpace/g, ge).replace(/punct/g, D).getRegex(), Te = s("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, E).replace(/punctSpace/g, T).replace(/punct/g, w).getRegex(), Ee = s("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, E).replace(/punctSpace/g, T).replace(/punct/g, w).getRegex(), De = s("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, E).replace(/punctSpace/g, T).replace(/punct/g, w).getRegex(), Oe = s(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, w).getRegex(), ke = s("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, E).replace(/punctSpace/g, T).replace(/punct/g, w).getRegex(), Ae = s(/\\(punct)/, "gu").replace(/punct/g, w).getRegex(), je = s(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/, "gu").replace(/punct/g, w).getRegex(), Me = 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(), Ne = s(b).replace("(?:-->|$)", "-->").getRegex(), Pe = 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", Ne).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Fe = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, k = s(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Fe).getRegex(), Ie = s(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label", k).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Le = s(/^!?\[(label)\]\[(ref)\]/).replace("label", k).replace("ref", v).getRegex(), Re = s(/^!?\[(ref)\](?:\[\])?/).replace("ref", v).getRegex(), ze = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, Be = s(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Fe).getRegex(), Ve = s("reflink|nolink(?!\\()", "g").replace("reflink", s(/^!?\[(label)\]\[(ref)\]/).replace("label", Be).replace("ref", ze).getRegex()).replace("nolink", s(/^!?\[(ref)\](?:\[\])?/).replace("ref", ze).getRegex()).getRegex(), He = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Ue = 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(), A = {
|
|
134
135
|
_backpedal: a,
|
|
135
|
-
anyPunctuation:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
anyPunctuation: Ae,
|
|
137
|
+
anyPunctuationOutsideCode: je,
|
|
138
|
+
autolink: Me,
|
|
139
|
+
blockSkip: ve,
|
|
140
|
+
br: C,
|
|
141
|
+
code: fe,
|
|
140
142
|
del: a,
|
|
141
143
|
delLDelim: a,
|
|
142
144
|
delRDelim: a,
|
|
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,
|
|
154
|
-
url: a
|
|
155
|
-
}, Le = {
|
|
156
|
-
...I,
|
|
157
145
|
emStrongLDelim: ye,
|
|
158
|
-
emStrongRDelimAst:
|
|
159
|
-
emStrongRDelimUnd:
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
url:
|
|
146
|
+
emStrongRDelimAst: Ce,
|
|
147
|
+
emStrongRDelimUnd: Ee,
|
|
148
|
+
escape: de,
|
|
149
|
+
link: Ie,
|
|
150
|
+
nolink: Re,
|
|
151
|
+
punctuation: me,
|
|
152
|
+
reflink: Le,
|
|
153
|
+
reflinkSearch: Ve,
|
|
154
|
+
tag: Pe,
|
|
155
|
+
text: pe,
|
|
156
|
+
url: a
|
|
157
|
+
}, We = {
|
|
158
|
+
...A,
|
|
159
|
+
emStrongLDelim: xe,
|
|
160
|
+
emStrongRDelimAst: Te,
|
|
161
|
+
emStrongRDelimUnd: De,
|
|
162
|
+
link: s(/^!?\[(label)\]\((.*?)\)/).replace("label", k).getRegex(),
|
|
163
|
+
reflink: s(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", k).getRegex()
|
|
164
|
+
}, j = {
|
|
165
|
+
...A,
|
|
166
|
+
emStrongRDelimAst: we,
|
|
167
|
+
emStrongLDelim: be,
|
|
168
|
+
delLDelim: Oe,
|
|
169
|
+
delRDelim: ke,
|
|
170
|
+
url: s(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Ue).replace("protocol", He).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),
|
|
169
171
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
170
172
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
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",
|
|
172
|
-
},
|
|
173
|
-
...
|
|
174
|
-
br: s(
|
|
175
|
-
text: s(
|
|
176
|
-
},
|
|
177
|
-
normal:
|
|
178
|
-
gfm:
|
|
179
|
-
pedantic:
|
|
180
|
-
},
|
|
181
|
-
normal:
|
|
182
|
-
gfm:
|
|
183
|
-
breaks:
|
|
184
|
-
pedantic:
|
|
185
|
-
},
|
|
173
|
+
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", He).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex()
|
|
174
|
+
}, Ge = {
|
|
175
|
+
...j,
|
|
176
|
+
br: s(C).replace("{2,}", "*").getRegex(),
|
|
177
|
+
text: s(j.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
178
|
+
}, M = {
|
|
179
|
+
normal: S,
|
|
180
|
+
gfm: le,
|
|
181
|
+
pedantic: ue
|
|
182
|
+
}, N = {
|
|
183
|
+
normal: A,
|
|
184
|
+
gfm: j,
|
|
185
|
+
breaks: Ge,
|
|
186
|
+
pedantic: We
|
|
187
|
+
}, Ke = {
|
|
186
188
|
"&": "&",
|
|
187
189
|
"<": "<",
|
|
188
190
|
">": ">",
|
|
189
191
|
"\"": """,
|
|
190
192
|
"'": "'"
|
|
191
|
-
},
|
|
192
|
-
function
|
|
193
|
+
}, P = (e) => Ke[e];
|
|
194
|
+
function F(e, t) {
|
|
193
195
|
if (t) {
|
|
194
|
-
if (l.escapeTest.test(e)) return e.replace(l.escapeReplace,
|
|
195
|
-
} else if (l.escapeTestNoEncode.test(e)) return e.replace(l.escapeReplaceNoEncode,
|
|
196
|
+
if (l.escapeTest.test(e)) return e.replace(l.escapeReplace, P);
|
|
197
|
+
} else if (l.escapeTestNoEncode.test(e)) return e.replace(l.escapeReplaceNoEncode, P);
|
|
196
198
|
return e;
|
|
197
199
|
}
|
|
198
|
-
function
|
|
199
|
-
return e.replace(l.
|
|
200
|
+
function qe(e) {
|
|
201
|
+
return l.numericCharacterReference.test(e) ? e.replace(l.numericCharacterReferenceOrAmpersand, (e, t, n) => {
|
|
202
|
+
if (t === void 0 && n === void 0) return "&";
|
|
200
203
|
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
|
-
});
|
|
204
|
+
return r === 0 || r > 1114111 || r >= 55296 && r <= 57343 ? "�" : r === 38 ? "&" : String.fromCodePoint(r);
|
|
205
|
+
}) : e;
|
|
203
206
|
}
|
|
204
|
-
function
|
|
207
|
+
function I(e) {
|
|
205
208
|
try {
|
|
206
209
|
e = encodeURI(e).replace(l.percentDecode, "%");
|
|
207
210
|
} catch {
|
|
@@ -209,7 +212,7 @@ function H(e) {
|
|
|
209
212
|
}
|
|
210
213
|
return e;
|
|
211
214
|
}
|
|
212
|
-
function
|
|
215
|
+
function L(e, t) {
|
|
213
216
|
let n = e.replace(l.findPipe, (e, t, n) => {
|
|
214
217
|
let r = !1, i = t;
|
|
215
218
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
@@ -222,7 +225,7 @@ function U(e, t) {
|
|
|
222
225
|
for (; r < n.length; r++) n[r] = n[r].trim().replace(l.slashPipe, "|");
|
|
223
226
|
return n;
|
|
224
227
|
}
|
|
225
|
-
function
|
|
228
|
+
function R(e, t, n) {
|
|
226
229
|
let r = e.length;
|
|
227
230
|
if (r === 0) return "";
|
|
228
231
|
let i = 0;
|
|
@@ -234,15 +237,15 @@ function W(e, t, n) {
|
|
|
234
237
|
}
|
|
235
238
|
return e.slice(0, r - i);
|
|
236
239
|
}
|
|
237
|
-
function
|
|
240
|
+
function z(e) {
|
|
238
241
|
let t = e.split("\n"), n = t.length - 1;
|
|
239
242
|
for (; n >= 0 && l.blankLine.test(t[n]);) n--;
|
|
240
243
|
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
241
244
|
}
|
|
242
|
-
function
|
|
245
|
+
function B(e) {
|
|
243
246
|
return e.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
244
247
|
}
|
|
245
|
-
function
|
|
248
|
+
function V(e, t) {
|
|
246
249
|
if (e.indexOf(t[0]) === -1 && e.indexOf(t[1]) === -1) return -1;
|
|
247
250
|
let n = 0;
|
|
248
251
|
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
@@ -250,7 +253,7 @@ function He(e, t) {
|
|
|
250
253
|
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
251
254
|
return n > 0 ? -2 : -1;
|
|
252
255
|
}
|
|
253
|
-
function
|
|
256
|
+
function H(e, t = 0) {
|
|
254
257
|
let n = t, r = "";
|
|
255
258
|
for (let t of e) if (t === " ") {
|
|
256
259
|
let e = 4 - n % 4;
|
|
@@ -258,15 +261,13 @@ function Ue(e, t = 0) {
|
|
|
258
261
|
} else r += t, n++;
|
|
259
262
|
return r;
|
|
260
263
|
}
|
|
261
|
-
function
|
|
262
|
-
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1"), c = e[0].charAt(0) === "!";
|
|
263
|
-
r.state.inLink = !0;
|
|
264
|
-
let
|
|
265
|
-
r.state.linkEmitted = !
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (f) {
|
|
269
|
-
r.state.inRawBlock = u;
|
|
264
|
+
function U(e, t, n, r, i) {
|
|
265
|
+
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1"), c = e[0].charAt(0) === "!", l = r.state.inLink, u = r.state.linkEmitted, d = r.state.inRawBlock;
|
|
266
|
+
r.state.inLink = !0, r.state.linkEmitted = !1;
|
|
267
|
+
let f = r.inlineTokens(s), p = r.state.linkEmitted;
|
|
268
|
+
if (r.state.linkEmitted = u, r.state.inLink = l, !c) {
|
|
269
|
+
if (p) {
|
|
270
|
+
r.state.inRawBlock = d;
|
|
270
271
|
return;
|
|
271
272
|
}
|
|
272
273
|
r.state.linkEmitted = !0;
|
|
@@ -277,10 +278,10 @@ function We(e, t, n, r, i) {
|
|
|
277
278
|
href: a,
|
|
278
279
|
title: o,
|
|
279
280
|
text: s,
|
|
280
|
-
tokens:
|
|
281
|
+
tokens: f
|
|
281
282
|
};
|
|
282
283
|
}
|
|
283
|
-
function
|
|
284
|
+
function Je(e, t, n) {
|
|
284
285
|
let r = e.match(n.other.indentCodeCompensation);
|
|
285
286
|
if (r === null) return t;
|
|
286
287
|
let i = r[1];
|
|
@@ -291,7 +292,7 @@ function Ge(e, t, n) {
|
|
|
291
292
|
return e.slice(Math.min(r.length, i.length));
|
|
292
293
|
}).join("\n");
|
|
293
294
|
}
|
|
294
|
-
function
|
|
295
|
+
function W(e, t, n, r) {
|
|
295
296
|
if (!t.includes("<")) return !1;
|
|
296
297
|
for (let i = 0; i < t.length; i++) {
|
|
297
298
|
if (t[i] === "\\") {
|
|
@@ -314,7 +315,7 @@ function Ke(e, t, n, r) {
|
|
|
314
315
|
}
|
|
315
316
|
return !1;
|
|
316
317
|
}
|
|
317
|
-
var
|
|
318
|
+
var G = class {
|
|
318
319
|
options;
|
|
319
320
|
rules;
|
|
320
321
|
lexer;
|
|
@@ -331,7 +332,7 @@ var K = class {
|
|
|
331
332
|
code(e) {
|
|
332
333
|
let t = this.rules.block.code.exec(e);
|
|
333
334
|
if (t) {
|
|
334
|
-
let e = this.options.pedantic ? t[0] :
|
|
335
|
+
let e = this.options.pedantic ? t[0] : z(t[0]);
|
|
335
336
|
return {
|
|
336
337
|
type: "code",
|
|
337
338
|
raw: e,
|
|
@@ -343,7 +344,7 @@ var K = class {
|
|
|
343
344
|
fences(e) {
|
|
344
345
|
let t = this.rules.block.fences.exec(e);
|
|
345
346
|
if (t) {
|
|
346
|
-
let e = t[0], n =
|
|
347
|
+
let e = t[0], n = Je(e, t[3] || "", this.rules);
|
|
347
348
|
return {
|
|
348
349
|
type: "code",
|
|
349
350
|
raw: e,
|
|
@@ -357,12 +358,12 @@ var K = class {
|
|
|
357
358
|
if (t) {
|
|
358
359
|
let e = t[2].trim();
|
|
359
360
|
if (this.rules.other.endingHash.test(e)) {
|
|
360
|
-
let t =
|
|
361
|
+
let t = R(e, "#");
|
|
361
362
|
(this.options.pedantic || !t || this.rules.other.endingSpaceTabChar.test(t)) && (e = t.trim());
|
|
362
363
|
}
|
|
363
364
|
return {
|
|
364
365
|
type: "heading",
|
|
365
|
-
raw:
|
|
366
|
+
raw: R(t[0], "\n"),
|
|
366
367
|
depth: t[1].length,
|
|
367
368
|
text: e,
|
|
368
369
|
tokens: this.lexer.inline(e)
|
|
@@ -373,13 +374,13 @@ var K = class {
|
|
|
373
374
|
let t = this.rules.block.hr.exec(e);
|
|
374
375
|
if (t) return {
|
|
375
376
|
type: "hr",
|
|
376
|
-
raw:
|
|
377
|
+
raw: R(t[0], "\n")
|
|
377
378
|
};
|
|
378
379
|
}
|
|
379
380
|
blockquote(e) {
|
|
380
381
|
let t = this.rules.block.blockquote.exec(e);
|
|
381
382
|
if (t) {
|
|
382
|
-
let e =
|
|
383
|
+
let e = R(t[0], "\n").split("\n"), n = "", r = "", i = [];
|
|
383
384
|
for (; e.length > 0;) {
|
|
384
385
|
let t = !1, a = [], o = 0;
|
|
385
386
|
for (; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
|
|
@@ -393,7 +394,7 @@ ${c}` : c;
|
|
|
393
394
|
let l = this.lexer.state.top;
|
|
394
395
|
if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
|
|
395
396
|
let u = i.at(-1);
|
|
396
|
-
if (u?.type === "code") break;
|
|
397
|
+
if (u?.type === "code" || u?.type === "heading" || u?.type === "hr" || u?.type === "html") break;
|
|
397
398
|
if (u?.type === "blockquote") {
|
|
398
399
|
let t = u, a = e.join("\n"), o = t.raw + "\n" + a.replace(this.rules.other.blockquoteSetextReplace2, ""), s = this.blockquote(o);
|
|
399
400
|
i[i.length - 1] = s;
|
|
@@ -418,52 +419,54 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
418
419
|
list(e) {
|
|
419
420
|
let t = this.rules.block.list.exec(e);
|
|
420
421
|
if (t) {
|
|
421
|
-
let n = t[1].trim(),
|
|
422
|
+
let n = e, r = () => n.length - e.length, i = t[1].trim(), a = i.length > 1, o = {
|
|
422
423
|
type: "list",
|
|
423
424
|
raw: "",
|
|
424
|
-
ordered:
|
|
425
|
-
start:
|
|
425
|
+
ordered: a,
|
|
426
|
+
start: a ? +i.slice(0, -1) : "",
|
|
426
427
|
loose: !1,
|
|
427
428
|
items: []
|
|
428
429
|
};
|
|
429
|
-
|
|
430
|
-
let
|
|
430
|
+
i = a ? `\\d{1,9}\\${i.slice(-1)}` : `\\${i}`, this.options.pedantic && (i = a ? i : "[*+-]");
|
|
431
|
+
let s = this.rules.other.listItemRegex(i), c = !1;
|
|
431
432
|
for (; e;) {
|
|
432
|
-
let
|
|
433
|
-
if (!(t =
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
433
|
+
let i = !1, a = "";
|
|
434
|
+
if (!(t = s.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
435
|
+
let l = r();
|
|
436
|
+
e = e.substring(t[0].length);
|
|
437
|
+
let u = t[2].split("\n", 1)[0], d = t[1].length, f = this.options.pedantic ? H(u, d) : u.replace(this.rules.other.leadingSpaceTab, (e) => H(e, d)), p = e.split("\n", 1)[0], m = !f.trim(), h = 0;
|
|
438
|
+
if (this.options.pedantic ? (h = 2, a = f.trimStart()) : m ? h = d + 1 : (h = f.search(this.rules.other.nonSpaceChar), h = h > 4 ? 1 : h, a = f.slice(h), h += d), m && this.rules.other.blankLine.test(p) && (e = e.substring(p.length + 1), i = !0), !i) {
|
|
439
|
+
let t = this.rules.other.nextBulletRegex(h), n = this.rules.other.hrRegex(h), r = this.rules.other.fencesBeginRegex(h), i = this.rules.other.headingBeginRegex(h), o = this.rules.other.htmlBeginRegex(h), s = this.rules.other.blockquoteBeginRegex(h);
|
|
438
440
|
for (; e;) {
|
|
439
|
-
let
|
|
440
|
-
if (
|
|
441
|
-
if (
|
|
441
|
+
let c = e.split("\n", 1)[0], l;
|
|
442
|
+
if (p = c, this.options.pedantic ? (p = p.replace(this.rules.other.listReplaceNesting, " "), l = p) : l = p.replace(this.rules.other.leadingSpaceTab, (e) => H(e)), r.test(p) || i.test(p) || o.test(p) || s.test(p) || t.test(p) || n.test(p)) break;
|
|
443
|
+
if (l.search(this.rules.other.nonSpaceChar) >= h || !p.trim()) a += "\n" + l.slice(h);
|
|
442
444
|
else {
|
|
443
|
-
if (
|
|
444
|
-
|
|
445
|
+
if (m || f.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || r.test(f) || i.test(f) || n.test(f)) break;
|
|
446
|
+
a += "\n" + p;
|
|
445
447
|
}
|
|
446
|
-
|
|
448
|
+
m = !p.trim(), e = e.substring(c.length + 1), f = l.slice(h);
|
|
447
449
|
}
|
|
448
450
|
}
|
|
449
|
-
|
|
451
|
+
let g = n.slice(l, r());
|
|
452
|
+
o.loose || (c ? o.loose = !0 : this.rules.other.doubleBlankLine.test(g) && (c = !0)), o.items.push({
|
|
450
453
|
type: "list_item",
|
|
451
|
-
raw:
|
|
452
|
-
task: !!this.options.gfm && this.rules.other.listIsTask.test(
|
|
454
|
+
raw: g,
|
|
455
|
+
task: !!this.options.gfm && this.rules.other.listIsTask.test(a),
|
|
453
456
|
loose: !1,
|
|
454
|
-
text:
|
|
457
|
+
text: a,
|
|
455
458
|
tokens: []
|
|
456
|
-
})
|
|
459
|
+
});
|
|
457
460
|
}
|
|
458
|
-
let
|
|
459
|
-
if (
|
|
461
|
+
let l = o.items.at(-1);
|
|
462
|
+
if (l) l.raw = l.raw.trimEnd(), l.text = l.text.trimEnd();
|
|
460
463
|
else return;
|
|
461
|
-
|
|
462
|
-
for (let e of
|
|
464
|
+
o.raw = n.slice(0, r()).trimEnd();
|
|
465
|
+
for (let e of o.items) if (this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []), !o.loose) {
|
|
463
466
|
let t = e.tokens.filter((e) => e.type === "space");
|
|
464
|
-
|
|
467
|
+
o.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
|
|
465
468
|
}
|
|
466
|
-
for (let e of
|
|
469
|
+
for (let e of o.items) {
|
|
467
470
|
let t = e.tokens[0];
|
|
468
471
|
if (e.task && (t?.type === "text" || t?.type === "paragraph")) {
|
|
469
472
|
e.text = e.text.replace(this.rules.other.listReplaceTask, ""), t.raw = t.raw.replace(this.rules.other.listReplaceTask, ""), t.text = t.text.replace(this.rules.other.listReplaceTask, "");
|
|
@@ -478,7 +481,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
478
481
|
raw: n[0] + " ",
|
|
479
482
|
checked: n[0] !== "[ ]"
|
|
480
483
|
};
|
|
481
|
-
e.checked = t.checked,
|
|
484
|
+
e.checked = t.checked, o.loose ? e.tokens[0] && ["paragraph", "text"].includes(e.tokens[0].type) && "tokens" in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = t.raw + e.tokens[0].raw, e.tokens[0].text = t.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(t)) : e.tokens.unshift({
|
|
482
485
|
type: "paragraph",
|
|
483
486
|
raw: t.raw,
|
|
484
487
|
text: t.raw,
|
|
@@ -487,17 +490,17 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
487
490
|
}
|
|
488
491
|
} else e.task &&= !1;
|
|
489
492
|
}
|
|
490
|
-
if (
|
|
493
|
+
if (o.loose) for (let e of o.items) {
|
|
491
494
|
e.loose = !0;
|
|
492
495
|
for (let t of e.tokens) t.type === "text" && (t.type = "paragraph");
|
|
493
496
|
}
|
|
494
|
-
return
|
|
497
|
+
return o;
|
|
495
498
|
}
|
|
496
499
|
}
|
|
497
500
|
html(e) {
|
|
498
501
|
let t = this.rules.block.html.exec(e);
|
|
499
502
|
if (t) {
|
|
500
|
-
let e =
|
|
503
|
+
let e = z(t[0]);
|
|
501
504
|
return {
|
|
502
505
|
type: "html",
|
|
503
506
|
block: !0,
|
|
@@ -510,12 +513,12 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
510
513
|
def(e) {
|
|
511
514
|
let t = this.rules.block.def.exec(e);
|
|
512
515
|
if (t) {
|
|
513
|
-
if (!this.rules.other.startAngleBracket.test(t[2]) &&
|
|
514
|
-
let e =
|
|
516
|
+
if (!this.rules.other.startAngleBracket.test(t[2]) && V(t[2], "()") !== -1) return;
|
|
517
|
+
let e = B(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];
|
|
515
518
|
return {
|
|
516
519
|
type: "def",
|
|
517
520
|
tag: e,
|
|
518
|
-
raw:
|
|
521
|
+
raw: R(t[0], "\n"),
|
|
519
522
|
href: n,
|
|
520
523
|
title: r
|
|
521
524
|
};
|
|
@@ -524,9 +527,9 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
524
527
|
table(e) {
|
|
525
528
|
let t = this.rules.block.table.exec(e);
|
|
526
529
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
527
|
-
let n =
|
|
530
|
+
let n = L(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 = {
|
|
528
531
|
type: "table",
|
|
529
|
-
raw:
|
|
532
|
+
raw: R(t[0], "\n"),
|
|
530
533
|
header: [],
|
|
531
534
|
align: [],
|
|
532
535
|
rows: []
|
|
@@ -539,7 +542,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
539
542
|
header: !0,
|
|
540
543
|
align: a.align[e]
|
|
541
544
|
});
|
|
542
|
-
for (let e of i) a.rows.push(
|
|
545
|
+
for (let e of i) a.rows.push(L(e, a.header.length).map((e, t) => ({
|
|
543
546
|
text: e,
|
|
544
547
|
tokens: this.lexer.inline(e),
|
|
545
548
|
header: !1,
|
|
@@ -554,7 +557,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
554
557
|
let e = t[1].trim();
|
|
555
558
|
return {
|
|
556
559
|
type: "heading",
|
|
557
|
-
raw:
|
|
560
|
+
raw: R(t[0], "\n"),
|
|
558
561
|
depth: t[2].charAt(0) === "=" ? 1 : 2,
|
|
559
562
|
text: e,
|
|
560
563
|
tokens: this.lexer.inline(e)
|
|
@@ -606,14 +609,14 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
606
609
|
let t = this.rules.inline.link.exec(e);
|
|
607
610
|
if (t) {
|
|
608
611
|
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
609
|
-
if (!this.options.pedantic &&
|
|
612
|
+
if (!this.options.pedantic && W(e, t[1], n, this.rules)) return;
|
|
610
613
|
let r = t[2].trim();
|
|
611
614
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
|
|
612
615
|
if (!this.rules.other.endAngleBracket.test(r)) return;
|
|
613
|
-
let e =
|
|
616
|
+
let e = R(r.slice(0, -1), "\\");
|
|
614
617
|
if ((r.length - e.length) % 2 == 0) return;
|
|
615
618
|
} else {
|
|
616
|
-
let e =
|
|
619
|
+
let e = V(t[2], "()");
|
|
617
620
|
if (e === -2) return;
|
|
618
621
|
if (e > -1) {
|
|
619
622
|
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
@@ -625,7 +628,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
625
628
|
let e = this.rules.other.pedanticHrefTitle.exec(i);
|
|
626
629
|
e && (i = e[1], a = e[3]);
|
|
627
630
|
} else a = t[3] ? t[3].slice(1, -1) : "";
|
|
628
|
-
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)),
|
|
631
|
+
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)), U(t, {
|
|
629
632
|
href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
630
633
|
title: a && a.replace(this.rules.inline.anyPunctuation, "$1")
|
|
631
634
|
}, t[0], this.lexer, this.rules);
|
|
@@ -635,8 +638,8 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
635
638
|
let n;
|
|
636
639
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
637
640
|
let r = n[0].charAt(0) === "!" ? 2 : 1;
|
|
638
|
-
if (!this.options.pedantic &&
|
|
639
|
-
let i = t[
|
|
641
|
+
if (!this.options.pedantic && W(e, n[1], r, this.rules)) return;
|
|
642
|
+
let i = t[B((n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "))];
|
|
640
643
|
if (!i) {
|
|
641
644
|
let e = n[0].charAt(0);
|
|
642
645
|
return {
|
|
@@ -645,7 +648,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
645
648
|
text: e
|
|
646
649
|
};
|
|
647
650
|
}
|
|
648
|
-
return
|
|
651
|
+
return U(n, i, n[0], this.lexer, this.rules);
|
|
649
652
|
}
|
|
650
653
|
}
|
|
651
654
|
emStrong(e, t, n = "") {
|
|
@@ -778,19 +781,19 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
778
781
|
return {
|
|
779
782
|
type: "text",
|
|
780
783
|
raw: t[0],
|
|
781
|
-
text: e ? t[0] :
|
|
784
|
+
text: e ? t[0] : qe(t[0]),
|
|
782
785
|
escaped: e
|
|
783
786
|
};
|
|
784
787
|
}
|
|
785
788
|
}
|
|
786
|
-
},
|
|
789
|
+
}, K = class e {
|
|
787
790
|
tokens;
|
|
788
791
|
options;
|
|
789
792
|
state;
|
|
790
793
|
inlineQueue;
|
|
791
794
|
tokenizer;
|
|
792
795
|
constructor(e) {
|
|
793
|
-
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || r, this.options.tokenizer = this.options.tokenizer || new
|
|
796
|
+
this.tokens = [], this.tokens.links = Object.create(null), this.options = e || r, this.options.tokenizer = this.options.tokenizer || new G(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
|
|
794
797
|
inLink: !1,
|
|
795
798
|
inRawBlock: !1,
|
|
796
799
|
linkEmitted: !1,
|
|
@@ -799,15 +802,15 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
799
802
|
};
|
|
800
803
|
let t = {
|
|
801
804
|
other: l,
|
|
802
|
-
block:
|
|
803
|
-
inline:
|
|
805
|
+
block: M.normal,
|
|
806
|
+
inline: N.normal
|
|
804
807
|
};
|
|
805
|
-
this.options.pedantic ? (t.block =
|
|
808
|
+
this.options.pedantic ? (t.block = M.pedantic, t.inline = N.pedantic) : this.options.gfm && (t.block = M.gfm, t.inline = this.options.breaks ? N.breaks : N.gfm), this.tokenizer.rules = t;
|
|
806
809
|
}
|
|
807
810
|
static get rules() {
|
|
808
811
|
return {
|
|
809
|
-
block:
|
|
810
|
-
inline:
|
|
812
|
+
block: M,
|
|
813
|
+
inline: N
|
|
811
814
|
};
|
|
812
815
|
}
|
|
813
816
|
static lex(t, n) {
|
|
@@ -897,7 +900,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
897
900
|
for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return !0;
|
|
898
901
|
for (let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
899
902
|
let e = t[0], n = e.lastIndexOf("[");
|
|
900
|
-
if (e.charAt(0) !== "!" && Object.hasOwn(this.tokens.links,
|
|
903
|
+
if (e.charAt(0) !== "!" && Object.hasOwn(this.tokens.links, B(e.slice(n + 1, -1))) && !(n > 1 && this.linkInText(e.slice(1, n - 1)))) return !0;
|
|
901
904
|
}
|
|
902
905
|
return !1;
|
|
903
906
|
}
|
|
@@ -916,7 +919,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
916
919
|
if (this.tokens.links && e.includes("[")) {
|
|
917
920
|
let e = this.tokenizer.rules.inline.reflinkSearch, t = (n) => {
|
|
918
921
|
let r = n.lastIndexOf("[");
|
|
919
|
-
if (!Object.hasOwn(this.tokens.links,
|
|
922
|
+
if (!Object.hasOwn(this.tokens.links, B(n.slice(r + 1, -1)))) return n;
|
|
920
923
|
if (r > 1 && n.charAt(0) !== "!") {
|
|
921
924
|
let i = n.slice(1, r - 1);
|
|
922
925
|
if (this.linkInText(i)) return "[" + i.replace(e, t) + "][" + "a".repeat(n.length - r - 2) + "]";
|
|
@@ -925,7 +928,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
925
928
|
};
|
|
926
929
|
n = n.replace(e, t);
|
|
927
930
|
}
|
|
928
|
-
n = n.replace(this.tokenizer.rules.inline.
|
|
931
|
+
n = n.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode, (e, t, n) => n ? "+".repeat(e.length) : t ? t + e.slice(t.length, -t.length).replace(/`/g, "+") + t : e), n = n.replace(this.tokenizer.rules.inline.blockSkip, (e, t, n) => {
|
|
929
932
|
let r = n ? n.length : 0;
|
|
930
933
|
return e.slice(0, r) + "[" + "a".repeat(e.length - r - 2) + "]";
|
|
931
934
|
}), n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
@@ -976,7 +979,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
976
979
|
if (this.options.silent) console.error(t);
|
|
977
980
|
else throw Error(t);
|
|
978
981
|
}
|
|
979
|
-
},
|
|
982
|
+
}, q = class {
|
|
980
983
|
options;
|
|
981
984
|
parser;
|
|
982
985
|
constructor(e) {
|
|
@@ -987,7 +990,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
987
990
|
}
|
|
988
991
|
code({ text: e, lang: t, escaped: n }) {
|
|
989
992
|
let r = (t || "").match(l.notSpaceStart)?.[0], i = e ? e.replace(l.endingNewline, "") + "\n" : "";
|
|
990
|
-
return r ? "<pre><code class=\"language-" +
|
|
993
|
+
return r ? "<pre><code class=\"language-" + F(r) + "\">" + (n ? i : F(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : F(i, !0)) + "</code></pre>\n";
|
|
991
994
|
}
|
|
992
995
|
blockquote({ tokens: e }) {
|
|
993
996
|
return `<blockquote>
|
|
@@ -1057,7 +1060,7 @@ ${e}</tr>
|
|
|
1057
1060
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
1058
1061
|
}
|
|
1059
1062
|
codespan({ text: e }) {
|
|
1060
|
-
return `<code>${
|
|
1063
|
+
return `<code>${F(e, !0)}</code>`;
|
|
1061
1064
|
}
|
|
1062
1065
|
br(e) {
|
|
1063
1066
|
return "<br>";
|
|
@@ -1066,24 +1069,24 @@ ${e}</tr>
|
|
|
1066
1069
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1067
1070
|
}
|
|
1068
1071
|
link({ href: e, title: t, text: n, tokens: r, autolink: i }) {
|
|
1069
|
-
let a = i ?
|
|
1072
|
+
let a = i ? F(n, !0) : this.parser.parseInline(r), o = I(e);
|
|
1070
1073
|
if (o === null) return a;
|
|
1071
|
-
e =
|
|
1074
|
+
e = F(o, i);
|
|
1072
1075
|
let s = "<a href=\"" + e + "\"";
|
|
1073
|
-
return t && (s += " title=\"" +
|
|
1076
|
+
return t && (s += " title=\"" + F(t) + "\""), s += ">" + a + "</a>", s;
|
|
1074
1077
|
}
|
|
1075
1078
|
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1076
1079
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1077
|
-
let i =
|
|
1078
|
-
if (i === null) return
|
|
1080
|
+
let i = I(e);
|
|
1081
|
+
if (i === null) return F(n);
|
|
1079
1082
|
e = i;
|
|
1080
|
-
let a = `<img src="${
|
|
1081
|
-
return t && (a += ` title="${
|
|
1083
|
+
let a = `<img src="${F(e)}" alt="${F(n)}"`;
|
|
1084
|
+
return t && (a += ` title="${F(t)}"`), a += ">", a;
|
|
1082
1085
|
}
|
|
1083
1086
|
text(e) {
|
|
1084
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text :
|
|
1087
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : F(e.text);
|
|
1085
1088
|
}
|
|
1086
|
-
},
|
|
1089
|
+
}, J = class {
|
|
1087
1090
|
strong({ text: e }) {
|
|
1088
1091
|
return e;
|
|
1089
1092
|
}
|
|
@@ -1114,12 +1117,12 @@ ${e}</tr>
|
|
|
1114
1117
|
checkbox({ raw: e }) {
|
|
1115
1118
|
return e;
|
|
1116
1119
|
}
|
|
1117
|
-
},
|
|
1120
|
+
}, Y = class e {
|
|
1118
1121
|
options;
|
|
1119
1122
|
renderer;
|
|
1120
1123
|
textRenderer;
|
|
1121
1124
|
constructor(e) {
|
|
1122
|
-
this.options = e || r, this.options.renderer = this.options.renderer || new
|
|
1125
|
+
this.options = e || r, this.options.renderer = this.options.renderer || new q(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new J();
|
|
1123
1126
|
}
|
|
1124
1127
|
static parse(t, n) {
|
|
1125
1128
|
return new e(n).parse(t);
|
|
@@ -1267,7 +1270,7 @@ ${e}</tr>
|
|
|
1267
1270
|
}
|
|
1268
1271
|
return n;
|
|
1269
1272
|
}
|
|
1270
|
-
},
|
|
1273
|
+
}, X = class {
|
|
1271
1274
|
options;
|
|
1272
1275
|
block;
|
|
1273
1276
|
constructor(e) {
|
|
@@ -1297,45 +1300,50 @@ ${e}</tr>
|
|
|
1297
1300
|
return e;
|
|
1298
1301
|
}
|
|
1299
1302
|
provideLexer(e = this.block) {
|
|
1300
|
-
return e ?
|
|
1303
|
+
return e ? K.lex : K.lexInline;
|
|
1301
1304
|
}
|
|
1302
1305
|
provideParser(e = this.block) {
|
|
1303
|
-
return e ?
|
|
1306
|
+
return e ? Y.parse : Y.parseInline;
|
|
1304
1307
|
}
|
|
1305
|
-
}
|
|
1308
|
+
};
|
|
1309
|
+
function Z(e, t) {
|
|
1310
|
+
if (Array.isArray(t)) for (let n = 0; n < t.length; n++) e.push(t[n]);
|
|
1311
|
+
else e.push(t);
|
|
1312
|
+
}
|
|
1313
|
+
var Q = new class {
|
|
1306
1314
|
defaults = n();
|
|
1307
1315
|
options = this.setOptions;
|
|
1308
1316
|
parse = this.parseMarkdown(!0);
|
|
1309
1317
|
parseInline = this.parseMarkdown(!1);
|
|
1310
|
-
Parser =
|
|
1311
|
-
Renderer =
|
|
1312
|
-
TextRenderer =
|
|
1313
|
-
Lexer =
|
|
1314
|
-
Tokenizer =
|
|
1315
|
-
Hooks =
|
|
1318
|
+
Parser = Y;
|
|
1319
|
+
Renderer = q;
|
|
1320
|
+
TextRenderer = J;
|
|
1321
|
+
Lexer = K;
|
|
1322
|
+
Tokenizer = G;
|
|
1323
|
+
Hooks = X;
|
|
1316
1324
|
constructor(...e) {
|
|
1317
1325
|
this.use(...e);
|
|
1318
1326
|
}
|
|
1319
1327
|
walkTokens(e, t) {
|
|
1320
1328
|
let n = [];
|
|
1321
|
-
for (let r of e) switch (n
|
|
1329
|
+
for (let r of e) switch (Z(n, t.call(this, r)), r.type) {
|
|
1322
1330
|
case "table": {
|
|
1323
1331
|
let e = r;
|
|
1324
|
-
for (let r of e.header) n
|
|
1325
|
-
for (let r of e.rows) for (let e of r) n
|
|
1332
|
+
for (let r of e.header) Z(n, this.walkTokens(r.tokens, t));
|
|
1333
|
+
for (let r of e.rows) for (let e of r) Z(n, this.walkTokens(e.tokens, t));
|
|
1326
1334
|
break;
|
|
1327
1335
|
}
|
|
1328
1336
|
case "list": {
|
|
1329
1337
|
let e = r;
|
|
1330
|
-
n
|
|
1338
|
+
Z(n, this.walkTokens(e.items, t));
|
|
1331
1339
|
break;
|
|
1332
1340
|
}
|
|
1333
1341
|
default: {
|
|
1334
1342
|
let e = r;
|
|
1335
1343
|
this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
|
|
1336
1344
|
let i = e[r].flat(1 / 0);
|
|
1337
|
-
n
|
|
1338
|
-
}) : e.tokens && (n
|
|
1345
|
+
Z(n, this.walkTokens(i, t));
|
|
1346
|
+
}) : e.tokens && Z(n, this.walkTokens(e.tokens, t));
|
|
1339
1347
|
}
|
|
1340
1348
|
}
|
|
1341
1349
|
return n;
|
|
@@ -1363,7 +1371,7 @@ ${e}</tr>
|
|
|
1363
1371
|
}
|
|
1364
1372
|
"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
|
|
1365
1373
|
}), n.extensions = t), e.renderer) {
|
|
1366
|
-
let t = this.defaults.renderer || new
|
|
1374
|
+
let t = this.defaults.renderer || new q(this.defaults);
|
|
1367
1375
|
for (let n in e.renderer) {
|
|
1368
1376
|
if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
|
|
1369
1377
|
if (["options", "parser"].includes(n)) continue;
|
|
@@ -1376,7 +1384,7 @@ ${e}</tr>
|
|
|
1376
1384
|
n.renderer = t;
|
|
1377
1385
|
}
|
|
1378
1386
|
if (e.tokenizer) {
|
|
1379
|
-
let t = this.defaults.tokenizer || new
|
|
1387
|
+
let t = this.defaults.tokenizer || new G(this.defaults);
|
|
1380
1388
|
for (let n in e.tokenizer) {
|
|
1381
1389
|
if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
|
|
1382
1390
|
if ([
|
|
@@ -1393,13 +1401,13 @@ ${e}</tr>
|
|
|
1393
1401
|
n.tokenizer = t;
|
|
1394
1402
|
}
|
|
1395
1403
|
if (e.hooks) {
|
|
1396
|
-
let t = this.defaults.hooks || new
|
|
1404
|
+
let t = this.defaults.hooks || new X();
|
|
1397
1405
|
for (let n in e.hooks) {
|
|
1398
1406
|
if (!(n in t)) throw Error(`hook '${n}' does not exist`);
|
|
1399
1407
|
if (["options", "block"].includes(n)) continue;
|
|
1400
1408
|
let r = n, i = e.hooks[r], a = t[r];
|
|
1401
|
-
t[r] =
|
|
1402
|
-
if (this.defaults.async &&
|
|
1409
|
+
t[r] = X.passThroughHooks.has(n) ? (e) => {
|
|
1410
|
+
if (this.defaults.async && X.passThroughHooksRespectAsync.has(n)) return (async () => {
|
|
1403
1411
|
let n = await i.call(t, e);
|
|
1404
1412
|
return a.call(t, n);
|
|
1405
1413
|
})();
|
|
@@ -1420,7 +1428,7 @@ ${e}</tr>
|
|
|
1420
1428
|
let t = this.defaults.walkTokens, r = e.walkTokens;
|
|
1421
1429
|
n.walkTokens = function(e) {
|
|
1422
1430
|
let n = [];
|
|
1423
|
-
return n.push(r.call(this, e)), t && (n
|
|
1431
|
+
return n.push(r.call(this, e)), t && Z(n, t.call(this, e)), n;
|
|
1424
1432
|
};
|
|
1425
1433
|
}
|
|
1426
1434
|
this.defaults = {
|
|
@@ -1436,10 +1444,10 @@ ${e}</tr>
|
|
|
1436
1444
|
}, this;
|
|
1437
1445
|
}
|
|
1438
1446
|
lexer(e, t) {
|
|
1439
|
-
return
|
|
1447
|
+
return K.lex(e, t ?? this.defaults);
|
|
1440
1448
|
}
|
|
1441
1449
|
parser(e, t) {
|
|
1442
|
-
return
|
|
1450
|
+
return Y.parse(e, t ?? this.defaults);
|
|
1443
1451
|
}
|
|
1444
1452
|
parseMarkdown(e) {
|
|
1445
1453
|
return (t, n) => {
|
|
@@ -1451,16 +1459,16 @@ ${e}</tr>
|
|
|
1451
1459
|
if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
|
|
1452
1460
|
if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
|
|
1453
1461
|
if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
|
|
1454
|
-
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ?
|
|
1462
|
+
let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? K.lex : K.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
|
|
1455
1463
|
i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
|
|
1456
|
-
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ?
|
|
1464
|
+
let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? Y.parse : Y.parseInline)(a, i);
|
|
1457
1465
|
return i.hooks ? await i.hooks.postprocess(o) : o;
|
|
1458
1466
|
})().catch(a);
|
|
1459
1467
|
try {
|
|
1460
1468
|
i.hooks && (t = i.hooks.preprocess(t));
|
|
1461
|
-
let n = (i.hooks ? i.hooks.provideLexer(e) : e ?
|
|
1469
|
+
let n = (i.hooks ? i.hooks.provideLexer(e) : e ? K.lex : K.lexInline)(t, i);
|
|
1462
1470
|
i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
|
|
1463
|
-
let r = (i.hooks ? i.hooks.provideParser(e) : e ?
|
|
1471
|
+
let r = (i.hooks ? i.hooks.provideParser(e) : e ? Y.parse : Y.parseInline)(n, i);
|
|
1464
1472
|
return i.hooks && (r = i.hooks.postprocess(r)), r;
|
|
1465
1473
|
} catch (e) {
|
|
1466
1474
|
return a(e);
|
|
@@ -1470,7 +1478,7 @@ ${e}</tr>
|
|
|
1470
1478
|
onError(e, t) {
|
|
1471
1479
|
return (n) => {
|
|
1472
1480
|
if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
|
|
1473
|
-
let e = "<p>An error occurred:</p><pre>" +
|
|
1481
|
+
let e = "<p>An error occurred:</p><pre>" + F(n.message + "", !0) + "</pre>";
|
|
1474
1482
|
return t ? Promise.resolve(e) : e;
|
|
1475
1483
|
}
|
|
1476
1484
|
if (t) return Promise.reject(n);
|
|
@@ -1484,47 +1492,47 @@ function $(e, t) {
|
|
|
1484
1492
|
$.options = $.setOptions = function(e) {
|
|
1485
1493
|
return Q.setOptions(e), $.defaults = Q.defaults, i($.defaults), $;
|
|
1486
1494
|
}, $.getDefaults = n, $.defaults = r;
|
|
1487
|
-
function
|
|
1495
|
+
function Ye(...e) {
|
|
1488
1496
|
return Q.use(...e), $.defaults = Q.defaults, i($.defaults), $;
|
|
1489
1497
|
}
|
|
1490
|
-
$.use =
|
|
1498
|
+
$.use = Ye, $.walkTokens = function(e, t) {
|
|
1491
1499
|
return Q.walkTokens(e, t);
|
|
1492
|
-
}, $.parseInline = Q.parseInline, $.Parser =
|
|
1500
|
+
}, $.parseInline = Q.parseInline, $.Parser = Y, $.parser = Y.parse, $.Renderer = q, $.TextRenderer = J, $.Lexer = K, $.lexer = K.lex, $.Tokenizer = G, $.Hooks = X, $.parse = $, $.options, $.setOptions, $.walkTokens, $.parseInline, Y.parse, K.lex;
|
|
1493
1501
|
//#endregion
|
|
1494
1502
|
//#region lib/utils/markdown-to-html.ts
|
|
1495
|
-
var
|
|
1503
|
+
var Xe = /* @__PURE__ */ new Set([
|
|
1496
1504
|
"info",
|
|
1497
1505
|
"tip",
|
|
1498
1506
|
"warning",
|
|
1499
1507
|
"caution"
|
|
1500
|
-
]),
|
|
1508
|
+
]), Ze = [
|
|
1501
1509
|
"width",
|
|
1502
1510
|
"min-width",
|
|
1503
1511
|
"max-width",
|
|
1504
1512
|
"text-align"
|
|
1505
|
-
],
|
|
1513
|
+
], Qe = (e) => {
|
|
1506
1514
|
let t = e?.trim().toLowerCase();
|
|
1507
|
-
return t &&
|
|
1508
|
-
},
|
|
1509
|
-
let t = e.matches("table, col, th, td") ?
|
|
1515
|
+
return t && Xe.has(t) ? t : "info";
|
|
1516
|
+
}, $e = (e) => {
|
|
1517
|
+
let t = e.matches("table, col, th, td") ? Ze.map((t) => [t, e.style.getPropertyValue(t)]).filter(([, e]) => !!e) : [];
|
|
1510
1518
|
e.removeAttribute("style"), t.forEach(([t, n]) => {
|
|
1511
1519
|
e.style.setProperty(t, n);
|
|
1512
1520
|
});
|
|
1513
|
-
},
|
|
1521
|
+
}, et = (e) => {
|
|
1514
1522
|
let t = document.createElement("div");
|
|
1515
1523
|
return t.innerHTML = e, t.querySelectorAll("aside[data-type=\"callout\"]").forEach((e) => {
|
|
1516
|
-
let t =
|
|
1524
|
+
let t = Qe(e.getAttribute("data-variant"));
|
|
1517
1525
|
Array.from(e.attributes).forEach((t) => {
|
|
1518
1526
|
t.name !== "data-type" && t.name !== "data-variant" && t.name !== "role" && e.removeAttribute(t.name);
|
|
1519
1527
|
}), e.setAttribute("data-type", "callout"), e.setAttribute("data-variant", t), e.setAttribute("role", "note"), [e, ...Array.from(e.querySelectorAll("*"))].forEach((e) => {
|
|
1520
|
-
|
|
1528
|
+
$e(e), Array.from(e.attributes).forEach((t) => {
|
|
1521
1529
|
t.name.toLowerCase().startsWith("on") && e.removeAttribute(t.name);
|
|
1522
1530
|
});
|
|
1523
1531
|
});
|
|
1524
1532
|
}), t.innerHTML;
|
|
1525
|
-
},
|
|
1533
|
+
}, tt = (t) => {
|
|
1526
1534
|
let n = document.createElement("div");
|
|
1527
1535
|
return n.innerHTML = t, e(n), n.innerHTML;
|
|
1528
|
-
},
|
|
1536
|
+
}, nt = (e) => tt(et(t.sanitize($.parse(e, { async: !1 }), { ADD_ATTR: ["colwidth"] })));
|
|
1529
1537
|
//#endregion
|
|
1530
|
-
export { $ as n,
|
|
1538
|
+
export { $ as n, nt as t };
|