@siladev/qalam 0.4.1 → 0.4.2

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.
@@ -17565,28 +17565,28 @@ const Qb = Au.extend({
17565
17565
  },
17566
17566
  markdownTokenName: "list",
17567
17567
  parseMarkdown: (n, e) => {
17568
- const t = n.ordered ? "orderedList" : "bulletList", r = n.listType === "abjad" ? "abjad" : n.ordered ? "decimal" : void 0;
17569
- return {
17568
+ const t = n.ordered ? "orderedList" : "bulletList", r = n.listType === "abjad" ? "abjad" : n.ordered ? "decimal" : void 0, s = n.ordered && n.start !== void 0 && n.start !== "" ? Number(n.start) : void 0, i = {};
17569
+ return r && (i.listType = r), s && s > 1 && (i.start = s), {
17570
17570
  type: t,
17571
- attrs: r ? { listType: r } : void 0,
17572
- content: (n.items || []).map((i) => {
17573
- const a = (i.tokens || []).map((l) => l.type === "text" && l.tokens ? {
17571
+ attrs: Object.keys(i).length ? i : void 0,
17572
+ content: (n.items || []).map((o) => {
17573
+ const l = (o.tokens || []).map((c) => c.type === "text" && c.tokens ? {
17574
17574
  type: "paragraph",
17575
- content: e.parseInline(l.tokens)
17576
- } : e.parseChildren([l])?.[0] ?? { type: "paragraph" });
17575
+ content: e.parseInline(c.tokens)
17576
+ } : e.parseChildren([c])?.[0] ?? { type: "paragraph" });
17577
17577
  return {
17578
17578
  type: "listItem",
17579
- content: a.length ? a : [{ type: "paragraph" }]
17579
+ content: l.length ? l : [{ type: "paragraph" }]
17580
17580
  };
17581
17581
  })
17582
17582
  };
17583
17583
  },
17584
17584
  renderMarkdown: (n, e) => {
17585
- const r = n.attrs?.listType === "abjad" ? "أ" : "1";
17586
- return (n.content || []).map((i) => {
17587
- const a = e.renderChildren(i.content || []).trimEnd().split(`
17588
- `), l = `${r}. ${a[0]}`, c = a.slice(1).map((u) => ` ${u}`);
17589
- return [l, ...c].join(`
17585
+ const t = n.type === "bulletList", r = n.attrs?.listType === "abjad", s = n.attrs?.start || 1;
17586
+ return (n.content || []).map((o, a) => {
17587
+ const l = t ? "-" : r ? "أ." : `${s + a}.`, u = e.renderChildren(o.content || []).trimEnd().split(`
17588
+ `), d = `${l} ${u[0]}`, f = u.slice(1).map((h) => ` ${h}`);
17589
+ return [d, ...f].join(`
17590
17590
  `);
17591
17591
  }).join(`
17592
17592
  `) + `
@@ -17963,7 +17963,8 @@ const Ja = {
17963
17963
  function e0(n) {
17964
17964
  return n.map((e) => {
17965
17965
  let t = String(e.fromAya);
17966
- return e.fromWord != null ? (t += `:${e.fromWord}`, e.toAya != null && e.toAya !== e.fromAya ? (t += `-${e.toAya}`, e.toWord != null && (t += `:${e.toWord}`)) : e.toWord != null && (t += `-${e.toWord}`)) : e.toAya != null && e.toAya !== e.fromAya && (t += `-${e.toAya}`), e.repeat > 1 && (t += `x${e.repeat}`), t;
17966
+ const r = e.fromWord ?? (e.toWord != null ? 1 : null);
17967
+ return r != null ? (t += `:${r}`, e.toAya != null && e.toAya !== e.fromAya ? (t += `-${e.toAya}`, e.toWord != null && (t += `:${e.toWord}`)) : e.toWord != null && (t += `-${e.toWord}`)) : e.toAya != null && e.toAya !== e.fromAya && (t += `-${e.toAya}`), e.repeat > 1 && (t += `x${e.repeat}`), t;
17967
17968
  }).join(",");
17968
17969
  }
17969
17970
  function t0(n) {
@@ -18988,6 +18989,7 @@ export {
18988
18989
  s0 as H,
18989
18990
  c0 as I,
18990
18991
  hb as L,
18992
+ fe as N,
18991
18993
  cy as P,
18992
18994
  k0 as Q,
18993
18995
  n0 as a,
@@ -1 +1 @@
1
- {"version":3,"file":"ordered-list.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/ordered-list.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,gBAAgB,EAAE;YAChB,kBAAkB,EAAE,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,KAAK,UAAU,CAAC;SACnE,CAAC;KACH;CACF;AAED,eAAO,MAAM,gBAAgB,uFAyG3B,CAAC"}
1
+ {"version":3,"file":"ordered-list.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/ordered-list.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,gBAAgB,EAAE;YAChB,kBAAkB,EAAE,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,KAAK,UAAU,CAAC;SACnE,CAAC;KACH;CACF;AAED,eAAO,MAAM,gBAAgB,uFA8G3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"quran-ref.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/quran-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAKrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,YAAY,EAAE,OAAO,CAAC;CACvB;AAUD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,QAAQ,EAAE;YACR,cAAc,EAAE,CAAC,KAAK,EAAE;gBACtB,KAAK,EAAE,MAAM,CAAC;gBACd,SAAS,EAAE,MAAM,CAAC;gBAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;gBACnB,YAAY,CAAC,EAAE,OAAO,CAAC;gBACvB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;aAC3B,KAAK,UAAU,CAAC;SAClB,CAAC;KACH;CACF;AA6CD,eAAO,MAAM,QAAQ,4BAqKnB,CAAC"}
1
+ {"version":3,"file":"quran-ref.d.ts","sourceRoot":"","sources":["../../../src/editor/extensions/quran-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,cAAc,CAAC;AAKrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,YAAY,EAAE,OAAO,CAAC;CACvB;AAUD,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,QAAQ,EAAE;YACR,cAAc,EAAE,CAAC,KAAK,EAAE;gBACtB,KAAK,EAAE,MAAM,CAAC;gBACd,SAAS,EAAE,MAAM,CAAC;gBAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;gBACnB,YAAY,CAAC,EAAE,OAAO,CAAC;gBACvB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;aAC3B,KAAK,UAAU,CAAC;SAClB,CAAC;KACH;CACF;AA8CD,eAAO,MAAM,QAAQ,4BAqKnB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Q as o, a as Q } from "../QalamEditor-CetWi-Mh.js";
1
+ import { Q as o, a as Q } from "../QalamEditor-DlDCU2Hq.js";
2
2
  export {
3
3
  o as QalamEditor,
4
4
  Q as QuranRef
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
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-CetWi-Mh.js";
3
- import { Q as tn } from "./QalamEditor-CetWi-Mh.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";
1
+ import { validateAST as tn } from "./schema/index.js";
2
+ import { E as Ce, c as v, f as Ee, g as H, b as _e, N as Ie, i as Pe, P as Le, d as Be, e as He, h as Oe, j as qe, k as Ne, B as De, l as Fe, a as je, H as Qe, m as Ze, n as We, I as Ge, o as Xe, p as Ke, q as Ue, L as Je } from "./QalamEditor-DlDCU2Hq.js";
3
+ import { Q as rn } from "./QalamEditor-DlDCU2Hq.js";
4
+ import { Q as an } from "./QalamRenderer-CbbJYMLn.js";
5
+ import { resolveAST as on } from "./resolver/index.js";
6
+ import { g as hn, a as pn, b as un, i as dn, l as gn, r as kn } from "./lookup-CFbcujyG.js";
7
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
  }
@@ -19,14 +19,14 @@ function k(t, e = "") {
19
19
  }, getRegex: () => new RegExp(n, e) };
20
20
  return s;
21
21
  }
22
- var Je = (() => {
22
+ var Ve = (() => {
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)}}>`) }, 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 = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ue = (t) => It[t];
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)}}>`) }, Ye = /^(?:[ \t]*(?:\n|$))+/, et = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, tt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, D = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, nt = /^ {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(), rt = 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]+)*)/, st = /^[^\n]+/, se = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, it = k(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", se).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), at = 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]*?(?:-->|$))/, lt = 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", D).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(), ot = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", be).getRegex(), ae = { blockquote: ot, code: et, def: it, fences: tt, heading: nt, hr: D, html: lt, lheading: we, list: at, newline: Ye, paragraph: be, table: _, text: st }, he = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", D).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(), ct = { ...ae, lheading: rt, table: he, paragraph: k(re).replace("hr", D).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() }, ht = { ...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", D).replace("heading", ` *#{1,6} *[^
29
+ ]`).replace("lheading", we).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() }, pt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, ut = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, ye = /^( {2,}|\\)\n(?!\s*$)/, dt = /^(`+|[^`])(?:(?= {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, gt = k(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, X).getRegex(), Te = /(?!~)[\p{P}\p{S}]/u, kt = /(?!~)[\s\p{P}\p{S}]/u, ft = /(?:[^\s\p{P}\p{S}]|~)/u, xt = k(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Ve ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Re = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, mt = k(Re, "u").replace(/punct/g, L).getRegex(), wt = k(Re, "u").replace(/punct/g, Te).getRegex(), Se = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", bt = k(Se, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, X).replace(/punct/g, L).getRegex(), yt = k(Se, "gu").replace(/notPunctSpace/g, ft).replace(/punctSpace/g, kt).replace(/punct/g, Te).getRegex(), Tt = 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(), Rt = k(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, L).getRegex(), St = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", $t = k(St, "gu").replace(/notPunctSpace/g, le).replace(/punctSpace/g, X).replace(/punct/g, L).getRegex(), Mt = k(/\\(punct)/, "gu").replace(/punct/g, L).getRegex(), At = 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(), zt = k(ie).replace("(?:-->|$)", "-->").getRegex(), vt = 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", zt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Q = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ct = k(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), $e = k(/^!?\[(label)\]\[(ref)\]/).replace("label", Q).replace("ref", se).getRegex(), Me = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", se).getRegex(), Et = k("reflink|nolink(?!\\()", "g").replace("reflink", $e).replace("nolink", Me).getRegex(), pe = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, oe = { _backpedal: _, anyPunctuation: Mt, autolink: At, blockSkip: xt, br: ye, code: ut, del: _, delLDelim: _, delRDelim: _, emStrongLDelim: mt, emStrongRDelimAst: bt, emStrongRDelimUnd: Tt, escape: pt, link: Ct, nolink: Me, punctuation: gt, reflink: $e, reflinkSearch: Et, tag: vt, text: dt, url: _ }, _t = { ...oe, link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", Q).getRegex(), reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Q).getRegex() }, V = { ...oe, emStrongRDelimAst: yt, emStrongLDelim: wt, delLDelim: Rt, delRDelim: $t, 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() }, It = { ...V, br: k(ye).replace("{2,}", "*").getRegex(), text: k(V.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() }, F = { normal: ae, gfm: ct, pedantic: ht }, O = { normal: oe, gfm: V, breaks: It, pedantic: _t }, Pt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" }, ue = (t) => Pt[t];
30
30
  function z(t, e) {
31
31
  if (e) {
32
32
  if (S.escapeTest.test(t)) return t.replace(S.escapeReplace, ue);
@@ -60,7 +60,7 @@ function q(t, e, n) {
60
60
  r++;
61
61
  return t.slice(0, s - r);
62
62
  }
63
- function Pt(t, e) {
63
+ function Lt(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 Pt(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 Lt(t, e = 0) {
71
+ function Bt(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;
@@ -82,7 +82,7 @@ function ke(t, e, n, s, r) {
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 Bt(t, e, n) {
85
+ function Ht(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];
@@ -95,7 +95,7 @@ function Bt(t, e, n) {
95
95
  }).join(`
96
96
  `);
97
97
  }
98
- var j = class {
98
+ var Z = class {
99
99
  options;
100
100
  rules;
101
101
  lexer;
@@ -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 = Bt(n, e[3] || "", this.rules);
120
+ let n = e[0], s = Ht(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 = Lt(e[2].split(`
190
+ let p = Bt(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 + `
@@ -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 = Pt(e[2], "()");
303
+ let i = Lt(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;
@@ -415,7 +415,7 @@ ${c}` : c;
415
415
  inlineQueue;
416
416
  tokenizer;
417
417
  constructor(e) {
418
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || P, this.options.tokenizer = this.options.tokenizer || new j(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
418
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || P, this.options.tokenizer = this.options.tokenizer || new Z(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: !1, inRawBlock: !1, top: !0 };
419
419
  let n = { other: S, block: F.normal, inline: O.normal };
420
420
  this.options.pedantic ? (n.block = F.pedantic, n.inline = O.pedantic) : this.options.gfm && (n.block = F.gfm, this.options.breaks ? n.inline = O.breaks : n.inline = O.gfm), this.tokenizer.rules = n;
421
421
  }
@@ -915,7 +915,7 @@ ${t}</tr>
915
915
  }
916
916
  return s;
917
917
  }
918
- }, D = class {
918
+ }, N = class {
919
919
  options;
920
920
  block;
921
921
  constructor(t) {
@@ -941,7 +941,7 @@ ${t}</tr>
941
941
  provideParser() {
942
942
  return this.block ? A.parse : A.parseInline;
943
943
  }
944
- }, Ht = class {
944
+ }, Ot = class {
945
945
  defaults = te();
946
946
  options = this.setOptions;
947
947
  parse = this.parseMarkdown(!0);
@@ -950,8 +950,8 @@ ${t}</tr>
950
950
  Renderer = W;
951
951
  TextRenderer = ce;
952
952
  Lexer = M;
953
- Tokenizer = j;
954
- Hooks = D;
953
+ Tokenizer = Z;
954
+ Hooks = N;
955
955
  constructor(...t) {
956
956
  this.use(...t);
957
957
  }
@@ -1012,7 +1012,7 @@ ${t}</tr>
1012
1012
  s.renderer = r;
1013
1013
  }
1014
1014
  if (n.tokenizer) {
1015
- let r = this.defaults.tokenizer || new j(this.defaults);
1015
+ let r = this.defaults.tokenizer || new Z(this.defaults);
1016
1016
  for (let i in n.tokenizer) {
1017
1017
  if (!(i in r)) throw new Error(`tokenizer '${i}' does not exist`);
1018
1018
  if (["options", "rules", "lexer"].includes(i)) continue;
@@ -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 D();
1028
+ let r = this.defaults.hooks || new N();
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
- D.passThroughHooks.has(i) ? r[a] = (h) => {
1034
- if (this.defaults.async && D.passThroughHooksRespectAsync.has(i)) return (async () => {
1033
+ N.passThroughHooks.has(i) ? r[a] = (h) => {
1034
+ if (this.defaults.async && N.passThroughHooksRespectAsync.has(i)) return (async () => {
1035
1035
  let p = await o.call(r, h);
1036
1036
  return l.call(r, p);
1037
1037
  })();
@@ -1101,7 +1101,7 @@ Please report this to https://github.com/markedjs/marked.`, t) {
1101
1101
  throw n;
1102
1102
  };
1103
1103
  }
1104
- }, I = new Ht();
1104
+ }, I = new Ot();
1105
1105
  function x(t, e) {
1106
1106
  return I.parse(t, e);
1107
1107
  }
@@ -1123,8 +1123,8 @@ x.Renderer = W;
1123
1123
  x.TextRenderer = ce;
1124
1124
  x.Lexer = M;
1125
1125
  x.lexer = M.lex;
1126
- x.Tokenizer = j;
1127
- x.Hooks = D;
1126
+ x.Tokenizer = Z;
1127
+ x.Hooks = N;
1128
1128
  x.parse = x;
1129
1129
  x.options;
1130
1130
  x.setOptions;
@@ -1133,13 +1133,13 @@ x.walkTokens;
1133
1133
  x.parseInline;
1134
1134
  A.parse;
1135
1135
  M.lex;
1136
- function Ot(t, e) {
1136
+ function qt(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 qt(t, e) {
1142
+ function Nt(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);
@@ -1151,7 +1151,7 @@ function Dt(t, e) {
1151
1151
  t.has(s) || n.push({ type: s, mark: r });
1152
1152
  }), n;
1153
1153
  }
1154
- function Nt(t, e, n, s) {
1154
+ function Ft(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,7 +1162,7 @@ function Nt(t, e, n, s) {
1162
1162
  } else (r || i) && o.push(...Array.from(t.keys()).reverse());
1163
1163
  return o;
1164
1164
  }
1165
- function Ft(t, e) {
1165
+ function jt(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);
@@ -1180,7 +1180,7 @@ 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
- function Q(t, e) {
1183
+ function j(t, e) {
1184
1184
  return typeof t != "string" ? "json" : e;
1185
1185
  }
1186
1186
  var Ae = class {
@@ -1652,7 +1652,7 @@ var Ae = class {
1652
1652
  return this.renderNodeToMarkdown(p, t, u, g);
1653
1653
  },
1654
1654
  indent: (p) => this.indentString + p,
1655
- wrapInBlock: Ot
1655
+ wrapInBlock: qt
1656
1656
  }, h = {
1657
1657
  index: n,
1658
1658
  level: s,
@@ -1683,7 +1683,7 @@ var Ae = 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 = Dt(i, u), f = qt(u, c), w = f.filter((d) => i.has(d)), y = w.length > 0 && g.length > 0;
1686
+ const u = new Map((l.marks || []).map((d) => [d.type, d])), g = Dt(i, u), f = Nt(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+)$/);
@@ -1718,7 +1718,7 @@ var Ae = class {
1718
1718
  // outer (were active before) — close last
1719
1719
  ];
1720
1720
  } else
1721
- R = Nt(i, u, c, this.markSetsEqual.bind(this));
1721
+ R = Ft(i, u, c, this.markSetsEqual.bind(this));
1722
1722
  let $ = "";
1723
1723
  if (R.length > 0) {
1724
1724
  const d = p.match(/(\s+)$/);
@@ -1730,7 +1730,7 @@ var Ae = class {
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 = Ft(i, (y, b) => this.getMarkClosing(y, b, o.get(y)));
1733
+ const p = new Map(i), u = new Map(o), g = jt(i, (y, b) => this.getMarkClosing(y, b, o.get(y)));
1734
1734
  o.clear();
1735
1735
  const f = this.renderNodeToMarkdown(l, e, h, s), w = l.type === "hardBreak" ? "" : Qt(p, i, (y, b) => {
1736
1736
  var T;
@@ -1832,7 +1832,7 @@ Ce.create({
1832
1832
  setContent: (t, e) => {
1833
1833
  if (!e?.contentType)
1834
1834
  return v.setContent(t, e);
1835
- if (Q(t, e?.contentType) !== "markdown" || !this.editor.markdown)
1835
+ if (j(t, e?.contentType) !== "markdown" || !this.editor.markdown)
1836
1836
  return v.setContent(t, e);
1837
1837
  const s = this.editor.markdown.parse(t);
1838
1838
  return v.setContent(s, e);
@@ -1840,7 +1840,7 @@ Ce.create({
1840
1840
  insertContent: (t, e) => {
1841
1841
  if (!e?.contentType)
1842
1842
  return v.insertContent(t, e);
1843
- if (Q(t, e?.contentType) !== "markdown" || !this.editor.markdown)
1843
+ if (j(t, e?.contentType) !== "markdown" || !this.editor.markdown)
1844
1844
  return v.insertContent(t, e);
1845
1845
  const s = this.editor.markdown.parse(t);
1846
1846
  return v.insertContent(s, e);
@@ -1848,7 +1848,7 @@ Ce.create({
1848
1848
  insertContentAt: (t, e, n) => {
1849
1849
  if (!n?.contentType)
1850
1850
  return v.insertContentAt(t, e, n);
1851
- if (Q(e, n?.contentType) !== "markdown" || !this.editor.markdown)
1851
+ if (j(e, n?.contentType) !== "markdown" || !this.editor.markdown)
1852
1852
  return v.insertContentAt(t, e, n);
1853
1853
  const r = this.editor.markdown.parse(e);
1854
1854
  return v.insertContentAt(t, r, n);
@@ -1877,7 +1877,7 @@ Ce.create({
1877
1877
  marked: this.options.marked,
1878
1878
  markedOptions: this.options.markedOptions,
1879
1879
  extensions: this.editor.extensionManager.baseExtensions
1880
- }), this.editor.markdown = this.storage.manager, this.editor.getMarkdown = () => this.storage.manager.serialize(this.editor.getJSON()), !this.editor.options.contentType || Q(this.editor.options.content, this.editor.options.contentType) !== "markdown")
1880
+ }), this.editor.markdown = this.storage.manager, this.editor.getMarkdown = () => this.storage.manager.serialize(this.editor.getJSON()), !this.editor.options.contentType || j(this.editor.options.content, this.editor.options.contentType) !== "markdown")
1881
1881
  return;
1882
1882
  if (!this.editor.markdown)
1883
1883
  throw new Error(
@@ -1891,37 +1891,49 @@ Ce.create({
1891
1891
  this.editor.options.content = e;
1892
1892
  }
1893
1893
  });
1894
- const Zt = [
1895
- Ie,
1894
+ const Zt = Ie.create({
1895
+ name: "bulletList",
1896
+ renderMarkdown: (t, e) => (t.content || []).map((s) => {
1897
+ const i = e.renderChildren(s.content || []).trimEnd().split(`
1898
+ `), a = `- ${i[0]}`, o = i.slice(1).map((l) => ` ${l}`);
1899
+ return [a, ...o].join(`
1900
+ `);
1901
+ }).join(`
1902
+ `) + `
1903
+
1904
+ `
1905
+ }), Wt = [
1896
1906
  Pe,
1897
1907
  Le,
1898
- Ke.configure({ levels: [1, 2, 3] }),
1899
1908
  Be,
1909
+ Ue.configure({ levels: [1, 2, 3] }),
1900
1910
  He,
1901
1911
  Oe,
1902
- Ue.configure({ taskList: !1, taskItem: !1, orderedList: !1 }),
1903
1912
  qe,
1904
- De,
1913
+ Je.configure({ taskList: !1, taskItem: !1, orderedList: !1 }),
1905
1914
  Ne,
1915
+ Zt,
1916
+ De,
1906
1917
  Fe,
1918
+ je,
1907
1919
  Qe,
1908
1920
  Ze,
1909
- je,
1910
1921
  We,
1911
1922
  Ge,
1912
- Xe
1923
+ Xe,
1924
+ Ke
1913
1925
  ];
1914
- function jt() {
1926
+ function Gt() {
1915
1927
  const t = new Ae();
1916
- for (const e of Zt)
1928
+ for (const e of Wt)
1917
1929
  t.registerExtension(e);
1918
1930
  return t;
1919
1931
  }
1920
1932
  let J = null;
1921
1933
  function K() {
1922
- return J || (J = jt()), J;
1934
+ return J || (J = Gt()), J;
1923
1935
  }
1924
- function Gt(t) {
1936
+ function Kt(t) {
1925
1937
  return K().serialize(t);
1926
1938
  }
1927
1939
  function ze(t) {
@@ -1935,33 +1947,33 @@ function ze(t) {
1935
1947
  function ve(t) {
1936
1948
  t.resolved && delete t.resolved, Array.isArray(t.content) && t.content.forEach(ve);
1937
1949
  }
1938
- function Xt(t) {
1950
+ function Ut(t) {
1939
1951
  const e = K().parse(t);
1940
1952
  return ze(e), ve(e), e;
1941
1953
  }
1942
- function Kt(t) {
1954
+ function Jt(t) {
1943
1955
  return K().serialize(t);
1944
1956
  }
1945
- function Ut(t) {
1957
+ function Vt(t) {
1946
1958
  const e = K().parse(t);
1947
1959
  return ze(e), e;
1948
1960
  }
1949
1961
  export {
1950
1962
  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
1963
+ rn as QalamEditor,
1964
+ an as QalamRenderer,
1965
+ je as QuranRef,
1966
+ Gt as createMarkdownManager,
1967
+ Kt as docToMarkdown,
1968
+ hn as getAllSurahs,
1969
+ pn as getSurahInfo,
1970
+ un as getVerseText,
1971
+ dn as isDataLoaded,
1972
+ gn as loadQuranData,
1973
+ Ut as markdownToDoc,
1974
+ Vt as markdownToResolvedDoc,
1975
+ on as resolveAST,
1976
+ kn as resolveSurah,
1977
+ Jt as resolvedDocToMarkdown,
1978
+ tn as validateAST
1967
1979
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAkBnD,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAuBlE,wBAAgB,qBAAqB,IAAI,eAAe,CAMvD;AASD,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAEnD;AAgBD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAKxD;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAIxE;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/markdown/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAmBnD,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAsClE,wBAAgB,qBAAqB,IAAI,eAAe,CAMvD;AASD,wBAAgB,aAAa,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAEnD;AAgBD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAKxD;AAED,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAIxE;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siladev/qalam",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Islamic content editor with Quran verse references",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",