@siladev/qalam 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{QalamEditor-BimErEqm.js → QalamEditor-DkyAhGNj.js} +2325 -2208
- package/dist/editor/extensions/blockquote-repeat.d.ts.map +1 -1
- package/dist/editor/extensions/hadith-ref.d.ts.map +1 -1
- package/dist/editor/extensions/markdown-utils.d.ts +17 -10
- package/dist/editor/extensions/markdown-utils.d.ts.map +1 -1
- package/dist/editor/extensions/poem.d.ts.map +1 -1
- package/dist/editor/extensions/prophetic-speech.d.ts.map +1 -1
- package/dist/editor/extensions/quote.d.ts.map +1 -1
- package/dist/editor/extensions/quran-ref.d.ts.map +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/index.js +137 -123
- package/dist/markdown/index.d.ts +9 -1
- package/dist/markdown/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { validateAST as
|
|
2
|
-
import { E as
|
|
3
|
-
import { Q as
|
|
4
|
-
import { Q as
|
|
5
|
-
import { resolveAST as
|
|
6
|
-
import { g as
|
|
7
|
-
function
|
|
1
|
+
import { validateAST as Yt } from "./schema/index.js";
|
|
2
|
+
import { E as Ce, c as v, f as Ee, g as H, b as _e, i as Ie, P as Pe, d as Le, e as Be, h as He, j as Oe, k as qe, B as De, l as Ne, a as Fe, H as Qe, m as Ze, n as je, I as We, o as Ge, p as Xe, q as Ke, L as Ue } from "./QalamEditor-DkyAhGNj.js";
|
|
3
|
+
import { Q as tn } from "./QalamEditor-DkyAhGNj.js";
|
|
4
|
+
import { Q as rn } from "./QalamRenderer-CbbJYMLn.js";
|
|
5
|
+
import { resolveAST as an } from "./resolver/index.js";
|
|
6
|
+
import { g as on, a as cn, b as hn, i as pn, l as un, r as dn } from "./lookup-CFbcujyG.js";
|
|
7
|
+
function te() {
|
|
8
8
|
return { async: !1, breaks: !1, extensions: null, gfm: !0, hooks: null, pedantic: !1, renderer: null, silent: !1, tokenizer: null, walkTokens: null };
|
|
9
9
|
}
|
|
10
|
-
var P =
|
|
11
|
-
function
|
|
10
|
+
var P = te();
|
|
11
|
+
function xe(t) {
|
|
12
12
|
P = t;
|
|
13
13
|
}
|
|
14
14
|
var _ = { exec: () => null };
|
|
@@ -19,21 +19,21 @@ function k(t, e = "") {
|
|
|
19
19
|
}, getRegex: () => new RegExp(n, e) };
|
|
20
20
|
return s;
|
|
21
21
|
}
|
|
22
|
-
var
|
|
22
|
+
var Je = (() => {
|
|
23
23
|
try {
|
|
24
24
|
return !!new RegExp("(?<=1)(?<!1)");
|
|
25
25
|
} catch {
|
|
26
26
|
return !1;
|
|
27
27
|
}
|
|
28
|
-
})(), S = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (t) => new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}#`), htmlBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}>`) },
|
|
29
|
-
]`).replace("lheading",
|
|
28
|
+
})(), S = { codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (t) => new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), hrRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), fencesBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}(?:\`\`\`|~~~)`), headingBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}#`), htmlBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}<(?:[a-z].*>|!--)`, "i"), blockquoteBeginRegex: (t) => new RegExp(`^ {0,${Math.min(3, t - 1)}}>`) }, Ve = /^(?:[ \t]*(?:\n|$))+/, Ye = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, et = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, N = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, tt = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ne = / {0,3}(?:[*+-]|\d{1,9}[.)])/, me = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, we = k(me).replace(/bull/g, ne).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}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), nt = k(me).replace(/bull/g, ne).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}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), re = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, rt = /^[^\n]+/, se = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, st = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", se).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), it = k(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, ne).getRegex(), G = "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", ie = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, at = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ie).replace("tag", G).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), be = k(re).replace("hr", N).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", G).getRegex(), lt = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", be).getRegex(), ae = { blockquote: lt, code: Ye, def: st, fences: et, heading: tt, hr: N, html: at, lheading: we, list: it, newline: Ve, paragraph: be, table: _, text: rt }, he = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", N).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", G).getRegex(), ot = { ...ae, lheading: nt, table: he, paragraph: k(re).replace("hr", N).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", he).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", G).getRegex() }, ct = { ...ae, html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ie).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(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: _, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: k(re).replace("hr", N).replace("heading", ` *#{1,6} *[^
|
|
29
|
+
]`).replace("lheading", we).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, ht = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, pt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ye = /^( {2,}|\\)\n(?!\s*$)/, ut = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, L = /[\p{P}\p{S}]/u, X = /[\s\p{P}\p{S}]/u, le = /[^\s\p{P}\p{S}]/u, dt = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, X).getRegex(), Te = /(?!~)[\p{P}\p{S}]/u, gt = /(?!~)[\s\p{P}\p{S}]/u, kt = /(?:[^\s\p{P}\p{S}]|~)/u, ft = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Je ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Re = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, xt = k(Re, "u").replace(/punct/g, L).getRegex(), mt = k(Re, "u").replace(/punct/g, Te).getRegex(), Se = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", wt = k(Se, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, X).replace(/punct/g, L).getRegex(), bt = k(Se, "gu").replace(/notPunctSpace/g, kt).replace(/punctSpace/g, gt).replace(/punct/g, Te).getRegex(), yt = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, X).replace(/punct/g, L).getRegex(), Tt = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, L).getRegex(), Rt = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", St = k(Rt, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, X).replace(/punct/g, L).getRegex(), $t = k(/\\(punct)/, "gu").replace(/punct/g, L).getRegex(), Mt = k(/^<(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(), At = k(ie).replace("(?:-->|$)", "-->").getRegex(), zt = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", At).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Z = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, vt = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Z).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), $e = k(/^!?\[(label)\]\[(ref)\]/).replace("label", Z).replace("ref", se).getRegex(), Me = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", se).getRegex(), Ct = k("reflink|nolink(?!\\()", "g").replace("reflink", $e).replace("nolink", Me).getRegex(), pe = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, oe = { _backpedal: _, anyPunctuation: $t, autolink: Mt, blockSkip: ft, br: ye, code: pt, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: xt, emStrongRDelimAst: wt, emStrongRDelimUnd: yt, escape: ht, link: vt, nolink: Me, punctuation: dt, reflink: $e, reflinkSearch: Ct, tag: zt, text: ut, url: _ }, Et = { ...oe, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", Z).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Z).getRegex() }, V = { ...oe, emStrongRDelimAst: bt, emStrongLDelim: mt, delLDelim: Tt, delRDelim: St, url: k(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", pe).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: k(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", pe).getRegex() }, _t = { ...V, br: k(ye).replace("{2,}", "*").getRegex(), text: k(V.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, F = { normal: ae, gfm: ot, pedantic: ct }, O = { normal: oe, gfm: V, breaks: _t, pedantic: Et }, It = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }, ue = (t) => It[t];
|
|
30
30
|
function z(t, e) {
|
|
31
31
|
if (e) {
|
|
32
|
-
if (S.escapeTest.test(t)) return t.replace(S.escapeReplace,
|
|
33
|
-
} else if (S.escapeTestNoEncode.test(t)) return t.replace(S.escapeReplaceNoEncode,
|
|
32
|
+
if (S.escapeTest.test(t)) return t.replace(S.escapeReplace, ue);
|
|
33
|
+
} else if (S.escapeTestNoEncode.test(t)) return t.replace(S.escapeReplaceNoEncode, ue);
|
|
34
34
|
return t;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function de(t) {
|
|
37
37
|
try {
|
|
38
38
|
t = encodeURI(t).replace(S.percentDecode, "%");
|
|
39
39
|
} catch {
|
|
@@ -41,7 +41,7 @@ function ue(t) {
|
|
|
41
41
|
}
|
|
42
42
|
return t;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function ge(t, e) {
|
|
45
45
|
let n = t.replace(S.findPipe, (i, a, o) => {
|
|
46
46
|
let l = !1, h = a;
|
|
47
47
|
for (; --h >= 0 && o[h] === "\\"; ) l = !l;
|
|
@@ -60,7 +60,7 @@ function q(t, e, n) {
|
|
|
60
60
|
r++;
|
|
61
61
|
return t.slice(0, s - r);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Pt(t, e) {
|
|
64
64
|
if (t.indexOf(e[1]) === -1) return -1;
|
|
65
65
|
let n = 0;
|
|
66
66
|
for (let s = 0; s < t.length; s++) if (t[s] === "\\") s++;
|
|
@@ -68,7 +68,7 @@ function _t(t, e) {
|
|
|
68
68
|
else if (t[s] === e[1] && (n--, n < 0)) return s;
|
|
69
69
|
return n > 0 ? -2 : -1;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function Lt(t, e = 0) {
|
|
72
72
|
let n = e, s = "";
|
|
73
73
|
for (let r of t) if (r === " ") {
|
|
74
74
|
let i = 4 - n % 4;
|
|
@@ -76,13 +76,13 @@ function It(t, e = 0) {
|
|
|
76
76
|
} else s += r, n++;
|
|
77
77
|
return s;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function ke(t, e, n, s, r) {
|
|
80
80
|
let i = e.href, a = e.title || null, o = t[1].replace(r.other.outputLinkReplace, "$1");
|
|
81
81
|
s.state.inLink = !0;
|
|
82
82
|
let l = { type: t[0].charAt(0) === "!" ? "image" : "link", raw: n, href: i, title: a, text: o, tokens: s.inlineTokens(o) };
|
|
83
83
|
return s.state.inLink = !1, l;
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function Bt(t, e, n) {
|
|
86
86
|
let s = t.match(n.other.indentCodeCompensation);
|
|
87
87
|
if (s === null) return e;
|
|
88
88
|
let r = s[1];
|
|
@@ -117,7 +117,7 @@ var j = class {
|
|
|
117
117
|
fences(t) {
|
|
118
118
|
let e = this.rules.block.fences.exec(t);
|
|
119
119
|
if (e) {
|
|
120
|
-
let n = e[0], s =
|
|
120
|
+
let n = e[0], s = Bt(n, e[3] || "", this.rules);
|
|
121
121
|
return { type: "code", raw: n, lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2], text: s };
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -187,7 +187,7 @@ ${c}` : c;
|
|
|
187
187
|
let l = !1, h = "", c = "";
|
|
188
188
|
if (!(e = i.exec(t)) || this.rules.block.hr.test(t)) break;
|
|
189
189
|
h = e[0], t = t.substring(h.length);
|
|
190
|
-
let p =
|
|
190
|
+
let p = Lt(e[2].split(`
|
|
191
191
|
`, 1)[0], e[1].length), u = t.split(`
|
|
192
192
|
`, 1)[0], g = !p.trim(), f = 0;
|
|
193
193
|
if (this.options.pedantic ? (f = 2, c = p.trimStart()) : g ? f = e[1].length + 1 : (f = p.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = p.slice(f), f += e[1].length), g && this.rules.other.blankLine.test(u) && (h += u + `
|
|
@@ -255,12 +255,12 @@ ${c}` : c;
|
|
|
255
255
|
table(t) {
|
|
256
256
|
let e = this.rules.block.table.exec(t);
|
|
257
257
|
if (!e || !this.rules.other.tableDelimiter.test(e[2])) return;
|
|
258
|
-
let n =
|
|
258
|
+
let n = ge(e[1]), s = e[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = e[3]?.trim() ? e[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
259
259
|
`) : [], i = { type: "table", raw: e[0], header: [], align: [], rows: [] };
|
|
260
260
|
if (n.length === s.length) {
|
|
261
261
|
for (let a of s) this.rules.other.tableAlignRight.test(a) ? i.align.push("right") : this.rules.other.tableAlignCenter.test(a) ? i.align.push("center") : this.rules.other.tableAlignLeft.test(a) ? i.align.push("left") : i.align.push(null);
|
|
262
262
|
for (let a = 0; a < n.length; a++) i.header.push({ text: n[a], tokens: this.lexer.inline(n[a]), header: !0, align: i.align[a] });
|
|
263
|
-
for (let a of r) i.rows.push(
|
|
263
|
+
for (let a of r) i.rows.push(ge(a, i.header.length).map((o, l) => ({ text: o, tokens: this.lexer.inline(o), header: !1, align: i.align[l] })));
|
|
264
264
|
return i;
|
|
265
265
|
}
|
|
266
266
|
}
|
|
@@ -300,7 +300,7 @@ ${c}` : c;
|
|
|
300
300
|
let i = q(n.slice(0, -1), "\\");
|
|
301
301
|
if ((n.length - i.length) % 2 === 0) return;
|
|
302
302
|
} else {
|
|
303
|
-
let i =
|
|
303
|
+
let i = Pt(e[2], "()");
|
|
304
304
|
if (i === -2) return;
|
|
305
305
|
if (i > -1) {
|
|
306
306
|
let a = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + i;
|
|
@@ -312,7 +312,7 @@ ${c}` : c;
|
|
|
312
312
|
let i = this.rules.other.pedanticHrefTitle.exec(s);
|
|
313
313
|
i && (s = i[1], r = i[3]);
|
|
314
314
|
} else r = e[3] ? e[3].slice(1, -1) : "";
|
|
315
|
-
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)),
|
|
315
|
+
return s = s.trim(), this.rules.other.startAngleBracket.test(s) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(n) ? s = s.slice(1) : s = s.slice(1, -1)), ke(e, { href: s && s.replace(this.rules.inline.anyPunctuation, "$1"), title: r && r.replace(this.rules.inline.anyPunctuation, "$1") }, e[0], this.lexer, this.rules);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
reflink(t, e) {
|
|
@@ -323,7 +323,7 @@ ${c}` : c;
|
|
|
323
323
|
let i = n[0].charAt(0);
|
|
324
324
|
return { type: "text", raw: i, text: i };
|
|
325
325
|
}
|
|
326
|
-
return
|
|
326
|
+
return ke(n, r, n[0], this.lexer, this.rules);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
emStrong(t, e, n = "") {
|
|
@@ -408,7 +408,7 @@ ${c}` : c;
|
|
|
408
408
|
return { type: "text", raw: e[0], text: e[0], escaped: n };
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
|
-
}, M = class
|
|
411
|
+
}, M = class Y {
|
|
412
412
|
tokens;
|
|
413
413
|
options;
|
|
414
414
|
state;
|
|
@@ -423,10 +423,10 @@ ${c}` : c;
|
|
|
423
423
|
return { block: F, inline: O };
|
|
424
424
|
}
|
|
425
425
|
static lex(e, n) {
|
|
426
|
-
return new
|
|
426
|
+
return new Y(n).lex(e);
|
|
427
427
|
}
|
|
428
428
|
static lexInline(e, n) {
|
|
429
|
-
return new
|
|
429
|
+
return new Y(n).inlineTokens(e);
|
|
430
430
|
}
|
|
431
431
|
lex(e) {
|
|
432
432
|
e = e.replace(S.carriageReturn, `
|
|
@@ -716,7 +716,7 @@ ${t}</tr>
|
|
|
716
716
|
return `<del>${this.parser.parseInline(t)}</del>`;
|
|
717
717
|
}
|
|
718
718
|
link({ href: t, title: e, tokens: n }) {
|
|
719
|
-
let s = this.parser.parseInline(n), r =
|
|
719
|
+
let s = this.parser.parseInline(n), r = de(t);
|
|
720
720
|
if (r === null) return s;
|
|
721
721
|
t = r;
|
|
722
722
|
let i = '<a href="' + t + '"';
|
|
@@ -724,7 +724,7 @@ ${t}</tr>
|
|
|
724
724
|
}
|
|
725
725
|
image({ href: t, title: e, text: n, tokens: s }) {
|
|
726
726
|
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
727
|
-
let r =
|
|
727
|
+
let r = de(t);
|
|
728
728
|
if (r === null) return z(n);
|
|
729
729
|
t = r;
|
|
730
730
|
let i = `<img src="${t}" alt="${z(n)}"`;
|
|
@@ -733,7 +733,7 @@ ${t}</tr>
|
|
|
733
733
|
text(t) {
|
|
734
734
|
return "tokens" in t && t.tokens ? this.parser.parseInline(t.tokens) : "escaped" in t && t.escaped ? t.text : z(t.text);
|
|
735
735
|
}
|
|
736
|
-
},
|
|
736
|
+
}, ce = class {
|
|
737
737
|
strong({ text: t }) {
|
|
738
738
|
return t;
|
|
739
739
|
}
|
|
@@ -764,18 +764,18 @@ ${t}</tr>
|
|
|
764
764
|
checkbox({ raw: t }) {
|
|
765
765
|
return t;
|
|
766
766
|
}
|
|
767
|
-
}, A = class
|
|
767
|
+
}, A = class ee {
|
|
768
768
|
options;
|
|
769
769
|
renderer;
|
|
770
770
|
textRenderer;
|
|
771
771
|
constructor(e) {
|
|
772
|
-
this.options = e || P, this.options.renderer = this.options.renderer || new W(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new
|
|
772
|
+
this.options = e || P, this.options.renderer = this.options.renderer || new W(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new ce();
|
|
773
773
|
}
|
|
774
774
|
static parse(e, n) {
|
|
775
|
-
return new
|
|
775
|
+
return new ee(n).parse(e);
|
|
776
776
|
}
|
|
777
777
|
static parseInline(e, n) {
|
|
778
|
-
return new
|
|
778
|
+
return new ee(n).parseInline(e);
|
|
779
779
|
}
|
|
780
780
|
parse(e) {
|
|
781
781
|
this.renderer.parser = this;
|
|
@@ -915,7 +915,7 @@ ${t}</tr>
|
|
|
915
915
|
}
|
|
916
916
|
return s;
|
|
917
917
|
}
|
|
918
|
-
},
|
|
918
|
+
}, D = class {
|
|
919
919
|
options;
|
|
920
920
|
block;
|
|
921
921
|
constructor(t) {
|
|
@@ -941,17 +941,17 @@ ${t}</tr>
|
|
|
941
941
|
provideParser() {
|
|
942
942
|
return this.block ? A.parse : A.parseInline;
|
|
943
943
|
}
|
|
944
|
-
},
|
|
945
|
-
defaults =
|
|
944
|
+
}, Ht = class {
|
|
945
|
+
defaults = te();
|
|
946
946
|
options = this.setOptions;
|
|
947
947
|
parse = this.parseMarkdown(!0);
|
|
948
948
|
parseInline = this.parseMarkdown(!1);
|
|
949
949
|
Parser = A;
|
|
950
950
|
Renderer = W;
|
|
951
|
-
TextRenderer =
|
|
951
|
+
TextRenderer = ce;
|
|
952
952
|
Lexer = M;
|
|
953
953
|
Tokenizer = j;
|
|
954
|
-
Hooks =
|
|
954
|
+
Hooks = D;
|
|
955
955
|
constructor(...t) {
|
|
956
956
|
this.use(...t);
|
|
957
957
|
}
|
|
@@ -1025,13 +1025,13 @@ ${t}</tr>
|
|
|
1025
1025
|
s.tokenizer = r;
|
|
1026
1026
|
}
|
|
1027
1027
|
if (n.hooks) {
|
|
1028
|
-
let r = this.defaults.hooks || new
|
|
1028
|
+
let r = this.defaults.hooks || new D();
|
|
1029
1029
|
for (let i in n.hooks) {
|
|
1030
1030
|
if (!(i in r)) throw new Error(`hook '${i}' does not exist`);
|
|
1031
1031
|
if (["options", "block"].includes(i)) continue;
|
|
1032
1032
|
let a = i, o = n.hooks[a], l = r[a];
|
|
1033
|
-
|
|
1034
|
-
if (this.defaults.async &&
|
|
1033
|
+
D.passThroughHooks.has(i) ? r[a] = (h) => {
|
|
1034
|
+
if (this.defaults.async && D.passThroughHooksRespectAsync.has(i)) return (async () => {
|
|
1035
1035
|
let p = await o.call(r, h);
|
|
1036
1036
|
return l.call(r, p);
|
|
1037
1037
|
})();
|
|
@@ -1101,17 +1101,17 @@ Please report this to https://github.com/markedjs/marked.`, t) {
|
|
|
1101
1101
|
throw n;
|
|
1102
1102
|
};
|
|
1103
1103
|
}
|
|
1104
|
-
}, I = new
|
|
1104
|
+
}, I = new Ht();
|
|
1105
1105
|
function x(t, e) {
|
|
1106
1106
|
return I.parse(t, e);
|
|
1107
1107
|
}
|
|
1108
1108
|
x.options = x.setOptions = function(t) {
|
|
1109
|
-
return I.setOptions(t), x.defaults = I.defaults,
|
|
1109
|
+
return I.setOptions(t), x.defaults = I.defaults, xe(x.defaults), x;
|
|
1110
1110
|
};
|
|
1111
|
-
x.getDefaults =
|
|
1111
|
+
x.getDefaults = te;
|
|
1112
1112
|
x.defaults = P;
|
|
1113
1113
|
x.use = function(...t) {
|
|
1114
|
-
return I.use(...t), x.defaults = I.defaults,
|
|
1114
|
+
return I.use(...t), x.defaults = I.defaults, xe(x.defaults), x;
|
|
1115
1115
|
};
|
|
1116
1116
|
x.walkTokens = function(t, e) {
|
|
1117
1117
|
return I.walkTokens(t, e);
|
|
@@ -1120,11 +1120,11 @@ x.parseInline = I.parseInline;
|
|
|
1120
1120
|
x.Parser = A;
|
|
1121
1121
|
x.parser = A.parse;
|
|
1122
1122
|
x.Renderer = W;
|
|
1123
|
-
x.TextRenderer =
|
|
1123
|
+
x.TextRenderer = ce;
|
|
1124
1124
|
x.Lexer = M;
|
|
1125
1125
|
x.lexer = M.lex;
|
|
1126
1126
|
x.Tokenizer = j;
|
|
1127
|
-
x.Hooks =
|
|
1127
|
+
x.Hooks = D;
|
|
1128
1128
|
x.parse = x;
|
|
1129
1129
|
x.options;
|
|
1130
1130
|
x.setOptions;
|
|
@@ -1133,25 +1133,25 @@ x.walkTokens;
|
|
|
1133
1133
|
x.parseInline;
|
|
1134
1134
|
A.parse;
|
|
1135
1135
|
M.lex;
|
|
1136
|
-
function
|
|
1136
|
+
function Ot(t, e) {
|
|
1137
1137
|
const s = e.split(`
|
|
1138
1138
|
`).flatMap((r) => [r, ""]).map((r) => `${t}${r}`).join(`
|
|
1139
1139
|
`);
|
|
1140
1140
|
return s.slice(0, s.length - 1);
|
|
1141
1141
|
}
|
|
1142
|
-
function
|
|
1142
|
+
function qt(t, e) {
|
|
1143
1143
|
const n = [];
|
|
1144
1144
|
return Array.from(t.keys()).forEach((s) => {
|
|
1145
1145
|
(!e || !e.marks || !e.marks.map((r) => r.type).includes(s)) && n.push(s);
|
|
1146
1146
|
}), n;
|
|
1147
1147
|
}
|
|
1148
|
-
function
|
|
1148
|
+
function Dt(t, e) {
|
|
1149
1149
|
const n = [];
|
|
1150
1150
|
return Array.from(e.entries()).forEach(([s, r]) => {
|
|
1151
1151
|
t.has(s) || n.push({ type: s, mark: r });
|
|
1152
1152
|
}), n;
|
|
1153
1153
|
}
|
|
1154
|
-
function
|
|
1154
|
+
function Nt(t, e, n, s) {
|
|
1155
1155
|
const r = !n, i = n && n.type === "text" && (!n.marks || n.marks.length === 0), a = n && n.type === "text" && n.marks && !s(e, new Map(n.marks.map((l) => [l.type, l]))), o = [];
|
|
1156
1156
|
if (r || i || a)
|
|
1157
1157
|
if (n && n.type === "text" && n.marks) {
|
|
@@ -1162,28 +1162,28 @@ function qt(t, e, n, s) {
|
|
|
1162
1162
|
} else (r || i) && o.push(...Array.from(t.keys()).reverse());
|
|
1163
1163
|
return o;
|
|
1164
1164
|
}
|
|
1165
|
-
function
|
|
1165
|
+
function Ft(t, e) {
|
|
1166
1166
|
let n = "";
|
|
1167
1167
|
return Array.from(t.keys()).reverse().forEach((s) => {
|
|
1168
1168
|
const r = t.get(s), i = e(s, r);
|
|
1169
1169
|
i && (n = i + n);
|
|
1170
1170
|
}), t.clear(), n;
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1172
|
+
function Qt(t, e, n) {
|
|
1173
1173
|
let s = "";
|
|
1174
1174
|
return Array.from(t.entries()).forEach(([r, i]) => {
|
|
1175
1175
|
const a = n(r, i);
|
|
1176
1176
|
a && (s += a), e.set(r, i);
|
|
1177
1177
|
}), s;
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1179
|
+
function U(t) {
|
|
1180
1180
|
const n = (t.raw || t.text || "").match(/^(\s*)[-+*]\s+\[([ xX])\]\s+/);
|
|
1181
1181
|
return n ? { isTask: !0, checked: n[2].toLowerCase() === "x", indentLevel: n[1].length } : { isTask: !1, indentLevel: 0 };
|
|
1182
1182
|
}
|
|
1183
1183
|
function Q(t, e) {
|
|
1184
1184
|
return typeof t != "string" ? "json" : e;
|
|
1185
1185
|
}
|
|
1186
|
-
var
|
|
1186
|
+
var Ae = class {
|
|
1187
1187
|
/**
|
|
1188
1188
|
* Create a MarkdownManager.
|
|
1189
1189
|
* @param options.marked Optional marked instance to use (injected).
|
|
@@ -1194,7 +1194,7 @@ var Me = class {
|
|
|
1194
1194
|
constructor(t) {
|
|
1195
1195
|
this.baseExtensions = [], this.extensions = [], this.lastParseResult = null;
|
|
1196
1196
|
var e, n, s, r, i;
|
|
1197
|
-
this.markedInstance = (e = t?.marked) != null ? e : x, this.lexer = new this.markedInstance.Lexer(), this.indentStyle = (s = (n = t?.indentation) == null ? void 0 : n.style) != null ? s : "space", this.indentSize = (i = (r = t?.indentation) == null ? void 0 : r.size) != null ? i : 2, this.baseExtensions = t?.extensions || [], t?.markedOptions && typeof this.markedInstance.setOptions == "function" && this.markedInstance.setOptions(t.markedOptions), this.registry = /* @__PURE__ */ new Map(), this.nodeTypeRegistry = /* @__PURE__ */ new Map(), t?.extensions && (this.baseExtensions = t.extensions,
|
|
1197
|
+
this.markedInstance = (e = t?.marked) != null ? e : x, this.lexer = new this.markedInstance.Lexer(), this.indentStyle = (s = (n = t?.indentation) == null ? void 0 : n.style) != null ? s : "space", this.indentSize = (i = (r = t?.indentation) == null ? void 0 : r.size) != null ? i : 2, this.baseExtensions = t?.extensions || [], t?.markedOptions && typeof this.markedInstance.setOptions == "function" && this.markedInstance.setOptions(t.markedOptions), this.registry = /* @__PURE__ */ new Map(), this.nodeTypeRegistry = /* @__PURE__ */ new Map(), t?.extensions && (this.baseExtensions = t.extensions, Ee(t.extensions).forEach((o) => this.registerExtension(o, !1))), this.lexer = new this.markedInstance.Lexer();
|
|
1198
1198
|
}
|
|
1199
1199
|
/** Returns the underlying marked instance. */
|
|
1200
1200
|
get instance() {
|
|
@@ -1386,13 +1386,13 @@ var Me = class {
|
|
|
1386
1386
|
parseListToken(t) {
|
|
1387
1387
|
if (!t.items || t.items.length === 0)
|
|
1388
1388
|
return this.parseTokenWithHandlers(t);
|
|
1389
|
-
const e = t.items.some((o) =>
|
|
1389
|
+
const e = t.items.some((o) => U(o).isTask), n = t.items.some((o) => !U(o).isTask);
|
|
1390
1390
|
if (!e || !n || this.getHandlersForToken("taskList").length === 0)
|
|
1391
1391
|
return this.parseTokenWithHandlers(t);
|
|
1392
1392
|
const s = [];
|
|
1393
1393
|
let r = [], i = null;
|
|
1394
1394
|
for (let o = 0; o < t.items.length; o += 1) {
|
|
1395
|
-
const l = t.items[o], { isTask: h, checked: c, indentLevel: p } =
|
|
1395
|
+
const l = t.items[o], { isTask: h, checked: c, indentLevel: p } = U(l);
|
|
1396
1396
|
let u = l;
|
|
1397
1397
|
if (h) {
|
|
1398
1398
|
const w = (l.raw || l.text || "").split(`
|
|
@@ -1627,7 +1627,7 @@ var Me = class {
|
|
|
1627
1627
|
text: e
|
|
1628
1628
|
};
|
|
1629
1629
|
try {
|
|
1630
|
-
const n =
|
|
1630
|
+
const n = _e(e, this.baseExtensions);
|
|
1631
1631
|
return n.type === "doc" && n.content ? t.block ? n.content : n.content.length === 1 && n.content[0].type === "paragraph" && n.content[0].content ? n.content[0].content : n.content : n;
|
|
1632
1632
|
} catch (n) {
|
|
1633
1633
|
throw new Error(`Failed to parse HTML in markdown: ${n}`);
|
|
@@ -1652,7 +1652,7 @@ var Me = class {
|
|
|
1652
1652
|
return this.renderNodeToMarkdown(p, t, u, g);
|
|
1653
1653
|
},
|
|
1654
1654
|
indent: (p) => this.indentString + p,
|
|
1655
|
-
wrapInBlock:
|
|
1655
|
+
wrapInBlock: Ot
|
|
1656
1656
|
}, h = {
|
|
1657
1657
|
index: n,
|
|
1658
1658
|
level: s,
|
|
@@ -1683,7 +1683,7 @@ var Me = class {
|
|
|
1683
1683
|
if (l.type)
|
|
1684
1684
|
if (l.type === "text") {
|
|
1685
1685
|
let p = l.text || "";
|
|
1686
|
-
const u = new Map((l.marks || []).map((d) => [d.type, d])), g =
|
|
1686
|
+
const u = new Map((l.marks || []).map((d) => [d.type, d])), g = Dt(i, u), f = qt(u, c), w = f.filter((d) => i.has(d)), y = w.length > 0 && g.length > 0;
|
|
1687
1687
|
let b = "";
|
|
1688
1688
|
if (f.length > 0 && !y) {
|
|
1689
1689
|
const d = p.match(/(\s+)$/);
|
|
@@ -1692,8 +1692,8 @@ var Me = class {
|
|
|
1692
1692
|
y || f.forEach((d) => {
|
|
1693
1693
|
if (!i.has(d))
|
|
1694
1694
|
return;
|
|
1695
|
-
const m = u.get(d),
|
|
1696
|
-
|
|
1695
|
+
const m = u.get(d), C = this.getMarkClosing(d, m, o.get(d));
|
|
1696
|
+
C && (p += C), i.has(d) && (i.delete(d), o.delete(d));
|
|
1697
1697
|
});
|
|
1698
1698
|
let T = "";
|
|
1699
1699
|
if (g.length > 0) {
|
|
@@ -1701,8 +1701,8 @@ var Me = class {
|
|
|
1701
1701
|
d && (T = d[1], p = p.slice(T.length));
|
|
1702
1702
|
}
|
|
1703
1703
|
g.forEach(({ type: d, mark: m }) => {
|
|
1704
|
-
const
|
|
1705
|
-
E && (p = E + p), o.set(d,
|
|
1704
|
+
const C = a.has(d) ? "html" : "markdown", E = this.getMarkOpening(d, m, C);
|
|
1705
|
+
E && (p = E + p), o.set(d, C), a.delete(d);
|
|
1706
1706
|
}), y || g.slice().reverse().forEach(({ type: d, mark: m }) => {
|
|
1707
1707
|
i.set(d, m);
|
|
1708
1708
|
}), p = T + p;
|
|
@@ -1718,7 +1718,7 @@ var Me = class {
|
|
|
1718
1718
|
// outer (were active before) — close last
|
|
1719
1719
|
];
|
|
1720
1720
|
} else
|
|
1721
|
-
R =
|
|
1721
|
+
R = Nt(i, u, c, this.markSetsEqual.bind(this));
|
|
1722
1722
|
let $ = "";
|
|
1723
1723
|
if (R.length > 0) {
|
|
1724
1724
|
const d = p.match(/(\s+)$/);
|
|
@@ -1726,13 +1726,13 @@ var Me = class {
|
|
|
1726
1726
|
}
|
|
1727
1727
|
R.forEach((d) => {
|
|
1728
1728
|
var m;
|
|
1729
|
-
const
|
|
1729
|
+
const C = (m = i.get(d)) != null ? m : u.get(d), E = this.getMarkClosing(d, C, o.get(d));
|
|
1730
1730
|
E && (p += E), i.delete(d), o.delete(d);
|
|
1731
1731
|
}), p += $, p += b, r.push(p);
|
|
1732
1732
|
} else {
|
|
1733
|
-
const p = new Map(i), u = new Map(o), g =
|
|
1733
|
+
const p = new Map(i), u = new Map(o), g = Ft(i, (y, b) => this.getMarkClosing(y, b, o.get(y)));
|
|
1734
1734
|
o.clear();
|
|
1735
|
-
const f = this.renderNodeToMarkdown(l, e, h, s), w = l.type === "hardBreak" ? "" :
|
|
1735
|
+
const f = this.renderNodeToMarkdown(l, e, h, s), w = l.type === "hardBreak" ? "" : Qt(p, i, (y, b) => {
|
|
1736
1736
|
var T;
|
|
1737
1737
|
const R = (T = u.get(y)) != null ? T : "markdown";
|
|
1738
1738
|
return o.set(y, R), this.getMarkOpening(y, b, R);
|
|
@@ -1817,8 +1817,8 @@ var Me = class {
|
|
|
1817
1817
|
markSetsEqual(t, e) {
|
|
1818
1818
|
return t.size !== e.size ? !1 : Array.from(t.keys()).every((n) => e.has(n));
|
|
1819
1819
|
}
|
|
1820
|
-
},
|
|
1821
|
-
|
|
1820
|
+
}, fe = Ae;
|
|
1821
|
+
Ce.create({
|
|
1822
1822
|
name: "markdown",
|
|
1823
1823
|
addOptions() {
|
|
1824
1824
|
return {
|
|
@@ -1831,33 +1831,33 @@ ze.create({
|
|
|
1831
1831
|
return {
|
|
1832
1832
|
setContent: (t, e) => {
|
|
1833
1833
|
if (!e?.contentType)
|
|
1834
|
-
return
|
|
1834
|
+
return v.setContent(t, e);
|
|
1835
1835
|
if (Q(t, e?.contentType) !== "markdown" || !this.editor.markdown)
|
|
1836
|
-
return
|
|
1836
|
+
return v.setContent(t, e);
|
|
1837
1837
|
const s = this.editor.markdown.parse(t);
|
|
1838
|
-
return
|
|
1838
|
+
return v.setContent(s, e);
|
|
1839
1839
|
},
|
|
1840
1840
|
insertContent: (t, e) => {
|
|
1841
1841
|
if (!e?.contentType)
|
|
1842
|
-
return
|
|
1842
|
+
return v.insertContent(t, e);
|
|
1843
1843
|
if (Q(t, e?.contentType) !== "markdown" || !this.editor.markdown)
|
|
1844
|
-
return
|
|
1844
|
+
return v.insertContent(t, e);
|
|
1845
1845
|
const s = this.editor.markdown.parse(t);
|
|
1846
|
-
return
|
|
1846
|
+
return v.insertContent(s, e);
|
|
1847
1847
|
},
|
|
1848
1848
|
insertContentAt: (t, e, n) => {
|
|
1849
1849
|
if (!n?.contentType)
|
|
1850
|
-
return
|
|
1850
|
+
return v.insertContentAt(t, e, n);
|
|
1851
1851
|
if (Q(e, n?.contentType) !== "markdown" || !this.editor.markdown)
|
|
1852
|
-
return
|
|
1852
|
+
return v.insertContentAt(t, e, n);
|
|
1853
1853
|
const r = this.editor.markdown.parse(e);
|
|
1854
|
-
return
|
|
1854
|
+
return v.insertContentAt(t, r, n);
|
|
1855
1855
|
}
|
|
1856
1856
|
};
|
|
1857
1857
|
},
|
|
1858
1858
|
addStorage() {
|
|
1859
1859
|
return {
|
|
1860
|
-
manager: new
|
|
1860
|
+
manager: new fe({
|
|
1861
1861
|
indentation: this.options.indentation,
|
|
1862
1862
|
marked: this.options.marked,
|
|
1863
1863
|
markedOptions: this.options.markedOptions,
|
|
@@ -1872,7 +1872,7 @@ ze.create({
|
|
|
1872
1872
|
);
|
|
1873
1873
|
return;
|
|
1874
1874
|
}
|
|
1875
|
-
if (this.storage.manager = new
|
|
1875
|
+
if (this.storage.manager = new fe({
|
|
1876
1876
|
indentation: this.options.indentation,
|
|
1877
1877
|
marked: this.options.marked,
|
|
1878
1878
|
markedOptions: this.options.markedOptions,
|
|
@@ -1891,63 +1891,77 @@ ze.create({
|
|
|
1891
1891
|
this.editor.options.content = e;
|
|
1892
1892
|
}
|
|
1893
1893
|
});
|
|
1894
|
-
const
|
|
1895
|
-
Ee,
|
|
1896
|
-
_e,
|
|
1894
|
+
const Zt = [
|
|
1897
1895
|
Ie,
|
|
1898
|
-
Ge.configure({ levels: [1, 2, 3] }),
|
|
1899
1896
|
Pe,
|
|
1900
1897
|
Le,
|
|
1898
|
+
Ke.configure({ levels: [1, 2, 3] }),
|
|
1901
1899
|
Be,
|
|
1902
|
-
Xe.configure({ taskList: !1, taskItem: !1, orderedList: !1 }),
|
|
1903
1900
|
He,
|
|
1904
1901
|
Oe,
|
|
1902
|
+
Ue.configure({ taskList: !1, taskItem: !1, orderedList: !1 }),
|
|
1905
1903
|
qe,
|
|
1906
|
-
Ne,
|
|
1907
1904
|
De,
|
|
1905
|
+
Ne,
|
|
1908
1906
|
Fe,
|
|
1909
1907
|
Qe,
|
|
1910
1908
|
Ze,
|
|
1911
1909
|
je,
|
|
1912
|
-
We
|
|
1910
|
+
We,
|
|
1911
|
+
Ge,
|
|
1912
|
+
Xe
|
|
1913
1913
|
];
|
|
1914
|
-
function
|
|
1915
|
-
const t = new
|
|
1916
|
-
for (const e of
|
|
1914
|
+
function jt() {
|
|
1915
|
+
const t = new Ae();
|
|
1916
|
+
for (const e of Zt)
|
|
1917
1917
|
t.registerExtension(e);
|
|
1918
1918
|
return t;
|
|
1919
1919
|
}
|
|
1920
|
-
let
|
|
1921
|
-
function
|
|
1922
|
-
return
|
|
1920
|
+
let J = null;
|
|
1921
|
+
function K() {
|
|
1922
|
+
return J || (J = jt()), J;
|
|
1923
1923
|
}
|
|
1924
|
-
function
|
|
1925
|
-
return
|
|
1924
|
+
function Gt(t) {
|
|
1925
|
+
return K().serialize(t);
|
|
1926
1926
|
}
|
|
1927
|
-
function
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
e.content.pop();
|
|
1927
|
+
function ze(t) {
|
|
1928
|
+
for (; t.content.length > 1; ) {
|
|
1929
|
+
const e = t.content[t.content.length - 1];
|
|
1930
|
+
if (e.type === "paragraph" && (!("content" in e) || !e.content?.length))
|
|
1931
|
+
t.content.pop();
|
|
1933
1932
|
else break;
|
|
1934
1933
|
}
|
|
1935
|
-
|
|
1934
|
+
}
|
|
1935
|
+
function ve(t) {
|
|
1936
|
+
t.resolved && delete t.resolved, Array.isArray(t.content) && t.content.forEach(ve);
|
|
1937
|
+
}
|
|
1938
|
+
function Xt(t) {
|
|
1939
|
+
const e = K().parse(t);
|
|
1940
|
+
return ze(e), ve(e), e;
|
|
1941
|
+
}
|
|
1942
|
+
function Kt(t) {
|
|
1943
|
+
return K().serialize(t);
|
|
1944
|
+
}
|
|
1945
|
+
function Ut(t) {
|
|
1946
|
+
const e = K().parse(t);
|
|
1947
|
+
return ze(e), e;
|
|
1936
1948
|
}
|
|
1937
1949
|
export {
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1950
|
+
Ae as MarkdownManager,
|
|
1951
|
+
tn as QalamEditor,
|
|
1952
|
+
rn as QalamRenderer,
|
|
1953
|
+
Fe as QuranRef,
|
|
1954
|
+
jt as createMarkdownManager,
|
|
1955
|
+
Gt as docToMarkdown,
|
|
1956
|
+
on as getAllSurahs,
|
|
1957
|
+
cn as getSurahInfo,
|
|
1958
|
+
hn as getVerseText,
|
|
1959
|
+
pn as isDataLoaded,
|
|
1960
|
+
un as loadQuranData,
|
|
1961
|
+
Xt as markdownToDoc,
|
|
1962
|
+
Ut as markdownToResolvedDoc,
|
|
1963
|
+
an as resolveAST,
|
|
1964
|
+
dn as resolveSurah,
|
|
1965
|
+
Kt as resolvedDocToMarkdown,
|
|
1966
|
+
Yt as validateAST
|
|
1953
1967
|
};
|