fumadocs-core 16.4.0 → 16.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.
- package/dist/advanced-BRT5Ij43.js +80 -0
- package/dist/advanced-BRT5Ij43.js.map +1 -0
- package/dist/algolia-CBBN8R6-.d.ts +68 -0
- package/dist/algolia-CBBN8R6-.d.ts.map +1 -0
- package/dist/algolia-CQPXCnjV.js +49 -0
- package/dist/algolia-CQPXCnjV.js.map +1 -0
- package/dist/breadcrumb.d.ts +29 -27
- package/dist/breadcrumb.d.ts.map +1 -0
- package/dist/breadcrumb.js +55 -72
- package/dist/breadcrumb.js.map +1 -0
- package/dist/chunk-B-ezknvj.js +42 -0
- package/dist/codeblock-utils-lld8UiQo.d.ts +37 -0
- package/dist/codeblock-utils-lld8UiQo.d.ts.map +1 -0
- package/dist/content/github.d.ts +43 -32
- package/dist/content/github.d.ts.map +1 -0
- package/dist/content/github.js +29 -43
- package/dist/content/github.js.map +1 -0
- package/dist/content/index.d.ts +20 -13
- package/dist/content/index.d.ts.map +1 -0
- package/dist/content/index.js +17 -23
- package/dist/content/index.js.map +1 -0
- package/dist/content/mdx/preset-bundler.d.ts +22 -24
- package/dist/content/mdx/preset-bundler.d.ts.map +1 -0
- package/dist/content/mdx/preset-bundler.js +38 -69
- package/dist/content/mdx/preset-bundler.js.map +1 -0
- package/dist/content/mdx/preset-runtime.d.ts +22 -24
- package/dist/content/mdx/preset-runtime.d.ts.map +1 -0
- package/dist/content/mdx/preset-runtime.js +36 -68
- package/dist/content/mdx/preset-runtime.js.map +1 -0
- package/dist/content/toc.d.ts +7 -6
- package/dist/content/toc.d.ts.map +1 -0
- package/dist/content/toc.js +15 -19
- package/dist/content/toc.js.map +1 -0
- package/dist/definitions-DuxDer_c.d.ts +62 -0
- package/dist/definitions-DuxDer_c.d.ts.map +1 -0
- package/dist/dynamic-link.d.ts +7 -5
- package/dist/dynamic-link.d.ts.map +1 -0
- package/dist/dynamic-link.js +29 -27
- package/dist/dynamic-link.js.map +1 -0
- package/dist/fetch-B5e9CFfN.js +20 -0
- package/dist/fetch-B5e9CFfN.js.map +1 -0
- package/dist/framework/index.d.ts +38 -29
- package/dist/framework/index.d.ts.map +1 -0
- package/dist/framework/index.js +68 -17
- package/dist/framework/index.js.map +1 -0
- package/dist/framework/next.d.ts +15 -10
- package/dist/framework/next.d.ts.map +1 -0
- package/dist/framework/next.js +18 -26
- package/dist/framework/next.js.map +1 -0
- package/dist/framework/react-router.d.ts +15 -10
- package/dist/framework/react-router.d.ts.map +1 -0
- package/dist/framework/react-router.js +42 -55
- package/dist/framework/react-router.js.map +1 -0
- package/dist/framework/tanstack.d.ts +15 -10
- package/dist/framework/tanstack.d.ts.map +1 -0
- package/dist/framework/tanstack.js +54 -69
- package/dist/framework/tanstack.js.map +1 -0
- package/dist/framework/waku.d.ts +15 -10
- package/dist/framework/waku.d.ts.map +1 -0
- package/dist/framework/waku.js +47 -58
- package/dist/framework/waku.js.map +1 -0
- package/dist/highlight/client.d.ts +6 -7
- package/dist/highlight/client.d.ts.map +1 -0
- package/dist/highlight/client.js +22 -14
- package/dist/highlight/client.js.map +1 -0
- package/dist/highlight/index.d.ts +2 -30
- package/dist/highlight/index.js +3 -13
- package/dist/i18n/index.d.ts +2 -39
- package/dist/i18n/index.js +6 -7
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/middleware.d.ts +36 -28
- package/dist/i18n/middleware.d.ts.map +1 -0
- package/dist/i18n/middleware.js +55 -73
- package/dist/i18n/middleware.js.map +1 -0
- package/dist/icon-Dt7IObrc.js +19 -0
- package/dist/icon-Dt7IObrc.js.map +1 -0
- package/dist/index-2U6Tl4--.d.ts +379 -0
- package/dist/index-2U6Tl4--.d.ts.map +1 -0
- package/dist/index-Bw-DCOra.d.ts +41 -0
- package/dist/index-Bw-DCOra.d.ts.map +1 -0
- package/dist/link.d.ts +17 -15
- package/dist/link.d.ts.map +1 -0
- package/dist/link.js +29 -9
- package/dist/link.js.map +1 -0
- package/dist/mdast-utils-mc9-X-PK.js +40 -0
- package/dist/mdast-utils-mc9-X-PK.js.map +1 -0
- package/dist/mdx-plugins/codeblock-utils.d.ts +2 -29
- package/dist/mdx-plugins/codeblock-utils.js +71 -9
- package/dist/mdx-plugins/codeblock-utils.js.map +1 -0
- package/dist/mdx-plugins/index.d.ts +15 -20
- package/dist/mdx-plugins/index.js +18 -73
- package/dist/mdx-plugins/rehype-code.d.ts +2 -55
- package/dist/mdx-plugins/rehype-code.js +5 -15
- package/dist/mdx-plugins/rehype-toc.d.ts +2 -14
- package/dist/mdx-plugins/rehype-toc.js +3 -7
- package/dist/mdx-plugins/remark-admonition.d.ts +2 -20
- package/dist/mdx-plugins/remark-admonition.js +74 -8
- package/dist/mdx-plugins/remark-admonition.js.map +1 -0
- package/dist/mdx-plugins/remark-code-tab.d.ts +2 -30
- package/dist/mdx-plugins/remark-code-tab.js +183 -7
- package/dist/mdx-plugins/remark-code-tab.js.map +1 -0
- package/dist/mdx-plugins/remark-directive-admonition.d.ts +2 -27
- package/dist/mdx-plugins/remark-directive-admonition.js +60 -7
- package/dist/mdx-plugins/remark-directive-admonition.js.map +1 -0
- package/dist/mdx-plugins/remark-gfm.d.ts +2 -1
- package/dist/mdx-plugins/remark-gfm.js +3 -7
- package/dist/mdx-plugins/remark-heading.d.ts +2 -31
- package/dist/mdx-plugins/remark-heading.js +45 -8
- package/dist/mdx-plugins/remark-heading.js.map +1 -0
- package/dist/mdx-plugins/remark-image.d.ts +2 -57
- package/dist/mdx-plugins/remark-image.js +192 -7
- package/dist/mdx-plugins/remark-image.js.map +1 -0
- package/dist/mdx-plugins/remark-mdx-files.d.ts +2 -40
- package/dist/mdx-plugins/remark-mdx-files.js +187 -7
- package/dist/mdx-plugins/remark-mdx-files.js.map +1 -0
- package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +2 -15
- package/dist/mdx-plugins/remark-mdx-mermaid.js +31 -7
- package/dist/mdx-plugins/remark-mdx-mermaid.js.map +1 -0
- package/dist/mdx-plugins/remark-npm.d.ts +2 -31
- package/dist/mdx-plugins/remark-npm.js +68 -8
- package/dist/mdx-plugins/remark-npm.js.map +1 -0
- package/dist/mdx-plugins/remark-steps.d.ts +2 -23
- package/dist/mdx-plugins/remark-steps.js +77 -7
- package/dist/mdx-plugins/remark-steps.js.map +1 -0
- package/dist/mdx-plugins/remark-structure.d.ts +2 -71
- package/dist/mdx-plugins/remark-structure.js +105 -11
- package/dist/mdx-plugins/remark-structure.js.map +1 -0
- package/dist/mixedbread-DlByNYSd.js +88 -0
- package/dist/mixedbread-DlByNYSd.js.map +1 -0
- package/dist/negotiation/index.d.ts +6 -4
- package/dist/negotiation/index.d.ts.map +1 -0
- package/dist/negotiation/index.js +41 -11
- package/dist/negotiation/index.js.map +1 -0
- package/dist/normalize-url-DP9-1I-S.js +16 -0
- package/dist/normalize-url-DP9-1I-S.js.map +1 -0
- package/dist/orama-cloud-DH3g37zc.js +84 -0
- package/dist/orama-cloud-DH3g37zc.js.map +1 -0
- package/dist/page-tree/index.d.ts +23 -11
- package/dist/page-tree/index.d.ts.map +1 -0
- package/dist/page-tree/index.js +3 -17
- package/dist/path-DHIjrDBP.js +60 -0
- package/dist/path-DHIjrDBP.js.map +1 -0
- package/dist/rehype-code-CdiZ1Y6P.js +241 -0
- package/dist/rehype-code-CdiZ1Y6P.js.map +1 -0
- package/dist/rehype-code-vVWG4-ej.d.ts +58 -0
- package/dist/rehype-code-vVWG4-ej.d.ts.map +1 -0
- package/dist/rehype-toc-DJvSyE0o.d.ts +18 -0
- package/dist/rehype-toc-DJvSyE0o.d.ts.map +1 -0
- package/dist/rehype-toc-DVwJcwvA.js +143 -0
- package/dist/rehype-toc-DVwJcwvA.js.map +1 -0
- package/dist/remark-admonition-DOwBWzsH.d.ts +22 -0
- package/dist/remark-admonition-DOwBWzsH.d.ts.map +1 -0
- package/dist/remark-code-tab-CXsYlims.d.ts +32 -0
- package/dist/remark-code-tab-CXsYlims.d.ts.map +1 -0
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts +36 -0
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts.map +1 -0
- package/dist/remark-gfm-CeWpMwyk.d.ts +2 -0
- package/dist/remark-heading-CXvCY0go.d.ts +37 -0
- package/dist/remark-heading-CXvCY0go.d.ts.map +1 -0
- package/dist/remark-image-CvUis4R1.d.ts +65 -0
- package/dist/remark-image-CvUis4R1.d.ts.map +1 -0
- package/dist/remark-mdx-files-B31xFFG4.d.ts +56 -0
- package/dist/remark-mdx-files-B31xFFG4.d.ts.map +1 -0
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts +17 -0
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts.map +1 -0
- package/dist/remark-npm-BIvIEKT2.d.ts +36 -0
- package/dist/remark-npm-BIvIEKT2.d.ts.map +1 -0
- package/dist/remark-steps-CHJN-rtm.d.ts +28 -0
- package/dist/remark-steps-CHJN-rtm.d.ts.map +1 -0
- package/dist/remark-structure-RZD2gGKp.d.ts +77 -0
- package/dist/remark-structure-RZD2gGKp.d.ts.map +1 -0
- package/dist/remove-undefined-Cfs4o_mM.js +19 -0
- package/dist/remove-undefined-Cfs4o_mM.js.map +1 -0
- package/dist/search/algolia.d.ts +3 -69
- package/dist/search/algolia.js +69 -63
- package/dist/search/algolia.js.map +1 -0
- package/dist/search/client.d.ts +120 -114
- package/dist/search/client.d.ts.map +1 -0
- package/dist/search/client.js +92 -91
- package/dist/search/client.js.map +1 -0
- package/dist/search/index.d.ts +20 -18
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +3 -7
- package/dist/search/orama-cloud.d.ts +70 -68
- package/dist/search/orama-cloud.d.ts.map +1 -0
- package/dist/search/orama-cloud.js +46 -54
- package/dist/search/orama-cloud.js.map +1 -0
- package/dist/search/server.d.ts +6 -136
- package/dist/search/server.js +292 -369
- package/dist/search/server.js.map +1 -0
- package/dist/search-D6ChCLhY.js +44 -0
- package/dist/search-D6ChCLhY.js.map +1 -0
- package/dist/server-CPR_fgkH.d.ts +133 -0
- package/dist/server-CPR_fgkH.d.ts.map +1 -0
- package/dist/shiki-4oMYwHED.js +80 -0
- package/dist/shiki-4oMYwHED.js.map +1 -0
- package/dist/shiki-CIBQys54.d.ts +33 -0
- package/dist/shiki-CIBQys54.d.ts.map +1 -0
- package/dist/source/client/index.d.ts +7 -5
- package/dist/source/client/index.d.ts.map +1 -0
- package/dist/source/client/index.js +24 -35
- package/dist/source/client/index.js.map +1 -0
- package/dist/source/index.d.ts +3 -42
- package/dist/source/index.js +599 -752
- package/dist/source/index.js.map +1 -0
- package/dist/source/plugins/lucide-icons.d.ts +7 -7
- package/dist/source/plugins/lucide-icons.d.ts.map +1 -0
- package/dist/source/plugins/lucide-icons.js +21 -20
- package/dist/source/plugins/lucide-icons.js.map +1 -0
- package/dist/source/plugins/slugs.d.ts +3 -0
- package/dist/source/plugins/slugs.js +65 -0
- package/dist/source/plugins/slugs.js.map +1 -0
- package/dist/source/schema.d.ts +17 -14
- package/dist/source/schema.d.ts.map +1 -0
- package/dist/source/schema.js +26 -22
- package/dist/source/schema.js.map +1 -0
- package/dist/static-Dq8pA8Ay.js +51 -0
- package/dist/static-Dq8pA8Ay.js.map +1 -0
- package/dist/toc.d.ts +38 -25
- package/dist/toc.d.ts.map +1 -0
- package/dist/toc.js +123 -136
- package/dist/toc.js.map +1 -0
- package/dist/util-CK2ykiif.d.ts +8 -0
- package/dist/util-CK2ykiif.d.ts.map +1 -0
- package/dist/util-s9piKHsk.js +10 -0
- package/dist/util-s9piKHsk.js.map +1 -0
- package/dist/utils/use-effect-event.d.ts +3 -1
- package/dist/utils/use-effect-event.d.ts.map +1 -0
- package/dist/utils/use-effect-event.js +16 -13
- package/dist/utils/use-effect-event.js.map +1 -0
- package/dist/utils/use-media-query.d.ts +3 -1
- package/dist/utils/use-media-query.d.ts.map +1 -0
- package/dist/utils/use-media-query.js +20 -20
- package/dist/utils/use-media-query.js.map +1 -0
- package/dist/utils/use-on-change.d.ts +3 -1
- package/dist/utils/use-on-change.d.ts.map +1 -0
- package/dist/utils/use-on-change.js +23 -7
- package/dist/utils/use-on-change.js.map +1 -0
- package/dist/utils-DUvi2WkD.js +134 -0
- package/dist/utils-DUvi2WkD.js.map +1 -0
- package/package.json +60 -58
- package/dist/algolia-IZEDLPHE.js +0 -58
- package/dist/chunk-5PMI7QDD.js +0 -220
- package/dist/chunk-ADBHPKXG.js +0 -78
- package/dist/chunk-APKPSBSB.js +0 -74
- package/dist/chunk-CH7YHH7V.js +0 -222
- package/dist/chunk-EFVXL2PP.js +0 -144
- package/dist/chunk-EMWGTXSW.js +0 -19
- package/dist/chunk-FAEPKD7U.js +0 -20
- package/dist/chunk-FUUVPEA5.js +0 -29
- package/dist/chunk-GINBKBVQ.js +0 -12
- package/dist/chunk-GLRQBLGN.js +0 -59
- package/dist/chunk-JUF4WZ6G.js +0 -117
- package/dist/chunk-K4WNLOVQ.js +0 -75
- package/dist/chunk-L4JKQWCM.js +0 -131
- package/dist/chunk-MA6O2UUE.js +0 -50
- package/dist/chunk-ONG4RVCR.js +0 -8
- package/dist/chunk-OTD7MV33.js +0 -53
- package/dist/chunk-PFNP6PEB.js +0 -11
- package/dist/chunk-SH7BNTG7.js +0 -38
- package/dist/chunk-TWIDBWFG.js +0 -84
- package/dist/chunk-U67V476Y.js +0 -35
- package/dist/chunk-VLSDGCJE.js +0 -47
- package/dist/chunk-W6WTLKRA.js +0 -73
- package/dist/chunk-X2HFD5QJ.js +0 -275
- package/dist/chunk-XJ6ZQNEX.js +0 -91
- package/dist/chunk-XN2LKXFZ.js +0 -101
- package/dist/chunk-XOFXGHS4.js +0 -93
- package/dist/chunk-XZSI7AHE.js +0 -67
- package/dist/chunk-YVVDKJ2H.js +0 -34
- package/dist/chunk-ZMWYLUDP.js +0 -21
- package/dist/definitions-pJ7PybYY.d.ts +0 -60
- package/dist/fetch-IBTWQCJR.js +0 -22
- package/dist/loader-_E2HOdV0.d.ts +0 -333
- package/dist/mixedbread-A3WLENES.js +0 -117
- package/dist/orama-cloud-UZAPMPFV.js +0 -93
- package/dist/static-A2YJ5TXV.js +0 -62
- package/dist/util-bZU2QeJ2.d.ts +0 -6
package/dist/link.js
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "
|
|
5
|
-
import "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Link as Link$1 } from "./framework/index.js";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/link.tsx
|
|
8
|
+
const Link = forwardRef(({ href = "#", external = href.match(/^\w+:/) || href.startsWith("//"), prefetch, children, ...props }, ref) => {
|
|
9
|
+
if (external) return /* @__PURE__ */ jsx("a", {
|
|
10
|
+
ref,
|
|
11
|
+
href,
|
|
12
|
+
rel: "noreferrer noopener",
|
|
13
|
+
target: "_blank",
|
|
14
|
+
...props,
|
|
15
|
+
children
|
|
16
|
+
});
|
|
17
|
+
return /* @__PURE__ */ jsx(Link$1, {
|
|
18
|
+
ref,
|
|
19
|
+
href,
|
|
20
|
+
prefetch,
|
|
21
|
+
...props,
|
|
22
|
+
children
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
Link.displayName = "Link";
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Link as default };
|
|
29
|
+
//# sourceMappingURL=link.js.map
|
package/dist/link.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","names":["Base"],"sources":["../src/link.tsx"],"sourcesContent":["'use client';\nimport { type AnchorHTMLAttributes, forwardRef } from 'react';\nimport { Link as Base } from '@/framework';\n\nexport interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {\n /**\n * If the href is an external URL\n *\n * automatically determined by default\n */\n external?: boolean;\n\n /**\n * Prefetch links, supported on Next.js\n */\n prefetch?: boolean;\n}\n\nconst Link = forwardRef<HTMLAnchorElement, LinkProps>(\n (\n {\n href = '#',\n // any protocol\n external = href.match(/^\\w+:/) ||\n // protocol relative URL\n href.startsWith('//'),\n prefetch,\n children,\n ...props\n },\n ref,\n ) => {\n if (external) {\n return (\n <a ref={ref} href={href} rel=\"noreferrer noopener\" target=\"_blank\" {...props}>\n {children}\n </a>\n );\n }\n\n return (\n <Base ref={ref} href={href} prefetch={prefetch} {...props}>\n {children}\n </Base>\n );\n },\n);\n\nLink.displayName = 'Link';\n\nexport { Link as default };\n"],"mappings":";;;;;;;AAkBA,MAAM,OAAO,YAET,EACE,OAAO,KAEP,WAAW,KAAK,MAAM,QAAQ,IAE5B,KAAK,WAAW,KAAK,EACvB,UACA,UACA,GAAG,SAEL,QACG;AACH,KAAI,SACF,QACE,oBAAC;EAAO;EAAW;EAAM,KAAI;EAAsB,QAAO;EAAS,GAAI;EACpE;GACC;AAIR,QACE,oBAACA;EAAU;EAAW;EAAgB;EAAU,GAAI;EACjD;GACI;EAGZ;AAED,KAAK,cAAc"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { valueToEstree } from "estree-util-value-to-estree";
|
|
2
|
+
|
|
3
|
+
//#region src/mdx-plugins/mdast-utils.ts
|
|
4
|
+
function flattenNode(node) {
|
|
5
|
+
if ("children" in node) return node.children.map((child) => flattenNode(child)).join("");
|
|
6
|
+
if ("value" in node && typeof node.value === "string") return node.value;
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
function toMdxExport(name, value) {
|
|
10
|
+
return {
|
|
11
|
+
type: "mdxjsEsm",
|
|
12
|
+
value: "",
|
|
13
|
+
data: { estree: {
|
|
14
|
+
type: "Program",
|
|
15
|
+
sourceType: "module",
|
|
16
|
+
body: [{
|
|
17
|
+
type: "ExportNamedDeclaration",
|
|
18
|
+
attributes: [],
|
|
19
|
+
specifiers: [],
|
|
20
|
+
source: null,
|
|
21
|
+
declaration: {
|
|
22
|
+
type: "VariableDeclaration",
|
|
23
|
+
kind: "let",
|
|
24
|
+
declarations: [{
|
|
25
|
+
type: "VariableDeclarator",
|
|
26
|
+
id: {
|
|
27
|
+
type: "Identifier",
|
|
28
|
+
name
|
|
29
|
+
},
|
|
30
|
+
init: valueToEstree(value)
|
|
31
|
+
}]
|
|
32
|
+
}
|
|
33
|
+
}]
|
|
34
|
+
} }
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
export { toMdxExport as n, flattenNode as t };
|
|
40
|
+
//# sourceMappingURL=mdast-utils-mc9-X-PK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdast-utils-mc9-X-PK.js","names":[],"sources":["../src/mdx-plugins/mdast-utils.ts"],"sourcesContent":["import type { RootContent } from 'mdast';\nimport { valueToEstree } from 'estree-util-value-to-estree';\n\nexport function flattenNode(node: RootContent): string {\n if ('children' in node) return node.children.map((child) => flattenNode(child)).join('');\n\n if ('value' in node && typeof node.value === 'string') return node.value;\n\n return '';\n}\n\nexport function toMdxExport(name: string, value: unknown): RootContent {\n return {\n type: 'mdxjsEsm',\n value: '',\n data: {\n estree: {\n type: 'Program',\n sourceType: 'module',\n body: [\n {\n type: 'ExportNamedDeclaration',\n attributes: [],\n specifiers: [],\n source: null,\n declaration: {\n type: 'VariableDeclaration',\n kind: 'let',\n declarations: [\n {\n type: 'VariableDeclarator',\n id: {\n type: 'Identifier',\n name,\n },\n init: valueToEstree(value),\n },\n ],\n },\n },\n ],\n },\n },\n };\n}\n"],"mappings":";;;AAGA,SAAgB,YAAY,MAA2B;AACrD,KAAI,cAAc,KAAM,QAAO,KAAK,SAAS,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC,KAAK,GAAG;AAExF,KAAI,WAAW,QAAQ,OAAO,KAAK,UAAU,SAAU,QAAO,KAAK;AAEnE,QAAO;;AAGT,SAAgB,YAAY,MAAc,OAA6B;AACrE,QAAO;EACL,MAAM;EACN,OAAO;EACP,MAAM,EACJ,QAAQ;GACN,MAAM;GACN,YAAY;GACZ,MAAM,CACJ;IACE,MAAM;IACN,YAAY,EAAE;IACd,YAAY,EAAE;IACd,QAAQ;IACR,aAAa;KACX,MAAM;KACN,MAAM;KACN,cAAc,CACZ;MACE,MAAM;MACN,IAAI;OACF,MAAM;OACN;OACD;MACD,MAAM,cAAc,MAAM;MAC3B,CACF;KACF;IACF,CACF;GACF,EACF;EACF"}
|
|
@@ -1,29 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface CodeBlockTabsOptions {
|
|
5
|
-
attributes?: MdxJsxAttribute[];
|
|
6
|
-
defaultValue?: string;
|
|
7
|
-
persist?: {
|
|
8
|
-
id: string;
|
|
9
|
-
} | false;
|
|
10
|
-
triggers: {
|
|
11
|
-
value: string;
|
|
12
|
-
children: (BlockContent | Text)[];
|
|
13
|
-
}[];
|
|
14
|
-
tabs: {
|
|
15
|
-
value: string;
|
|
16
|
-
children: BlockContent[];
|
|
17
|
-
}[];
|
|
18
|
-
}
|
|
19
|
-
declare function generateCodeBlockTabs({ persist, defaultValue, triggers, tabs, ...options }: CodeBlockTabsOptions): MdxJsxFlowElement;
|
|
20
|
-
interface CodeBlockAttributes<Name extends string = string> {
|
|
21
|
-
attributes: Partial<Record<Name, string | null>>;
|
|
22
|
-
rest: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Parse Fumadocs-style code block attributes from meta string, like `title="hello world"`
|
|
26
|
-
*/
|
|
27
|
-
declare function parseCodeBlockAttributes<Name extends string = string>(meta: string, allowedNames?: Name[]): CodeBlockAttributes<Name>;
|
|
28
|
-
|
|
29
|
-
export { type CodeBlockAttributes, type CodeBlockTabsOptions, generateCodeBlockTabs, parseCodeBlockAttributes };
|
|
1
|
+
import { i as parseCodeBlockAttributes, n as CodeBlockTabsOptions, r as generateCodeBlockTabs, t as CodeBlockAttributes } from "../codeblock-utils-lld8UiQo.js";
|
|
2
|
+
export { CodeBlockAttributes, CodeBlockTabsOptions, generateCodeBlockTabs, parseCodeBlockAttributes };
|
|
@@ -1,9 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
//#region src/mdx-plugins/codeblock-utils.ts
|
|
2
|
+
function generateCodeBlockTabs({ persist = false, defaultValue, triggers, tabs, ...options }) {
|
|
3
|
+
const attributes = [];
|
|
4
|
+
if (options.attributes) attributes.push(...options.attributes);
|
|
5
|
+
if (defaultValue) attributes.push({
|
|
6
|
+
type: "mdxJsxAttribute",
|
|
7
|
+
name: "defaultValue",
|
|
8
|
+
value: defaultValue
|
|
9
|
+
});
|
|
10
|
+
if (typeof persist === "object") attributes.push({
|
|
11
|
+
type: "mdxJsxAttribute",
|
|
12
|
+
name: "groupId",
|
|
13
|
+
value: persist.id
|
|
14
|
+
}, {
|
|
15
|
+
type: "mdxJsxAttribute",
|
|
16
|
+
name: "persist",
|
|
17
|
+
value: null
|
|
18
|
+
});
|
|
19
|
+
const children = [{
|
|
20
|
+
type: "mdxJsxFlowElement",
|
|
21
|
+
name: "CodeBlockTabsList",
|
|
22
|
+
attributes: [],
|
|
23
|
+
children: triggers.map((trigger) => ({
|
|
24
|
+
type: "mdxJsxFlowElement",
|
|
25
|
+
attributes: [{
|
|
26
|
+
type: "mdxJsxAttribute",
|
|
27
|
+
name: "value",
|
|
28
|
+
value: trigger.value
|
|
29
|
+
}],
|
|
30
|
+
name: "CodeBlockTabsTrigger",
|
|
31
|
+
children: trigger.children
|
|
32
|
+
}))
|
|
33
|
+
}];
|
|
34
|
+
for (const tab of tabs) children.push({
|
|
35
|
+
type: "mdxJsxFlowElement",
|
|
36
|
+
name: "CodeBlockTab",
|
|
37
|
+
attributes: [{
|
|
38
|
+
type: "mdxJsxAttribute",
|
|
39
|
+
name: "value",
|
|
40
|
+
value: tab.value
|
|
41
|
+
}],
|
|
42
|
+
children: tab.children
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
type: "mdxJsxFlowElement",
|
|
46
|
+
name: "CodeBlockTabs",
|
|
47
|
+
attributes,
|
|
48
|
+
children
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Parse Fumadocs-style code block attributes from meta string, like `title="hello world"`
|
|
53
|
+
*/
|
|
54
|
+
function parseCodeBlockAttributes(meta, allowedNames) {
|
|
55
|
+
let str = meta;
|
|
56
|
+
const StringRegex = /(?<=^|\s)(?<name>\w+)(?:=(?:"([^"]*)"|'([^']*)'))?/g;
|
|
57
|
+
const attributes = {};
|
|
58
|
+
str = str.replaceAll(StringRegex, (match, name, value_1, value_2) => {
|
|
59
|
+
if (allowedNames && !allowedNames.includes(name)) return match;
|
|
60
|
+
attributes[name] = value_1 ?? value_2 ?? null;
|
|
61
|
+
return "";
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
rest: str,
|
|
65
|
+
attributes
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
//#endregion
|
|
70
|
+
export { generateCodeBlockTabs, parseCodeBlockAttributes };
|
|
71
|
+
//# sourceMappingURL=codeblock-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeblock-utils.js","names":["attributes: MdxJsxAttribute[]","children: MdxJsxFlowElement[]","attributes: CodeBlockAttributes['attributes']"],"sources":["../../src/mdx-plugins/codeblock-utils.ts"],"sourcesContent":["import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx-jsx';\nimport type { BlockContent, Text } from 'mdast';\n\nexport interface CodeBlockTabsOptions {\n attributes?: MdxJsxAttribute[];\n defaultValue?: string;\n persist?:\n | {\n id: string;\n }\n | false;\n triggers: {\n value: string;\n children: (BlockContent | Text)[];\n }[];\n tabs: {\n value: string;\n children: BlockContent[];\n }[];\n}\n\nexport function generateCodeBlockTabs({\n persist = false,\n defaultValue,\n triggers,\n tabs,\n ...options\n}: CodeBlockTabsOptions): MdxJsxFlowElement {\n const attributes: MdxJsxAttribute[] = [];\n if (options.attributes) attributes.push(...options.attributes);\n\n if (defaultValue) {\n attributes.push({\n type: 'mdxJsxAttribute',\n name: 'defaultValue',\n value: defaultValue,\n });\n }\n\n if (typeof persist === 'object') {\n attributes.push(\n {\n type: 'mdxJsxAttribute',\n name: 'groupId',\n value: persist.id,\n },\n {\n type: 'mdxJsxAttribute',\n name: 'persist',\n value: null,\n },\n );\n }\n\n const children: MdxJsxFlowElement[] = [\n {\n type: 'mdxJsxFlowElement',\n name: 'CodeBlockTabsList',\n attributes: [],\n children: triggers.map(\n (trigger) =>\n ({\n type: 'mdxJsxFlowElement',\n attributes: [{ type: 'mdxJsxAttribute', name: 'value', value: trigger.value }],\n name: 'CodeBlockTabsTrigger',\n children: trigger.children,\n }) as MdxJsxFlowElement,\n ),\n },\n ];\n\n for (const tab of tabs) {\n children.push({\n type: 'mdxJsxFlowElement',\n name: 'CodeBlockTab',\n attributes: [{ type: 'mdxJsxAttribute', name: 'value', value: tab.value }],\n children: tab.children,\n });\n }\n\n return {\n type: 'mdxJsxFlowElement',\n name: 'CodeBlockTabs',\n attributes,\n children,\n };\n}\n\nexport interface CodeBlockAttributes<Name extends string = string> {\n attributes: Partial<Record<Name, string | null>>;\n rest: string;\n}\n\n/**\n * Parse Fumadocs-style code block attributes from meta string, like `title=\"hello world\"`\n */\nexport function parseCodeBlockAttributes<Name extends string = string>(\n meta: string,\n allowedNames?: Name[],\n): CodeBlockAttributes<Name> {\n let str = meta;\n const StringRegex = /(?<=^|\\s)(?<name>\\w+)(?:=(?:\"([^\"]*)\"|'([^']*)'))?/g;\n const attributes: CodeBlockAttributes['attributes'] = {};\n\n str = str.replaceAll(StringRegex, (match, name, value_1, value_2) => {\n if (allowedNames && !allowedNames.includes(name)) return match;\n\n attributes[name] = value_1 ?? value_2 ?? null;\n return '';\n });\n\n return {\n rest: str,\n attributes,\n };\n}\n"],"mappings":";AAqBA,SAAgB,sBAAsB,EACpC,UAAU,OACV,cACA,UACA,MACA,GAAG,WACuC;CAC1C,MAAMA,aAAgC,EAAE;AACxC,KAAI,QAAQ,WAAY,YAAW,KAAK,GAAG,QAAQ,WAAW;AAE9D,KAAI,aACF,YAAW,KAAK;EACd,MAAM;EACN,MAAM;EACN,OAAO;EACR,CAAC;AAGJ,KAAI,OAAO,YAAY,SACrB,YAAW,KACT;EACE,MAAM;EACN,MAAM;EACN,OAAO,QAAQ;EAChB,EACD;EACE,MAAM;EACN,MAAM;EACN,OAAO;EACR,CACF;CAGH,MAAMC,WAAgC,CACpC;EACE,MAAM;EACN,MAAM;EACN,YAAY,EAAE;EACd,UAAU,SAAS,KAChB,aACE;GACC,MAAM;GACN,YAAY,CAAC;IAAE,MAAM;IAAmB,MAAM;IAAS,OAAO,QAAQ;IAAO,CAAC;GAC9E,MAAM;GACN,UAAU,QAAQ;GACnB,EACJ;EACF,CACF;AAED,MAAK,MAAM,OAAO,KAChB,UAAS,KAAK;EACZ,MAAM;EACN,MAAM;EACN,YAAY,CAAC;GAAE,MAAM;GAAmB,MAAM;GAAS,OAAO,IAAI;GAAO,CAAC;EAC1E,UAAU,IAAI;EACf,CAAC;AAGJ,QAAO;EACL,MAAM;EACN,MAAM;EACN;EACA;EACD;;;;;AAWH,SAAgB,yBACd,MACA,cAC2B;CAC3B,IAAI,MAAM;CACV,MAAM,cAAc;CACpB,MAAMC,aAAgD,EAAE;AAExD,OAAM,IAAI,WAAW,cAAc,OAAO,MAAM,SAAS,YAAY;AACnE,MAAI,gBAAgB,CAAC,aAAa,SAAS,KAAK,CAAE,QAAO;AAEzD,aAAW,QAAQ,WAAW,WAAW;AACzC,SAAO;GACP;AAEF,QAAO;EACL,MAAM;EACN;EACD"}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import '@shikijs/rehype';
|
|
17
|
-
import 'unified';
|
|
18
|
-
import 'shiki';
|
|
19
|
-
import 'mdast';
|
|
20
|
-
import 'mdast-util-mdx-jsx';
|
|
1
|
+
import { n as remarkGfm, t as RemarkGfmOptions } from "../remark-gfm-CeWpMwyk.js";
|
|
2
|
+
import { a as CodeBlockIcon, i as transformerTab, n as rehypeCode, o as transformerIcon, r as rehypeCodeDefaultOptions, t as RehypeCodeOptions } from "../rehype-code-vVWG4-ej.js";
|
|
3
|
+
import { n as remarkImage, t as RemarkImageOptions } from "../remark-image-CvUis4R1.js";
|
|
4
|
+
import { a as structure, i as remarkStructureDefaultOptions, n as StructuredData, r as remarkStructure, t as StructureOptions } from "../remark-structure-RZD2gGKp.js";
|
|
5
|
+
import { n as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-CXvCY0go.js";
|
|
6
|
+
import { n as remarkAdmonition, t as RemarkAdmonitionOptions } from "../remark-admonition-DOwBWzsH.js";
|
|
7
|
+
import { n as remarkDirectiveAdmonition, t as RemarkDirectiveAdmonitionOptions } from "../remark-directive-admonition-BCm_yiU9.js";
|
|
8
|
+
import { n as rehypeToc, t as RehypeTocOptions } from "../rehype-toc-DJvSyE0o.js";
|
|
9
|
+
import { n as remarkCodeTab, t as RemarkCodeTabOptions } from "../remark-code-tab-CXsYlims.js";
|
|
10
|
+
import { n as remarkSteps, t as RemarkStepsOptions } from "../remark-steps-CHJN-rtm.js";
|
|
11
|
+
import { n as remarkNpm, t as RemarkNpmOptions } from "../remark-npm-BIvIEKT2.js";
|
|
12
|
+
import { i as parseCodeBlockAttributes, n as CodeBlockTabsOptions, r as generateCodeBlockTabs, t as CodeBlockAttributes } from "../codeblock-utils-lld8UiQo.js";
|
|
13
|
+
import { a as remarkMdxFiles, r as RemarkMdxFilesOptions } from "../remark-mdx-files-B31xFFG4.js";
|
|
14
|
+
import { n as remarkMdxMermaid, t as RemarkMdxMermaidOptions } from "../remark-mdx-mermaid-BdSUUiCG.js";
|
|
15
|
+
export { CodeBlockAttributes, CodeBlockIcon, CodeBlockTabsOptions, RehypeCodeOptions, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StructureOptions, StructuredData, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -1,73 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
} from "../
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
} from "
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
} from "
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
} from "
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
structure
|
|
20
|
-
} from "../chunk-JUF4WZ6G.js";
|
|
21
|
-
import {
|
|
22
|
-
rehypeCode,
|
|
23
|
-
rehypeCodeDefaultOptions,
|
|
24
|
-
transformerIcon,
|
|
25
|
-
transformerTab
|
|
26
|
-
} from "../chunk-X2HFD5QJ.js";
|
|
27
|
-
import {
|
|
28
|
-
rehypeToc
|
|
29
|
-
} from "../chunk-EFVXL2PP.js";
|
|
30
|
-
import {
|
|
31
|
-
remarkAdmonition
|
|
32
|
-
} from "../chunk-W6WTLKRA.js";
|
|
33
|
-
import {
|
|
34
|
-
remarkCodeTab
|
|
35
|
-
} from "../chunk-CH7YHH7V.js";
|
|
36
|
-
import {
|
|
37
|
-
generateCodeBlockTabs,
|
|
38
|
-
parseCodeBlockAttributes
|
|
39
|
-
} from "../chunk-TWIDBWFG.js";
|
|
40
|
-
import {
|
|
41
|
-
remarkDirectiveAdmonition
|
|
42
|
-
} from "../chunk-APKPSBSB.js";
|
|
43
|
-
import {
|
|
44
|
-
default as default2
|
|
45
|
-
} from "../chunk-ONG4RVCR.js";
|
|
46
|
-
import "../chunk-XN2LKXFZ.js";
|
|
47
|
-
import {
|
|
48
|
-
remarkHeading
|
|
49
|
-
} from "../chunk-MA6O2UUE.js";
|
|
50
|
-
import "../chunk-VLSDGCJE.js";
|
|
51
|
-
import "../chunk-U67V476Y.js";
|
|
52
|
-
export {
|
|
53
|
-
generateCodeBlockTabs,
|
|
54
|
-
parseCodeBlockAttributes,
|
|
55
|
-
rehypeCode,
|
|
56
|
-
rehypeCodeDefaultOptions,
|
|
57
|
-
rehypeToc,
|
|
58
|
-
remarkAdmonition,
|
|
59
|
-
remarkCodeTab,
|
|
60
|
-
remarkDirectiveAdmonition,
|
|
61
|
-
default2 as remarkGfm,
|
|
62
|
-
remarkHeading,
|
|
63
|
-
remarkImage,
|
|
64
|
-
remarkMdxFiles,
|
|
65
|
-
remarkMdxMermaid,
|
|
66
|
-
remarkNpm,
|
|
67
|
-
remarkSteps,
|
|
68
|
-
remarkStructure,
|
|
69
|
-
remarkStructureDefaultOptions,
|
|
70
|
-
structure,
|
|
71
|
-
transformerIcon,
|
|
72
|
-
transformerTab
|
|
73
|
-
};
|
|
1
|
+
import "../mdast-utils-mc9-X-PK.js";
|
|
2
|
+
import { remarkHeading } from "./remark-heading.js";
|
|
3
|
+
import "../shiki-4oMYwHED.js";
|
|
4
|
+
import { generateCodeBlockTabs, parseCodeBlockAttributes } from "./codeblock-utils.js";
|
|
5
|
+
import { remarkGfm } from "./remark-gfm.js";
|
|
6
|
+
import { i as transformerIcon, n as rehypeCodeDefaultOptions, r as transformerTab, t as rehypeCode } from "../rehype-code-CdiZ1Y6P.js";
|
|
7
|
+
import { remarkImage } from "./remark-image.js";
|
|
8
|
+
import { remarkStructure, remarkStructureDefaultOptions, structure } from "./remark-structure.js";
|
|
9
|
+
import { remarkAdmonition } from "./remark-admonition.js";
|
|
10
|
+
import { remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
|
|
11
|
+
import { t as rehypeToc } from "../rehype-toc-DVwJcwvA.js";
|
|
12
|
+
import { remarkCodeTab } from "./remark-code-tab.js";
|
|
13
|
+
import { remarkSteps } from "./remark-steps.js";
|
|
14
|
+
import { remarkNpm } from "./remark-npm.js";
|
|
15
|
+
import { remarkMdxFiles } from "./remark-mdx-files.js";
|
|
16
|
+
import { remarkMdxMermaid } from "./remark-mdx-mermaid.js";
|
|
17
|
+
|
|
18
|
+
export { generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -1,55 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Processor, Transformer } from 'unified';
|
|
4
|
-
import { ShikiTransformer } from 'shiki';
|
|
5
|
-
|
|
6
|
-
type CodeBlockIcon = {
|
|
7
|
-
viewBox: string;
|
|
8
|
-
fill: string;
|
|
9
|
-
d: string;
|
|
10
|
-
} | string;
|
|
11
|
-
interface IconOptions {
|
|
12
|
-
shortcuts?: Record<string, string>;
|
|
13
|
-
extend?: Record<string, CodeBlockIcon>;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Inject icons to `icon` property (as HTML)
|
|
17
|
-
*/
|
|
18
|
-
declare function transformerIcon(options?: IconOptions): ShikiTransformer;
|
|
19
|
-
|
|
20
|
-
declare const rehypeCodeDefaultOptions: RehypeCodeOptions;
|
|
21
|
-
type DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never;
|
|
22
|
-
type RehypeCodeOptions = DistributiveOmit<RehypeShikiOptions, 'lazy'> & {
|
|
23
|
-
/**
|
|
24
|
-
* Load languages and themes on-demand.
|
|
25
|
-
* @defaultValue true
|
|
26
|
-
*/
|
|
27
|
-
lazy?: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* The regex engine to use.
|
|
30
|
-
*
|
|
31
|
-
* @defaultValue 'js'
|
|
32
|
-
*/
|
|
33
|
-
engine?: 'js' | 'oniguruma';
|
|
34
|
-
/**
|
|
35
|
-
* Filter meta string before processing
|
|
36
|
-
*/
|
|
37
|
-
filterMetaString?: (metaString: string) => string;
|
|
38
|
-
/**
|
|
39
|
-
* Add icon to code blocks
|
|
40
|
-
*/
|
|
41
|
-
icon?: IconOptions | false;
|
|
42
|
-
/**
|
|
43
|
-
* Wrap code blocks in `<Tab>` component when "tab" meta string presents
|
|
44
|
-
*
|
|
45
|
-
* @defaultValue true
|
|
46
|
-
*/
|
|
47
|
-
tab?: boolean;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Handle codeblocks
|
|
51
|
-
*/
|
|
52
|
-
declare function rehypeCode(this: Processor, _options?: Partial<RehypeCodeOptions>): Transformer<Root, Root>;
|
|
53
|
-
declare function transformerTab(): ShikiTransformer;
|
|
54
|
-
|
|
55
|
-
export { type CodeBlockIcon, type RehypeCodeOptions, rehypeCode, rehypeCodeDefaultOptions, transformerIcon, transformerTab };
|
|
1
|
+
import { a as CodeBlockIcon, i as transformerTab, n as rehypeCode, o as transformerIcon, r as rehypeCodeDefaultOptions, t as RehypeCodeOptions } from "../rehype-code-vVWG4-ej.js";
|
|
2
|
+
export { CodeBlockIcon, RehypeCodeOptions, rehypeCode, rehypeCodeDefaultOptions, transformerIcon, transformerTab };
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "../chunk-X2HFD5QJ.js";
|
|
7
|
-
import "../chunk-TWIDBWFG.js";
|
|
8
|
-
import "../chunk-XN2LKXFZ.js";
|
|
9
|
-
import "../chunk-U67V476Y.js";
|
|
10
|
-
export {
|
|
11
|
-
rehypeCode,
|
|
12
|
-
rehypeCodeDefaultOptions,
|
|
13
|
-
transformerIcon,
|
|
14
|
-
transformerTab
|
|
15
|
-
};
|
|
1
|
+
import "../shiki-4oMYwHED.js";
|
|
2
|
+
import "./codeblock-utils.js";
|
|
3
|
+
import { i as transformerIcon, n as rehypeCodeDefaultOptions, r as transformerTab, t as rehypeCode } from "../rehype-code-CdiZ1Y6P.js";
|
|
4
|
+
|
|
5
|
+
export { rehypeCode, rehypeCodeDefaultOptions, transformerIcon, transformerTab };
|
|
@@ -1,14 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface RehypeTocOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Export generated toc as a variable
|
|
7
|
-
*
|
|
8
|
-
* @defaultValue true
|
|
9
|
-
*/
|
|
10
|
-
exportToc?: boolean;
|
|
11
|
-
}
|
|
12
|
-
declare function rehypeToc(this: Processor, { exportToc }?: RehypeTocOptions): Transformer<Root, Root>;
|
|
13
|
-
|
|
14
|
-
export { type RehypeTocOptions, rehypeToc };
|
|
1
|
+
import { n as rehypeToc, t as RehypeTocOptions } from "../rehype-toc-DJvSyE0o.js";
|
|
2
|
+
export { RehypeTocOptions, rehypeToc };
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
interface RemarkAdmonitionOptions {
|
|
5
|
-
tag?: string;
|
|
6
|
-
/**
|
|
7
|
-
* Map type to another type
|
|
8
|
-
*/
|
|
9
|
-
typeMap?: Record<string, string>;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Remark Plugin to support Admonition syntax
|
|
13
|
-
*
|
|
14
|
-
* Useful when Migrating from Docusaurus
|
|
15
|
-
*
|
|
16
|
-
* @deprecated Use `remarkDirectiveAdmonition` with `remark-directive` configured instead.
|
|
17
|
-
*/
|
|
18
|
-
declare function remarkAdmonition(options?: RemarkAdmonitionOptions): Transformer<Root, Root>;
|
|
19
|
-
|
|
20
|
-
export { type RemarkAdmonitionOptions, remarkAdmonition };
|
|
1
|
+
import { n as remarkAdmonition, t as RemarkAdmonitionOptions } from "../remark-admonition-DOwBWzsH.js";
|
|
2
|
+
export { RemarkAdmonitionOptions, remarkAdmonition };
|
|
@@ -1,8 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { t as flattenNode } from "../mdast-utils-mc9-X-PK.js";
|
|
2
|
+
import { visit } from "unist-util-visit";
|
|
3
|
+
|
|
4
|
+
//#region src/mdx-plugins/remark-admonition.ts
|
|
5
|
+
/**
|
|
6
|
+
* Remark Plugin to support Admonition syntax
|
|
7
|
+
*
|
|
8
|
+
* Useful when Migrating from Docusaurus
|
|
9
|
+
*
|
|
10
|
+
* @deprecated Use `remarkDirectiveAdmonition` with `remark-directive` configured instead.
|
|
11
|
+
*/
|
|
12
|
+
function remarkAdmonition(options = {}) {
|
|
13
|
+
const tag = options.tag ?? ":::";
|
|
14
|
+
const typeMap = options.typeMap ?? {
|
|
15
|
+
info: "info",
|
|
16
|
+
warn: "warn",
|
|
17
|
+
note: "info",
|
|
18
|
+
tip: "info",
|
|
19
|
+
warning: "warn",
|
|
20
|
+
danger: "error"
|
|
21
|
+
};
|
|
22
|
+
function replaceNodes(nodes) {
|
|
23
|
+
if (nodes.length === 0) return;
|
|
24
|
+
let open = -1;
|
|
25
|
+
let attributes = [];
|
|
26
|
+
let hasIntercept = false;
|
|
27
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
28
|
+
if (nodes[i].type !== "paragraph") continue;
|
|
29
|
+
const text = flattenNode(nodes[i]);
|
|
30
|
+
const typeName = Object.keys(typeMap).find((type) => text.startsWith(`${tag}${type}`));
|
|
31
|
+
if (typeName) {
|
|
32
|
+
if (open !== -1) {
|
|
33
|
+
hasIntercept = true;
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
open = i;
|
|
37
|
+
attributes.push({
|
|
38
|
+
type: "mdxJsxAttribute",
|
|
39
|
+
name: "type",
|
|
40
|
+
value: typeMap[typeName]
|
|
41
|
+
});
|
|
42
|
+
const meta = text.slice(`${tag}${typeName}`.length);
|
|
43
|
+
if (meta.startsWith("[") && meta.endsWith("]")) attributes.push({
|
|
44
|
+
type: "mdxJsxAttribute",
|
|
45
|
+
name: "title",
|
|
46
|
+
value: meta.slice(1, -1)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (open !== -1 && text === tag) {
|
|
50
|
+
const children = nodes.slice(open + 1, i);
|
|
51
|
+
nodes.splice(open, i - open + 1, {
|
|
52
|
+
type: "mdxJsxFlowElement",
|
|
53
|
+
name: "Callout",
|
|
54
|
+
attributes,
|
|
55
|
+
children: hasIntercept ? replaceNodes(children) : children
|
|
56
|
+
});
|
|
57
|
+
open = -1;
|
|
58
|
+
hasIntercept = false;
|
|
59
|
+
attributes = [];
|
|
60
|
+
i = open;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return (tree) => {
|
|
65
|
+
visit(tree, (node) => {
|
|
66
|
+
if (!("children" in node)) return;
|
|
67
|
+
replaceNodes(node.children);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { remarkAdmonition };
|
|
74
|
+
//# sourceMappingURL=remark-admonition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remark-admonition.js","names":[],"sources":["../../src/mdx-plugins/remark-admonition.ts"],"sourcesContent":["import { type Transformer } from 'unified';\nimport { visit } from 'unist-util-visit';\nimport { type Root, type RootContent } from 'mdast';\nimport { flattenNode } from '@/mdx-plugins/mdast-utils';\n\nexport interface RemarkAdmonitionOptions {\n tag?: string;\n\n /**\n * Map type to another type\n */\n typeMap?: Record<string, string>;\n}\n\n/**\n * Remark Plugin to support Admonition syntax\n *\n * Useful when Migrating from Docusaurus\n *\n * @deprecated Use `remarkDirectiveAdmonition` with `remark-directive` configured instead.\n */\nexport function remarkAdmonition(options: RemarkAdmonitionOptions = {}): Transformer<Root, Root> {\n const tag = options.tag ?? ':::';\n // compatible with Docusaurus\n const typeMap = options.typeMap ?? {\n info: 'info',\n warn: 'warn',\n\n note: 'info',\n tip: 'info',\n warning: 'warn',\n danger: 'error',\n };\n\n function replaceNodes(nodes: RootContent[]) {\n if (nodes.length === 0) return;\n\n let open = -1;\n let attributes = [];\n // if children contain nested admonitions\n let hasIntercept = false;\n\n for (let i = 0; i < nodes.length; i++) {\n if (nodes[i].type !== 'paragraph') continue;\n\n const text = flattenNode(nodes[i]);\n const typeName = Object.keys(typeMap).find((type) => text.startsWith(`${tag}${type}`));\n\n if (typeName) {\n if (open !== -1) {\n hasIntercept = true;\n continue;\n }\n\n open = i;\n\n attributes.push({\n type: 'mdxJsxAttribute',\n name: 'type',\n value: typeMap[typeName],\n });\n\n const meta = text.slice(`${tag}${typeName}`.length);\n if (meta.startsWith('[') && meta.endsWith(']')) {\n attributes.push({\n type: 'mdxJsxAttribute',\n name: 'title',\n value: meta.slice(1, -1),\n });\n }\n }\n\n if (open !== -1 && text === tag) {\n const children = nodes.slice(open + 1, i);\n\n nodes.splice(open, i - open + 1, {\n type: 'mdxJsxFlowElement',\n name: 'Callout',\n attributes,\n children: hasIntercept ? replaceNodes(children) : children,\n } as RootContent);\n open = -1;\n hasIntercept = false;\n attributes = [];\n i = open;\n }\n }\n }\n\n return (tree) => {\n visit(tree, (node) => {\n if (!('children' in node)) return;\n\n replaceNodes(node.children);\n });\n };\n}\n"],"mappings":";;;;;;;;;;;AAqBA,SAAgB,iBAAiB,UAAmC,EAAE,EAA2B;CAC/F,MAAM,MAAM,QAAQ,OAAO;CAE3B,MAAM,UAAU,QAAQ,WAAW;EACjC,MAAM;EACN,MAAM;EAEN,MAAM;EACN,KAAK;EACL,SAAS;EACT,QAAQ;EACT;CAED,SAAS,aAAa,OAAsB;AAC1C,MAAI,MAAM,WAAW,EAAG;EAExB,IAAI,OAAO;EACX,IAAI,aAAa,EAAE;EAEnB,IAAI,eAAe;AAEnB,OAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,OAAI,MAAM,GAAG,SAAS,YAAa;GAEnC,MAAM,OAAO,YAAY,MAAM,GAAG;GAClC,MAAM,WAAW,OAAO,KAAK,QAAQ,CAAC,MAAM,SAAS,KAAK,WAAW,GAAG,MAAM,OAAO,CAAC;AAEtF,OAAI,UAAU;AACZ,QAAI,SAAS,IAAI;AACf,oBAAe;AACf;;AAGF,WAAO;AAEP,eAAW,KAAK;KACd,MAAM;KACN,MAAM;KACN,OAAO,QAAQ;KAChB,CAAC;IAEF,MAAM,OAAO,KAAK,MAAM,GAAG,MAAM,WAAW,OAAO;AACnD,QAAI,KAAK,WAAW,IAAI,IAAI,KAAK,SAAS,IAAI,CAC5C,YAAW,KAAK;KACd,MAAM;KACN,MAAM;KACN,OAAO,KAAK,MAAM,GAAG,GAAG;KACzB,CAAC;;AAIN,OAAI,SAAS,MAAM,SAAS,KAAK;IAC/B,MAAM,WAAW,MAAM,MAAM,OAAO,GAAG,EAAE;AAEzC,UAAM,OAAO,MAAM,IAAI,OAAO,GAAG;KAC/B,MAAM;KACN,MAAM;KACN;KACA,UAAU,eAAe,aAAa,SAAS,GAAG;KACnD,CAAgB;AACjB,WAAO;AACP,mBAAe;AACf,iBAAa,EAAE;AACf,QAAI;;;;AAKV,SAAQ,SAAS;AACf,QAAM,OAAO,SAAS;AACpB,OAAI,EAAE,cAAc,MAAO;AAE3B,gBAAa,KAAK,SAAS;IAC3B"}
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { MdxJsxFlowElement } from 'mdast-util-mdx-jsx';
|
|
4
|
-
|
|
5
|
-
type TabType = keyof typeof Types;
|
|
6
|
-
interface RemarkCodeTabOptions {
|
|
7
|
-
Tabs?: TabType;
|
|
8
|
-
/**
|
|
9
|
-
* Parse MDX in tab values
|
|
10
|
-
*
|
|
11
|
-
* @defaultValue false
|
|
12
|
-
*/
|
|
13
|
-
parseMdx?: boolean;
|
|
14
|
-
}
|
|
15
|
-
declare module 'mdast' {
|
|
16
|
-
interface CodeData {
|
|
17
|
-
tab?: string;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
declare const Types: {
|
|
21
|
-
CodeBlockTabs: {
|
|
22
|
-
convert(processor: Processor, nodes: Code[], withMdx?: boolean, withParent?: boolean): MdxJsxFlowElement;
|
|
23
|
-
};
|
|
24
|
-
Tabs: {
|
|
25
|
-
convert(processor: Processor, nodes: Code[], withMdx?: boolean, withParent?: boolean): MdxJsxFlowElement;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
declare function remarkCodeTab(this: Processor, options?: RemarkCodeTabOptions): Transformer<Root, Root>;
|
|
29
|
-
|
|
30
|
-
export { type RemarkCodeTabOptions, remarkCodeTab };
|
|
1
|
+
import { n as remarkCodeTab, t as RemarkCodeTabOptions } from "../remark-code-tab-CXsYlims.js";
|
|
2
|
+
export { RemarkCodeTabOptions, remarkCodeTab };
|