@coderminer/vue-markdown 0.0.0-stage → 1.0.1
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/CHANGELOG.md +226 -0
- package/LICENSE +21 -0
- package/README.md +584 -3
- package/README.zh-CN.md +550 -0
- package/dist/chunks/MarkdownBlockquote-DVXziX2t.js +16 -0
- package/dist/chunks/MarkdownBreak-BwCi2Itt.js +16 -0
- package/dist/chunks/MarkdownCode-B1k9tmW5.js +63 -0
- package/dist/chunks/MarkdownConfigProvider-5N3ylrIu.js +49 -0
- package/dist/chunks/MarkdownContent-BAK6dqo7.js +13 -0
- package/dist/chunks/MarkdownCustomTag-lZJHsD6f.js +46 -0
- package/dist/chunks/MarkdownEmphasis-CppivOEu.js +16 -0
- package/dist/chunks/MarkdownEmpty-Av5k6bqa.js +14 -0
- package/dist/chunks/MarkdownError-C0sPs5W0.js +17 -0
- package/dist/chunks/MarkdownFootnoteReference-Dy3Khwyj.js +22 -0
- package/dist/chunks/MarkdownFootnotes-BRPzkbXv.js +21 -0
- package/dist/chunks/MarkdownHeading-DaNcP0_6.js +29 -0
- package/dist/chunks/MarkdownHorizontalRule-QNe_cuUI.js +16 -0
- package/dist/chunks/MarkdownHtml-66lYkvwM.js +13 -0
- package/dist/chunks/MarkdownImage-BRy76svs.js +51 -0
- package/dist/chunks/MarkdownInlineCode-MXZYFwex.js +16 -0
- package/dist/chunks/MarkdownLink-Dbx3NwgV.js +45 -0
- package/dist/chunks/MarkdownList-BJ-_C71k.js +20 -0
- package/dist/chunks/MarkdownListItem-Z1EHIY26.js +16 -0
- package/dist/chunks/MarkdownLoading-D-RYtXxf.js +15 -0
- package/dist/chunks/MarkdownParagraph-BxLSmSaG.js +16 -0
- package/dist/chunks/MarkdownRenderer-OlkdsvI3.js +482 -0
- package/dist/chunks/MarkdownRoot-DEE6iVfh.js +23 -0
- package/dist/chunks/MarkdownStrikethrough-CblvbqDk.js +16 -0
- package/dist/chunks/MarkdownStrong-uU5MzAoJ.js +16 -0
- package/dist/chunks/MarkdownTable-DmBTg_CR.js +16 -0
- package/dist/chunks/MarkdownTableCell-eiCJe847.js +31 -0
- package/dist/chunks/MarkdownTableRow-DuJaPntg.js +16 -0
- package/dist/chunks/MarkdownTableSection-PFHz-R33.js +24 -0
- package/dist/chunks/MarkdownTaskItem-BcmKo1lk.js +38 -0
- package/dist/chunks/MarkdownToc-DHWWoH6t.js +49 -0
- package/dist/chunks/MarkdownTocItem-DT9mR3vL.js +25 -0
- package/dist/chunks/MermaidLiveEditor-1TKkI5bp.js +414 -0
- package/dist/chunks/VueSyntaxHighlighter-BWpCO-cX.js +260 -0
- package/dist/chunks/adapters-CMwX_NEI.js +26 -0
- package/dist/chunks/asyncToGenerator-ChigusFD.js +26 -0
- package/dist/chunks/blank-line-CKKsFeKR.js +88 -0
- package/dist/chunks/codemirror-DyphMAEg.js +82 -0
- package/dist/chunks/config-aRYo2R8_.js +10 -0
- package/dist/chunks/context-8NfW6fxI.js +30 -0
- package/dist/chunks/convert-hast-C4Rg2ZuF.js +6 -0
- package/dist/chunks/default-ZQ5aHh-N.js +3 -0
- package/dist/chunks/diagnostics-CtHoJyiX.js +23 -0
- package/dist/chunks/export-BrgMLgUp.js +1574 -0
- package/dist/chunks/hast-to-nodes-DuZsi4XT.js +29 -0
- package/dist/chunks/hast-util-from-html-D3e_iQ89.js +5088 -0
- package/dist/chunks/highlightjs-BxJFpKS1.js +196 -0
- package/dist/chunks/identity-Bi27FKyx.js +6243 -0
- package/dist/chunks/labels-BtHiUTQI.js +47 -0
- package/dist/chunks/lib-CCnkLL6S.js +252 -0
- package/dist/chunks/longest-streak-DZE_EqsU.js +8 -0
- package/dist/chunks/micromark-factory-space-CpXAnYUY.js +137 -0
- package/dist/chunks/normalize-VKfQXZiK.js +226 -0
- package/dist/chunks/objectSpread2-CtBNx0TF.js +57 -0
- package/dist/chunks/plugin-YWo5uqTh.js +27 -0
- package/dist/chunks/preset-BjaOuJUL.js +44 -0
- package/dist/chunks/registry-B7BfEkuy.js +6150 -0
- package/dist/chunks/render-DAqK0w5J.js +1754 -0
- package/dist/chunks/rolldown-runtime-QGRDbDUS.js +19 -0
- package/dist/chunks/runtime-D95F41zG.js +574 -0
- package/dist/chunks/security-y4EwUyAs.js +212 -0
- package/dist/chunks/shared-NjFDPmkb.js +67 -0
- package/dist/chunks/space-separated-tokens-1ebNqf35.js +1097 -0
- package/dist/chunks/url-D2BoivaE.js +24 -0
- package/dist/chunks/useActiveHeading-CnyGTG1u.js +359 -0
- package/dist/components/CodeBlock.d.ts +73 -0
- package/dist/components/CodeBlock.js +1 -0
- package/dist/components/Icon.d.ts +6 -0
- package/dist/components/MarkdownBlockquote.d.ts +18 -0
- package/dist/components/MarkdownBlockquote.js +1 -0
- package/dist/components/MarkdownBreak.d.ts +8 -0
- package/dist/components/MarkdownBreak.js +1 -0
- package/dist/components/MarkdownChildren.d.ts +17 -0
- package/dist/components/MarkdownCode.d.ts +29 -0
- package/dist/components/MarkdownCode.js +1 -0
- package/dist/components/MarkdownConfigProvider.d.ts +33 -0
- package/dist/components/MarkdownConfigProvider.js +1 -0
- package/dist/components/MarkdownContent.d.ts +16 -0
- package/dist/components/MarkdownContent.js +1 -0
- package/dist/components/MarkdownCustomTag.d.ts +20 -0
- package/dist/components/MarkdownCustomTag.js +1 -0
- package/dist/components/MarkdownEmphasis.d.ts +18 -0
- package/dist/components/MarkdownEmphasis.js +1 -0
- package/dist/components/MarkdownEmpty.d.ts +8 -0
- package/dist/components/MarkdownEmpty.js +1 -0
- package/dist/components/MarkdownError.d.ts +11 -0
- package/dist/components/MarkdownError.js +1 -0
- package/dist/components/MarkdownFootnoteReference.d.ts +19 -0
- package/dist/components/MarkdownFootnoteReference.js +1 -0
- package/dist/components/MarkdownFootnotes.d.ts +17 -0
- package/dist/components/MarkdownFootnotes.js +1 -0
- package/dist/components/MarkdownHeading.d.ts +18 -0
- package/dist/components/MarkdownHeading.js +1 -0
- package/dist/components/MarkdownHorizontalRule.d.ts +8 -0
- package/dist/components/MarkdownHorizontalRule.js +1 -0
- package/dist/components/MarkdownHtml.d.ts +8 -0
- package/dist/components/MarkdownHtml.js +1 -0
- package/dist/components/MarkdownImage.d.ts +15 -0
- package/dist/components/MarkdownImage.js +1 -0
- package/dist/components/MarkdownInlineCode.d.ts +18 -0
- package/dist/components/MarkdownInlineCode.js +1 -0
- package/dist/components/MarkdownLink.d.ts +22 -0
- package/dist/components/MarkdownLink.js +1 -0
- package/dist/components/MarkdownList.d.ts +18 -0
- package/dist/components/MarkdownList.js +1 -0
- package/dist/components/MarkdownListItem.d.ts +18 -0
- package/dist/components/MarkdownListItem.js +1 -0
- package/dist/components/MarkdownLoading.d.ts +8 -0
- package/dist/components/MarkdownLoading.js +1 -0
- package/dist/components/MarkdownMath.d.ts +12 -0
- package/dist/components/MarkdownMath.js +1 -0
- package/dist/components/MarkdownMermaid.d.ts +78 -0
- package/dist/components/MarkdownMermaid.js +1 -0
- package/dist/components/MarkdownParagraph.d.ts +18 -0
- package/dist/components/MarkdownParagraph.js +1 -0
- package/dist/components/MarkdownRenderer.d.ts +167 -0
- package/dist/components/MarkdownRenderer.js +1 -0
- package/dist/components/MarkdownRoot.d.ts +24 -0
- package/dist/components/MarkdownRoot.js +1 -0
- package/dist/components/MarkdownStrikethrough.d.ts +18 -0
- package/dist/components/MarkdownStrikethrough.js +1 -0
- package/dist/components/MarkdownStrong.d.ts +18 -0
- package/dist/components/MarkdownStrong.js +1 -0
- package/dist/components/MarkdownTable.d.ts +18 -0
- package/dist/components/MarkdownTable.js +1 -0
- package/dist/components/MarkdownTableCell.d.ts +20 -0
- package/dist/components/MarkdownTableCell.js +1 -0
- package/dist/components/MarkdownTableRow.d.ts +18 -0
- package/dist/components/MarkdownTableRow.js +1 -0
- package/dist/components/MarkdownTableSection.d.ts +18 -0
- package/dist/components/MarkdownTableSection.js +1 -0
- package/dist/components/MarkdownTaskItem.d.ts +20 -0
- package/dist/components/MarkdownTaskItem.js +1 -0
- package/dist/components/MarkdownToc.d.ts +36 -0
- package/dist/components/MarkdownToc.js +1 -0
- package/dist/components/MarkdownTocItem.d.ts +14 -0
- package/dist/components/MarkdownTocItem.js +1 -0
- package/dist/components/MermaidBlock.d.ts +50 -0
- package/dist/components/MermaidBlock.js +1 -0
- package/dist/components/MermaidLiveEditor.d.ts +44 -0
- package/dist/components/MermaidLiveEditor.js +1 -0
- package/dist/components/VueSyntaxHighlighter.d.ts +39 -0
- package/dist/components/VueSyntaxHighlighter.js +1 -0
- package/dist/components/codeRegion.d.ts +14 -0
- package/dist/components/config.d.ts +7 -0
- package/dist/components/context.d.ts +45 -0
- package/dist/components/index.d.ts +42 -0
- package/dist/components/index.js +38 -0
- package/dist/components/render.d.ts +9 -0
- package/dist/components/scroll-lock.d.ts +7 -0
- package/dist/components/types.d.ts +61 -0
- package/dist/composables/useActiveHeading.d.ts +12 -0
- package/dist/composables/useCodeHighlighter.d.ts +30 -0
- package/dist/composables/useLineWindow.d.ts +38 -0
- package/dist/composables/useMarkdownDocument.d.ts +25 -0
- package/dist/core/adapters.d.ts +7 -0
- package/dist/core/config.d.ts +5 -0
- package/dist/core/diagnostics.d.ts +9 -0
- package/dist/core/finalize.d.ts +18 -0
- package/dist/core/hast-nodes.d.ts +3 -0
- package/dist/core/hast-to-nodes.d.ts +9 -0
- package/dist/core/highlight-lines.d.ts +8 -0
- package/dist/core/identity.d.ts +4 -0
- package/dist/core/labels.d.ts +4 -0
- package/dist/core/manifest.d.ts +38 -0
- package/dist/core/memo.d.ts +5 -0
- package/dist/core/model-hast.d.ts +8 -0
- package/dist/core/model.d.ts +10 -0
- package/dist/core/normalize.d.ts +37 -0
- package/dist/core/parts.d.ts +136 -0
- package/dist/core/preset.d.ts +10 -0
- package/dist/core/run.d.ts +16 -0
- package/dist/core/search.d.ts +5 -0
- package/dist/core/security.d.ts +21 -0
- package/dist/core/slugger.d.ts +13 -0
- package/dist/core/types.d.ts +392 -0
- package/dist/core/url.d.ts +10 -0
- package/dist/editor/codemirror.d.ts +14 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/index.js +1 -0
- package/dist/export/index.d.ts +6 -0
- package/dist/headless.d.ts +21 -0
- package/dist/headless.js +12 -0
- package/dist/highlight/convert-hast.d.ts +8 -0
- package/dist/highlight/highlightjs.d.ts +7 -0
- package/dist/highlight/index.d.ts +4 -0
- package/dist/highlight/index.js +4 -0
- package/dist/highlight/shared.d.ts +11 -0
- package/dist/highlight/shiki.d.ts +7 -0
- package/dist/highlight/shiki.js +75 -0
- package/dist/html/index.d.ts +17 -0
- package/dist/html/index.js +11 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +53 -0
- package/dist/math/index.d.ts +4 -0
- package/dist/math/index.js +585 -0
- package/dist/math/katex.d.ts +4 -0
- package/dist/math/plugin.d.ts +20 -0
- package/dist/mermaid/index.d.ts +6 -0
- package/dist/mermaid/index.js +8 -0
- package/dist/mermaid/plugin.d.ts +17 -0
- package/dist/mermaid/runtime.d.ts +14 -0
- package/dist/mermaid/sanitize-svg-lazy.d.ts +10 -0
- package/dist/mermaid/sanitize-svg.d.ts +3 -0
- package/dist/mermaid/sanitize.d.ts +16 -0
- package/dist/node-components.d.ts +1 -0
- package/dist/node-components.js +39 -0
- package/dist/pipeline/custom.d.ts +8 -0
- package/dist/pipeline/identity.d.ts +12 -0
- package/dist/pipeline/index.d.ts +5 -0
- package/dist/pipeline/official.d.ts +6 -0
- package/dist/pipeline.d.ts +1 -0
- package/dist/pipeline.js +1 -0
- package/dist/plugins/builtin.d.ts +15 -0
- package/dist/plugins/define.d.ts +7 -0
- package/dist/plugins/registry.d.ts +16 -0
- package/dist/plugins/source.d.ts +7 -0
- package/dist/plugins.d.ts +3 -0
- package/dist/plugins.js +1 -0
- package/dist/presets.d.ts +3 -0
- package/dist/presets.js +1 -0
- package/dist/style.css +2 -0
- package/dist/styles/components.css +737 -0
- package/dist/styles/index.d.ts +1 -0
- package/dist/styles/math-full.css +3 -0
- package/dist/styles/math.css +18 -0
- package/dist/styles/tokens.css +96 -0
- package/package.json +214 -6
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { t as e } from "./url-D2BoivaE.js";
|
|
2
|
+
// src/core/security.ts
|
|
3
|
+
var t = /* @__PURE__ */ new Set(/* @__PURE__ */ "p.h1.h2.h3.h4.h5.h6.em.strong.del.a.img.ul.ol.li.blockquote.hr.table.thead.tbody.tfoot.tr.th.td.caption.colgroup.col.pre.code.br.input.section.div.span.sup.sub.kbd.mark.abbr.details.summary.dl.dt.dd.figure.figcaption.time.b.i.s.u.q.ins.picture.source.ruby.rp.rt.samp.var.tt.strike".split(".")), n = /* @__PURE__ */ new Set([
|
|
4
|
+
"script",
|
|
5
|
+
"style",
|
|
6
|
+
"iframe",
|
|
7
|
+
"object",
|
|
8
|
+
"embed",
|
|
9
|
+
"link",
|
|
10
|
+
"meta",
|
|
11
|
+
"base",
|
|
12
|
+
"form",
|
|
13
|
+
"textarea",
|
|
14
|
+
"select",
|
|
15
|
+
"option",
|
|
16
|
+
"template",
|
|
17
|
+
"noscript",
|
|
18
|
+
"svg",
|
|
19
|
+
"math"
|
|
20
|
+
]), r = /* @__PURE__ */ new Set([
|
|
21
|
+
"href",
|
|
22
|
+
"src",
|
|
23
|
+
"cite",
|
|
24
|
+
"poster",
|
|
25
|
+
"action",
|
|
26
|
+
"formaction",
|
|
27
|
+
"data",
|
|
28
|
+
"srcset",
|
|
29
|
+
"xlink:href"
|
|
30
|
+
]), i = /* @__PURE__ */ new Set([
|
|
31
|
+
"id",
|
|
32
|
+
"class",
|
|
33
|
+
"title",
|
|
34
|
+
"lang",
|
|
35
|
+
"dir",
|
|
36
|
+
"role",
|
|
37
|
+
"tabindex",
|
|
38
|
+
"hidden",
|
|
39
|
+
"align"
|
|
40
|
+
]), a = {
|
|
41
|
+
a: [
|
|
42
|
+
"href",
|
|
43
|
+
"target",
|
|
44
|
+
"rel",
|
|
45
|
+
"download",
|
|
46
|
+
"hreflang",
|
|
47
|
+
"type",
|
|
48
|
+
"name"
|
|
49
|
+
],
|
|
50
|
+
img: [
|
|
51
|
+
"src",
|
|
52
|
+
"alt",
|
|
53
|
+
"width",
|
|
54
|
+
"height",
|
|
55
|
+
"loading",
|
|
56
|
+
"decoding",
|
|
57
|
+
"srcset",
|
|
58
|
+
"sizes",
|
|
59
|
+
"referrerpolicy",
|
|
60
|
+
"crossorigin"
|
|
61
|
+
],
|
|
62
|
+
ol: [
|
|
63
|
+
"start",
|
|
64
|
+
"reversed",
|
|
65
|
+
"type"
|
|
66
|
+
],
|
|
67
|
+
ul: ["type"],
|
|
68
|
+
li: ["value"],
|
|
69
|
+
input: [
|
|
70
|
+
"type",
|
|
71
|
+
"checked",
|
|
72
|
+
"disabled",
|
|
73
|
+
"name",
|
|
74
|
+
"value"
|
|
75
|
+
],
|
|
76
|
+
td: [
|
|
77
|
+
"colspan",
|
|
78
|
+
"rowspan",
|
|
79
|
+
"headers",
|
|
80
|
+
"scope"
|
|
81
|
+
],
|
|
82
|
+
th: [
|
|
83
|
+
"colspan",
|
|
84
|
+
"rowspan",
|
|
85
|
+
"headers",
|
|
86
|
+
"scope",
|
|
87
|
+
"abbr"
|
|
88
|
+
],
|
|
89
|
+
table: ["summary"],
|
|
90
|
+
col: ["span", "width"],
|
|
91
|
+
colgroup: ["span"],
|
|
92
|
+
blockquote: ["cite"],
|
|
93
|
+
q: ["cite"],
|
|
94
|
+
del: ["cite", "datetime"],
|
|
95
|
+
ins: ["cite", "datetime"],
|
|
96
|
+
time: ["datetime"],
|
|
97
|
+
source: [
|
|
98
|
+
"src",
|
|
99
|
+
"srcset",
|
|
100
|
+
"sizes",
|
|
101
|
+
"media",
|
|
102
|
+
"type"
|
|
103
|
+
],
|
|
104
|
+
details: ["open"],
|
|
105
|
+
code: ["class"],
|
|
106
|
+
pre: ["class"],
|
|
107
|
+
abbr: ["title"],
|
|
108
|
+
section: ["data-footnotes", "data-footnote-ref"],
|
|
109
|
+
sup: ["data-footnote-ref"]
|
|
110
|
+
}, o = {
|
|
111
|
+
classname: "class",
|
|
112
|
+
htmlfor: "for",
|
|
113
|
+
srcset: "srcset",
|
|
114
|
+
colspan: "colspan",
|
|
115
|
+
rowspan: "rowspan",
|
|
116
|
+
charset: "charset",
|
|
117
|
+
httpequiv: "http-equiv",
|
|
118
|
+
tabindex: "tabindex",
|
|
119
|
+
readonly: "readonly",
|
|
120
|
+
maxlength: "maxlength",
|
|
121
|
+
minlength: "minlength",
|
|
122
|
+
autocomplete: "autocomplete",
|
|
123
|
+
referrerpolicy: "referrerpolicy",
|
|
124
|
+
crossorigin: "crossorigin",
|
|
125
|
+
datetime: "datetime"
|
|
126
|
+
};
|
|
127
|
+
function s(e) {
|
|
128
|
+
return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").toLowerCase();
|
|
129
|
+
}
|
|
130
|
+
function c(e) {
|
|
131
|
+
return /^data[A-Z]/.test(e) ? `data-${s(e.slice(4))}` : /^aria[A-Z]/.test(e) ? `aria-${e.slice(4).toLowerCase()}` : o[e.toLowerCase()] || (e.includes("-") ? e.toLowerCase() : s(e));
|
|
132
|
+
}
|
|
133
|
+
function l(e, t) {
|
|
134
|
+
if (t.startsWith("on") || t === "style" || t === "srcdoc") return !1;
|
|
135
|
+
if (t.startsWith("aria-") || t.startsWith("data-") || i.has(t)) return !0;
|
|
136
|
+
let n = a[e];
|
|
137
|
+
return n ? n.includes(t) : /^[a-z][a-z0-9-]*$/.test(t);
|
|
138
|
+
}
|
|
139
|
+
function u(t, n) {
|
|
140
|
+
return t.trim() === "" || e(t, n) !== "";
|
|
141
|
+
}
|
|
142
|
+
function d(e) {
|
|
143
|
+
let t = [], n = 0;
|
|
144
|
+
for (; n < e.length;) {
|
|
145
|
+
for (; n < e.length && /[\s,]/.test(e[n]);) n++;
|
|
146
|
+
if (n >= e.length) break;
|
|
147
|
+
let r = n;
|
|
148
|
+
for (; n < e.length && !/\s/.test(e[n]);) n++;
|
|
149
|
+
let i = e.slice(r, n), a = !1;
|
|
150
|
+
for (; i.endsWith(",");) i = i.slice(0, -1), a = !0;
|
|
151
|
+
let o = "";
|
|
152
|
+
if (!a) {
|
|
153
|
+
let t = n;
|
|
154
|
+
for (; n < e.length && e[n] !== ",";) n++;
|
|
155
|
+
o = e.slice(t, n).trim();
|
|
156
|
+
}
|
|
157
|
+
i && t.push({
|
|
158
|
+
url: i,
|
|
159
|
+
descriptor: o
|
|
160
|
+
}), n < e.length && e[n] === "," && n++;
|
|
161
|
+
}
|
|
162
|
+
return t;
|
|
163
|
+
}
|
|
164
|
+
function f(e, t) {
|
|
165
|
+
if (t === "srcset") {
|
|
166
|
+
let t = [];
|
|
167
|
+
for (let n of d(e)) u(n.url, "src") && t.push(n.descriptor ? `${n.url} ${n.descriptor}` : n.url);
|
|
168
|
+
return t.length > 0 ? t.join(", ") : void 0;
|
|
169
|
+
}
|
|
170
|
+
return u(e, t) ? e : void 0;
|
|
171
|
+
}
|
|
172
|
+
var p = /* @__PURE__ */ new Set([
|
|
173
|
+
"color",
|
|
174
|
+
"background-color",
|
|
175
|
+
"font-style",
|
|
176
|
+
"font-weight",
|
|
177
|
+
"text-decoration",
|
|
178
|
+
"opacity"
|
|
179
|
+
]), m = /url\s*\(|expression\s*\(|javascript\s*:|@import|behavior\s*:|-moz-binding|[<>{}]/i;
|
|
180
|
+
function h(e) {
|
|
181
|
+
let t = [];
|
|
182
|
+
for (let n of e.split(";")) {
|
|
183
|
+
let e = n.indexOf(":");
|
|
184
|
+
if (e <= 0) continue;
|
|
185
|
+
let r = n.slice(0, e).trim().toLowerCase(), i = n.slice(e + 1).trim();
|
|
186
|
+
r && i && (m.test(i) || (p.has(r) || /^--shiki-[a-z0-9-]+$/.test(r)) && t.push(`${r}: ${i}`));
|
|
187
|
+
}
|
|
188
|
+
return t.length > 0 ? t.join("; ") : void 0;
|
|
189
|
+
}
|
|
190
|
+
function g(e, t, n = {}) {
|
|
191
|
+
let i = {};
|
|
192
|
+
if (!t) return i;
|
|
193
|
+
for (let a of Object.keys(t)) {
|
|
194
|
+
let o = t[a];
|
|
195
|
+
if (o == null || o === !1) continue;
|
|
196
|
+
let s = c(a), u;
|
|
197
|
+
if (u = o === !0 ? "" : Array.isArray(o) ? o.join(" ") : String(o), s === "style") {
|
|
198
|
+
if (!n.allowStyle) continue;
|
|
199
|
+
let e = h(u);
|
|
200
|
+
if (e === void 0) continue;
|
|
201
|
+
i.style = e;
|
|
202
|
+
} else if (l(e, s)) {
|
|
203
|
+
if (r.has(s)) {
|
|
204
|
+
let e = f(u, s);
|
|
205
|
+
if (e === void 0) continue;
|
|
206
|
+
i[s] = e;
|
|
207
|
+
} else i[s] = u;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return i;
|
|
211
|
+
}
|
|
212
|
+
export { f as a, g as i, n, r, t };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { t as e } from "./objectSpread2-CtBNx0TF.js";
|
|
2
|
+
// src/highlight/shared.ts
|
|
3
|
+
var t = 256, n = /* @__PURE__ */ new Map();
|
|
4
|
+
function r(e, t = "") {
|
|
5
|
+
return {
|
|
6
|
+
language: t,
|
|
7
|
+
nodes: [{
|
|
8
|
+
kind: "text",
|
|
9
|
+
key: "highlight-0",
|
|
10
|
+
value: e
|
|
11
|
+
}]
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function i(e, t, n, r) {
|
|
15
|
+
var i, a;
|
|
16
|
+
return [
|
|
17
|
+
e.id,
|
|
18
|
+
n,
|
|
19
|
+
(i = r.theme) == null ? "" : i,
|
|
20
|
+
(a = r.colorScheme) == null ? "" : a,
|
|
21
|
+
JSON.stringify(r),
|
|
22
|
+
t
|
|
23
|
+
].join("");
|
|
24
|
+
}
|
|
25
|
+
function a() {
|
|
26
|
+
n.clear();
|
|
27
|
+
}
|
|
28
|
+
function o(e) {
|
|
29
|
+
if (!e || typeof e != "object") return !1;
|
|
30
|
+
let t = e;
|
|
31
|
+
return typeof t.language == "string" && Array.isArray(t.nodes);
|
|
32
|
+
}
|
|
33
|
+
function s(e, a, s, c = {}) {
|
|
34
|
+
if (!e) return r(a, s);
|
|
35
|
+
let l = i(e, a, s, c), u = n.get(l);
|
|
36
|
+
if (u) return u;
|
|
37
|
+
let d;
|
|
38
|
+
try {
|
|
39
|
+
let t = e.highlight(a, s, c);
|
|
40
|
+
d = o(t) ? t : r(a, s);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
d = r(a, s);
|
|
43
|
+
}
|
|
44
|
+
if (n.set(l, d), n.size > t) {
|
|
45
|
+
let e = n.keys().next().value;
|
|
46
|
+
e !== void 0 && n.delete(e);
|
|
47
|
+
}
|
|
48
|
+
return d;
|
|
49
|
+
}
|
|
50
|
+
function c(t) {
|
|
51
|
+
let n = 0, r = () => `line-${n++}`, i = (t) => t.kind === "text" ? t.value.split("\n").map((e) => e === "" ? [] : [{
|
|
52
|
+
kind: "text",
|
|
53
|
+
key: r(),
|
|
54
|
+
value: e
|
|
55
|
+
}]) : !("children" in t) || !Array.isArray(t.children) ? [[t]] : a(t.children).map((n) => [e(e({}, t), {}, {
|
|
56
|
+
key: r(),
|
|
57
|
+
children: n
|
|
58
|
+
})]), a = (e) => {
|
|
59
|
+
let t = [[]];
|
|
60
|
+
for (let n of e) i(n).forEach((e, n) => {
|
|
61
|
+
n > 0 && t.push([]), t[t.length - 1].push(...e);
|
|
62
|
+
});
|
|
63
|
+
return t;
|
|
64
|
+
};
|
|
65
|
+
return a(t);
|
|
66
|
+
}
|
|
67
|
+
export { c as i, r as n, s as r, a as t };
|