@mintlify/msft-sdk 1.1.69 → 1.1.70
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/api-playground-2/components/Example/RequestExample.js +51 -51
- package/dist/api-playground-2/generators/generateSnippet.js +45 -30
- package/dist/components/apiPage.js +68 -68
- package/dist/components/content-components/code-snippet.js +12 -12
- package/dist/utils/request/isValidUrl.js +10 -0
- package/package.json +1 -1
|
@@ -1,96 +1,96 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { memo as
|
|
3
|
-
import { initialApiPlaygroundInputs as
|
|
4
|
-
import { generateSnippetMap as
|
|
5
|
-
import { useSelectedBaseUrl as
|
|
6
|
-
import { useSelectedRequestBodyContentType as
|
|
7
|
-
import { useSelectedSecurityOption as
|
|
8
|
-
import { CodeGroupSelect as
|
|
9
|
-
import { CodeSnippet as
|
|
10
|
-
import { CodeSnippets as
|
|
2
|
+
import { memo as v } from "react";
|
|
3
|
+
import { initialApiPlaygroundInputs as C } from "../../constants/index.js";
|
|
4
|
+
import { generateSnippetMap as O } from "../../generators/generateSnippetMap.js";
|
|
5
|
+
import { useSelectedBaseUrl as U } from "../../hooks/useSelectedBaseUrl.js";
|
|
6
|
+
import { useSelectedRequestBodyContentType as j } from "../../hooks/useSelectedRequestBodyContentType.js";
|
|
7
|
+
import { useSelectedSecurityOption as w } from "../../hooks/useSelectedSecurityOption.js";
|
|
8
|
+
import { CodeGroupSelect as L } from "../../../components/content-components/CodeGroupSelect/index.js";
|
|
9
|
+
import { CodeSnippet as T } from "../../../components/content-components/code-snippet.js";
|
|
10
|
+
import { CodeSnippets as k } from "../../../components/content-components/code-snippets.js";
|
|
11
11
|
import { CodeBlock as h } from "../../../components/content-components/code-block.js";
|
|
12
12
|
import { CodeGroup as b } from "../../../components/content-components/code-group.js";
|
|
13
|
-
import { shikiLangToDisplayLang as
|
|
14
|
-
import { useApiPlaygroundDisplay as
|
|
13
|
+
import { shikiLangToDisplayLang as P } from "../../../constants/snippetPresets.js";
|
|
14
|
+
import { useApiPlaygroundDisplay as F } from "../../../hooks/useApiPlaygroundDisplay.js";
|
|
15
15
|
import { GeneratedRequestExample as E } from "./GeneratedRequestExample.js";
|
|
16
|
-
const
|
|
16
|
+
const G = v(
|
|
17
17
|
({
|
|
18
18
|
apiReferenceData: e,
|
|
19
|
-
inputs:
|
|
20
|
-
maxHeight:
|
|
19
|
+
inputs: s = C,
|
|
20
|
+
maxHeight: a
|
|
21
21
|
}) => {
|
|
22
|
-
var
|
|
23
|
-
const
|
|
22
|
+
var f, g, y, S, x, q;
|
|
23
|
+
const t = (f = e.operation) == null ? void 0 : f.requestExamples, { selectedRequestBodyContentTypeIndex: p } = j(), { selectedSecurityOptionIndex: i } = w(), B = F(), u = (g = e.operation) == null ? void 0 : g.requestExampleLanguages, m = (y = e.operation) == null ? void 0 : y.requiredOnlyExamples, { baseUrl: d } = U();
|
|
24
24
|
switch ((S = e.operation) == null ? void 0 : S.requestExampleType) {
|
|
25
25
|
case "mdx":
|
|
26
|
-
if (!
|
|
27
|
-
const
|
|
28
|
-
return /* @__PURE__ */ r(b, { isSmallText: !0, dropdown:
|
|
26
|
+
if (!t) return null;
|
|
27
|
+
const M = t.some((o) => o.dropdown ?? !1);
|
|
28
|
+
return /* @__PURE__ */ r(b, { isSmallText: !0, dropdown: M, noMargins: !0, className: a, children: t.map((o, n) => /* @__PURE__ */ r(
|
|
29
29
|
h,
|
|
30
30
|
{
|
|
31
31
|
language: o.language,
|
|
32
32
|
fileName: o.filename,
|
|
33
33
|
children: /* @__PURE__ */ r("span", { children: o.code })
|
|
34
34
|
},
|
|
35
|
-
`${o.filename}-${o.language}-${
|
|
35
|
+
`${o.filename}-${o.language}-${n}`
|
|
36
36
|
)) });
|
|
37
37
|
case "webhook":
|
|
38
|
-
return (
|
|
38
|
+
return (x = t == null ? void 0 : t[0]) != null && x.code ? /* @__PURE__ */ r(b, { isSmallText: !0, noMargins: !0, hideCodeSnippetFeedbackButton: !0, children: /* @__PURE__ */ r(h, { language: "json", filename: "Example Request Body", children: /* @__PURE__ */ r(T, { language: "json", children: (q = t[0]) == null ? void 0 : q.code }) }) }) : null;
|
|
39
39
|
case "codeSamples":
|
|
40
40
|
if (!e.operation.codeSamples) return null;
|
|
41
|
-
const c =
|
|
41
|
+
const c = O({
|
|
42
42
|
apiReferenceData: e,
|
|
43
43
|
codeSamples: e.operation.codeSamples,
|
|
44
|
-
baseUrl:
|
|
45
|
-
apiPlaygroundMode:
|
|
46
|
-
requestExampleLanguages:
|
|
47
|
-
requiredOnly:
|
|
48
|
-
inputs:
|
|
49
|
-
selectedSecurityOptionIndex:
|
|
44
|
+
baseUrl: d,
|
|
45
|
+
apiPlaygroundMode: B,
|
|
46
|
+
requestExampleLanguages: u,
|
|
47
|
+
requiredOnly: m,
|
|
48
|
+
inputs: s,
|
|
49
|
+
selectedSecurityOptionIndex: i,
|
|
50
50
|
selectedRequestBodyContentTypeIndex: p
|
|
51
51
|
});
|
|
52
52
|
if (Object.values(c).every((o) => Object.keys(o).length <= 1)) {
|
|
53
|
-
let
|
|
54
|
-
return new Set(
|
|
53
|
+
let n = Object.values(c).flatMap((l) => Object.values(l));
|
|
54
|
+
return new Set(n.map((l) => l.filename)).size !== n.length && (n = n.map((l) => ({
|
|
55
55
|
...l,
|
|
56
|
-
filename:
|
|
57
|
-
}))), /* @__PURE__ */ r(
|
|
56
|
+
filename: P[l.language] ?? l.language
|
|
57
|
+
}))), /* @__PURE__ */ r(k, { snippets: n, noMargins: !0, dropdown: !0 });
|
|
58
58
|
}
|
|
59
|
-
return /* @__PURE__ */ r(
|
|
59
|
+
return /* @__PURE__ */ r(L, { snippets: c });
|
|
60
60
|
case "generated":
|
|
61
|
-
return
|
|
61
|
+
return /* @__PURE__ */ r(
|
|
62
62
|
E,
|
|
63
63
|
{
|
|
64
64
|
apiReferenceData: e,
|
|
65
|
-
baseUrl:
|
|
66
|
-
inputs:
|
|
67
|
-
selectedSecurityOptionIndex:
|
|
68
|
-
requestExampleLanguages:
|
|
69
|
-
requiredOnly:
|
|
65
|
+
baseUrl: d || "https://api.example.com",
|
|
66
|
+
inputs: s,
|
|
67
|
+
selectedSecurityOptionIndex: i,
|
|
68
|
+
requestExampleLanguages: u,
|
|
69
|
+
requiredOnly: m,
|
|
70
70
|
selectedRequestBodyContentTypeIndex: p,
|
|
71
|
-
maxHeight:
|
|
71
|
+
maxHeight: a
|
|
72
72
|
}
|
|
73
|
-
)
|
|
73
|
+
);
|
|
74
74
|
case "examples":
|
|
75
|
-
return
|
|
75
|
+
return e.operation.prefillPlaygroundExamples ? /* @__PURE__ */ r(
|
|
76
76
|
E,
|
|
77
77
|
{
|
|
78
78
|
apiReferenceData: e,
|
|
79
|
-
baseUrl:
|
|
80
|
-
inputs:
|
|
81
|
-
selectedSecurityOptionIndex:
|
|
82
|
-
requestExampleLanguages:
|
|
83
|
-
requiredOnly:
|
|
79
|
+
baseUrl: d || "https://api.example.com",
|
|
80
|
+
inputs: s,
|
|
81
|
+
selectedSecurityOptionIndex: i,
|
|
82
|
+
requestExampleLanguages: u,
|
|
83
|
+
requiredOnly: m,
|
|
84
84
|
selectedRequestBodyContentTypeIndex: p,
|
|
85
|
-
maxHeight:
|
|
85
|
+
maxHeight: a
|
|
86
86
|
}
|
|
87
|
-
);
|
|
87
|
+
) : null;
|
|
88
88
|
default:
|
|
89
89
|
return null;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
|
-
|
|
93
|
+
G.displayName = "RequestExample";
|
|
94
94
|
export {
|
|
95
|
-
|
|
95
|
+
G as RequestExample
|
|
96
96
|
};
|
|
@@ -1,39 +1,54 @@
|
|
|
1
|
-
import { HTTPSnippet as
|
|
1
|
+
import { HTTPSnippet as y } from "../../httpsnippet/src/index.js";
|
|
2
2
|
import { generateUniqueString as x } from "../../utils/uuid.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { isValidUrl as R } from "../../utils/request/isValidUrl.js";
|
|
4
|
+
import { snippetPresets as T } from "../../constants/snippetPresets.js";
|
|
5
|
+
const E = ({
|
|
6
|
+
request: n,
|
|
7
|
+
pathInputs: a,
|
|
7
8
|
apiReferenceData: s,
|
|
8
|
-
snippetPresets:
|
|
9
|
-
isMultipleRequest:
|
|
9
|
+
snippetPresets: p = T,
|
|
10
|
+
isMultipleRequest: l = !1
|
|
10
11
|
}) => {
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
}),
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
12
|
+
const c = {}, f = /:{[^{}]+}/g, m = n.url.replace(f, (e) => {
|
|
13
|
+
const t = ":62437";
|
|
14
|
+
return c[t] = e, t;
|
|
15
|
+
}), d = /{[^{}]+}/g, u = m.replace(d, (e) => {
|
|
16
|
+
const t = e.slice(1, e.length - 1), r = a[t];
|
|
17
|
+
if (e === "{endpoint}")
|
|
17
18
|
return "https://{endpoint}";
|
|
18
|
-
if (
|
|
19
|
-
return `${encodeURIComponent(
|
|
19
|
+
if (r && (typeof r != "string" || r.length > 0))
|
|
20
|
+
return `${encodeURIComponent(r.toString())}`;
|
|
20
21
|
const o = x();
|
|
21
|
-
return
|
|
22
|
-
}), h = new U({
|
|
23
|
-
...r,
|
|
24
|
-
url: d,
|
|
25
|
-
postData: r.postData || { mimeType: "application/json" }
|
|
22
|
+
return c[o] = e, o;
|
|
26
23
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
if (!R(u))
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
filename: "Error",
|
|
28
|
+
code: "A valid request URL is required to generate request examples",
|
|
29
|
+
language: ""
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
const h = new y({
|
|
33
|
+
...n,
|
|
34
|
+
url: u,
|
|
35
|
+
postData: n.postData || { mimeType: "application/json" }
|
|
35
36
|
});
|
|
36
|
-
|
|
37
|
+
return p.map((e) => {
|
|
38
|
+
var g;
|
|
39
|
+
const { filename: t, snippet: r, language: o } = e, { target: S, client: P } = r;
|
|
40
|
+
try {
|
|
41
|
+
const i = h.convert(S, P), U = A(c, (i == null ? void 0 : i.toString()) || "");
|
|
42
|
+
return {
|
|
43
|
+
filename: l ? t : ((g = s.operation) == null ? void 0 : g.title) || t,
|
|
44
|
+
code: U,
|
|
45
|
+
language: o
|
|
46
|
+
};
|
|
47
|
+
} catch (i) {
|
|
48
|
+
return console.error(`Error generating snippet for ${o}:`, i), null;
|
|
49
|
+
}
|
|
50
|
+
}).filter((e) => e !== null);
|
|
51
|
+
}, A = (n, a) => Object.entries(n).reduce((s, [p, l]) => s.replace(p, l), a);
|
|
37
52
|
export {
|
|
38
|
-
|
|
53
|
+
E as generateSnippet
|
|
39
54
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect as P } from "react";
|
|
3
3
|
import { ApiExamples as _ } from "../api-playground-2/ApiExamples.js";
|
|
4
4
|
import { ComponentsProvider as R } from "../context/components-context.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { cn as
|
|
6
|
+
import { cn as o } from "../utils/cn.js";
|
|
7
7
|
import { MDXRenderer as F } from "./mdx-renderer.js";
|
|
8
8
|
import { PageContextMenu as L } from "./page-context-menu.js";
|
|
9
9
|
import { Api as S } from "../api-playground-2/Api.js";
|
|
@@ -12,14 +12,14 @@ import { MINTLIFY_FILE_REQUEST_ENDPOINT_URL as U, MINTLIFY_REQUEST_ENDPOINT_URL
|
|
|
12
12
|
function $({
|
|
13
13
|
theme: a,
|
|
14
14
|
className: f = "",
|
|
15
|
-
pathname:
|
|
15
|
+
pathname: r,
|
|
16
16
|
markdownContent: h,
|
|
17
17
|
allPages: b,
|
|
18
18
|
baseUrl: p,
|
|
19
19
|
LinkComponent: g,
|
|
20
20
|
contextMenu: i,
|
|
21
21
|
contextMenuEnabled: w = !0,
|
|
22
|
-
apiReferenceData:
|
|
22
|
+
apiReferenceData: l,
|
|
23
23
|
pageMetadata: n,
|
|
24
24
|
playgroundDisplay: u = "simple",
|
|
25
25
|
requestEndpointUrl: x = j,
|
|
@@ -29,20 +29,20 @@ function $({
|
|
|
29
29
|
const { hash: s } = window.location;
|
|
30
30
|
if (!s) return;
|
|
31
31
|
const k = setTimeout(() => {
|
|
32
|
-
const N = s.substring(1),
|
|
33
|
-
if (
|
|
34
|
-
const d = window.getComputedStyle(document.documentElement), E = parseFloat(d.getPropertyValue("--scroll-mt") || "0"), T = parseFloat(d.fontSize), y = E * T, I =
|
|
35
|
-
|
|
32
|
+
const N = s.substring(1), e = document.getElementById("main-content"), c = document.getElementById(N);
|
|
33
|
+
if (e && c) {
|
|
34
|
+
const d = window.getComputedStyle(document.documentElement), E = parseFloat(d.getPropertyValue("--scroll-mt") || "0"), T = parseFloat(d.fontSize), y = E * T, I = e.getBoundingClientRect(), C = c.getBoundingClientRect().top - I.top + e.scrollTop - y;
|
|
35
|
+
e.scrollTo({
|
|
36
36
|
top: C,
|
|
37
37
|
behavior: "instant"
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
}, 100);
|
|
41
41
|
return () => clearTimeout(k);
|
|
42
|
-
}, [
|
|
42
|
+
}, [r]), /* @__PURE__ */ t(R, { LinkComponent: g, children: /* @__PURE__ */ t(
|
|
43
43
|
"div",
|
|
44
44
|
{
|
|
45
|
-
className:
|
|
45
|
+
className: o(
|
|
46
46
|
"mintlify-docs",
|
|
47
47
|
a === "dark" && "dark",
|
|
48
48
|
f,
|
|
@@ -62,69 +62,69 @@ function $({
|
|
|
62
62
|
"div",
|
|
63
63
|
{
|
|
64
64
|
id: "main-content",
|
|
65
|
-
className:
|
|
65
|
+
className: o(
|
|
66
66
|
"mint:flex-1 mint:p-8 mint:overflow-y-auto mint:overflow-x-hidden mint:rounded-tl-2xl mint:bg-white mint:dark:bg-[#1f1f1f] [scrollbar-gutter:stable] mint:overscroll-contain mint:lg:px-16 mint:lg:pt-12 [scrollbar-width:thin] [scrollbar-color:rgba(0,0,0,0.2)_transparent] dark:[scrollbar-color:rgba(255,255,255,0.2)_transparent] mint:[&::-webkit-scrollbar]:w-1 mint:[&::-webkit-scrollbar-track]:bg-transparent mint:[&::-webkit-scrollbar-thumb]:bg-black/20 mint:dark:[&::-webkit-scrollbar-thumb]:bg-white/20 mint:[&::-webkit-scrollbar-thumb]:rounded mint:[&::-webkit-scrollbar-thumb:hover]:bg-black/30 mint:dark:[&::-webkit-scrollbar-thumb:hover]:bg-white/30"
|
|
67
67
|
),
|
|
68
|
-
children: /* @__PURE__ */
|
|
69
|
-
|
|
68
|
+
children: /* @__PURE__ */ t(A, { value: {
|
|
69
|
+
pageMetadata: n,
|
|
70
|
+
pathname: r
|
|
71
|
+
}, children: /* @__PURE__ */ t(
|
|
72
|
+
B,
|
|
70
73
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
74
|
+
playgroundDisplay: u,
|
|
75
|
+
pageMetadata: n,
|
|
76
|
+
docsConfig: void 0,
|
|
77
|
+
mdxExtracts: void 0,
|
|
78
|
+
apiReferenceData2: l,
|
|
79
|
+
requestEndpointUrl: x,
|
|
80
|
+
fileRequestEndpointUrl: v,
|
|
81
|
+
children: /* @__PURE__ */ m(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
className: "mint:flex mint:flex-row-reverse mint:gap-12 mint:justify-center mint:mx-auto mint:w-full",
|
|
85
|
+
id: "content-layout-container",
|
|
86
|
+
children: [
|
|
87
|
+
(l == null ? void 0 : l.operation) && /* @__PURE__ */ t(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
className: "mint:self-start mint:sticky mint:flex-col mint:w-[448px] mint:top-4 mint:gap-6 mint:hidden mint:lg:flex",
|
|
91
|
+
children: /* @__PURE__ */ t(_, { noInputs: !0 })
|
|
92
|
+
}
|
|
86
93
|
),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
children: /* @__PURE__ */ t(S, {})
|
|
120
|
-
}
|
|
121
|
-
) }) }) })
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
)
|
|
125
|
-
]
|
|
94
|
+
/* @__PURE__ */ m(
|
|
95
|
+
"div",
|
|
96
|
+
{
|
|
97
|
+
className: o(
|
|
98
|
+
"mint:w-full mint:overflow-x-visible mint:max-w-[730px]"
|
|
99
|
+
),
|
|
100
|
+
children: [
|
|
101
|
+
n.title && /* @__PURE__ */ t("header", { className: "mint:mb-6", children: /* @__PURE__ */ m("div", { className: "mint:flex mint:flex-col mint:gap-5", children: [
|
|
102
|
+
/* @__PURE__ */ m("div", { className: "mint:flex mint:flex-col mint:gap-2 mint:items-start", children: [
|
|
103
|
+
/* @__PURE__ */ t("h1", { className: "mint:text-[1.875rem] mint:font-bold mint:text-[#141414] mint:dark:text-white mint:m-0 mint:leading-[1.2] mint:pt-3", children: n.title }),
|
|
104
|
+
n.description && /* @__PURE__ */ t("p", { className: "mint:text-lg mint:text-[#4b5563] mint:dark:text-[#d1d5db] mint:m-0", children: n.description })
|
|
105
|
+
] }),
|
|
106
|
+
r && w && /* @__PURE__ */ t(
|
|
107
|
+
L,
|
|
108
|
+
{
|
|
109
|
+
className: "mint:shrink-0",
|
|
110
|
+
pathname: r,
|
|
111
|
+
markdownContent: h,
|
|
112
|
+
allPages: b,
|
|
113
|
+
baseUrl: p,
|
|
114
|
+
onCopyMarkdown: i == null ? void 0 : i.onCopyMarkdown,
|
|
115
|
+
onViewMarkdown: i == null ? void 0 : i.onViewMarkdown
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] }) }),
|
|
119
|
+
/* @__PURE__ */ t("div", { className: "mint:pt-4", children: /* @__PURE__ */ t(F, { children: /* @__PURE__ */ t(S, {}) }) })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
126
|
}
|
|
127
|
-
)
|
|
127
|
+
) })
|
|
128
128
|
}
|
|
129
129
|
)
|
|
130
130
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import e from "prismjs";
|
|
3
3
|
import "prismjs/components/prism-javascript.js";
|
|
4
4
|
import "prismjs/components/prism-typescript.js";
|
|
5
5
|
import "prismjs/components/prism-python.js";
|
|
@@ -9,21 +9,21 @@ import "prismjs/components/prism-markdown.js";
|
|
|
9
9
|
import "prismjs/components/prism-csharp.js";
|
|
10
10
|
import "prismjs/components/prism-powershell.js";
|
|
11
11
|
import "prismjs/components/prism-java.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function
|
|
12
|
+
import "prismjs/components/prism-ruby.js";
|
|
13
|
+
import "prismjs/components/prism-go.js";
|
|
14
|
+
function W({ language: r, children: t }) {
|
|
15
15
|
const n = typeof t == "string" ? t : "";
|
|
16
16
|
r = r ?? "text";
|
|
17
|
-
let
|
|
17
|
+
let i = "";
|
|
18
18
|
if (n)
|
|
19
19
|
try {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
} catch (
|
|
23
|
-
console.error("Failed to highlight code:",
|
|
20
|
+
const p = e.languages[r] || e.languages.plaintext;
|
|
21
|
+
i = e.highlight(n, p, r);
|
|
22
|
+
} catch (p) {
|
|
23
|
+
console.error("Failed to highlight code:", p);
|
|
24
24
|
}
|
|
25
|
-
return typeof t == "string" && r &&
|
|
25
|
+
return typeof t == "string" && r && i ? /* @__PURE__ */ o("pre", { suppressHydrationWarning: !0, children: /* @__PURE__ */ o("code", { suppressHydrationWarning: !0, dangerouslySetInnerHTML: { __html: i } }) }) : /* @__PURE__ */ o("pre", { suppressHydrationWarning: !0, children: /* @__PURE__ */ o("code", { suppressHydrationWarning: !0, children: t }) });
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
W as CodeSnippet
|
|
29
29
|
};
|