@hanzo/docs-core 16.4.3 → 16.5.3
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/README.md +3 -3
- package/dist/{advanced-BRT5Ij43.js → advanced-BH0syJ-M.js} +3 -4
- package/dist/{algolia-CQPXCnjV.js → algolia-C7Crg8-5.js} +2 -3
- package/dist/breadcrumb.d.ts +2 -3
- package/dist/breadcrumb.js +3 -4
- package/dist/{chunk-B-ezknvj.js → chunk-CaR5F9JI.js} +3 -3
- package/dist/content/github.d.ts +1 -2
- package/dist/content/github.js +1 -2
- package/dist/content/index.d.ts +3 -4
- package/dist/content/index.js +1 -2
- package/dist/content/mdx/preset-bundler.d.ts +9 -10
- package/dist/content/mdx/preset-bundler.js +2 -3
- package/dist/content/mdx/preset-runtime.d.ts +9 -10
- package/dist/content/mdx/preset-runtime.js +2 -3
- package/dist/content/toc.d.ts +1 -3
- package/dist/content/toc.js +4 -5
- package/dist/create-i18n-Cv3Cocbs.d.ts +51 -0
- package/dist/{definitions-DuxDer_c.d.ts → definitions-DSNTbAwC.d.ts} +1 -2
- package/dist/dynamic-link.d.ts +3 -4
- package/dist/dynamic-link.js +1 -3
- package/dist/{fetch-B5e9CFfN.js → fetch-HotVeLLF.js} +1 -2
- package/dist/framework/index.d.ts +5 -6
- package/dist/framework/index.js +18 -19
- package/dist/framework/next.d.ts +3 -4
- package/dist/framework/next.js +1 -2
- package/dist/framework/react-router.d.ts +1 -2
- package/dist/framework/react-router.js +1 -2
- package/dist/framework/tanstack.d.ts +4 -5
- package/dist/framework/tanstack.js +2 -3
- package/dist/framework/waku.d.ts +1 -2
- package/dist/framework/waku.js +1 -2
- package/dist/hast-utils-BmGqqmvo.js +15 -0
- package/dist/highlight/client.d.ts +2 -4
- package/dist/highlight/client.js +7 -13
- package/dist/highlight/config.d.ts +15 -0
- package/dist/highlight/config.js +18 -0
- package/dist/highlight/core/client.d.ts +31 -0
- package/dist/highlight/core/client.js +68 -0
- package/dist/highlight/core/index.d.ts +27 -0
- package/dist/highlight/core/index.js +69 -0
- package/dist/highlight/index.d.ts +34 -2
- package/dist/highlight/index.js +57 -2
- package/dist/i18n/index.d.ts +39 -1
- package/dist/i18n/index.js +1 -2
- package/dist/i18n/middleware.d.ts +2 -3
- package/dist/i18n/middleware.js +1 -2
- package/dist/{icon-BWwSDabM.js → icon-OtPFhyk1.js} +1 -2
- package/dist/link.d.ts +3 -4
- package/dist/link.js +1 -2
- package/dist/{mdast-utils-mc9-X-PK.js → mdast-utils-gJMY143g.js} +1 -2
- package/dist/mdx-plugins/codeblock-utils.d.ts +35 -1
- package/dist/mdx-plugins/codeblock-utils.js +2 -3
- package/dist/mdx-plugins/index.d.ts +18 -15
- package/dist/mdx-plugins/index.js +7 -5
- package/dist/mdx-plugins/rehype-code.core.d.ts +38 -0
- package/dist/mdx-plugins/rehype-code.core.js +104 -0
- package/dist/mdx-plugins/rehype-code.d.ts +18 -2
- package/dist/mdx-plugins/rehype-code.js +24 -3
- package/dist/mdx-plugins/rehype-toc.d.ts +16 -1
- package/dist/mdx-plugins/rehype-toc.js +127 -1
- package/dist/mdx-plugins/remark-admonition.d.ts +20 -1
- package/dist/mdx-plugins/remark-admonition.js +2 -3
- package/dist/mdx-plugins/remark-code-tab.d.ts +30 -1
- package/dist/mdx-plugins/remark-code-tab.js +4 -5
- package/dist/mdx-plugins/remark-directive-admonition.d.ts +34 -1
- package/dist/mdx-plugins/remark-directive-admonition.js +1 -2
- package/dist/mdx-plugins/remark-feedback-block.d.ts +51 -0
- package/dist/mdx-plugins/remark-feedback-block.js +47 -0
- package/dist/mdx-plugins/remark-gfm.d.ts +2 -2
- package/dist/mdx-plugins/remark-heading.d.ts +35 -1
- package/dist/mdx-plugins/remark-heading.js +2 -3
- package/dist/mdx-plugins/remark-image.d.ts +63 -1
- package/dist/mdx-plugins/remark-image.js +1 -2
- package/dist/mdx-plugins/remark-mdx-files.d.ts +55 -2
- package/dist/mdx-plugins/remark-mdx-files.js +103 -13
- package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.js +1 -2
- package/dist/mdx-plugins/remark-npm.d.ts +34 -1
- package/dist/mdx-plugins/remark-npm.js +1 -2
- package/dist/mdx-plugins/remark-steps.d.ts +26 -1
- package/dist/mdx-plugins/remark-steps.js +1 -2
- package/dist/mdx-plugins/remark-structure.d.ts +75 -1
- package/dist/mdx-plugins/remark-structure.js +7 -8
- package/dist/{mixedbread-DlByNYSd.js → mixedbread-Bx9drx9S.js} +6 -5
- package/dist/negotiation/index.d.ts +1 -2
- package/dist/negotiation/index.js +1 -2
- package/dist/{normalize-url-DP9-1I-S.js → normalize-url-DUHbcuVM.js} +2 -3
- package/dist/{orama-cloud-DH3g37zc.js → orama-cloud-ByznDyOk.js} +6 -7
- package/dist/orama-cloud-legacy-BbgJnf5f.js +81 -0
- package/dist/page-tree/index.d.ts +3 -45
- package/dist/page-tree/index.js +1 -1
- package/dist/{index-2U6Tl4--.d.ts → path-B77y3W0_.d.ts} +111 -98
- package/dist/{path-DHIjrDBP.js → path-D0Bwm6Fs.js} +2 -3
- package/dist/{remove-undefined-Cfs4o_mM.js → remove-undefined-CJm9cyrC.js} +1 -2
- package/dist/search/algolia.d.ts +66 -2
- package/dist/search/algolia.js +1 -2
- package/dist/search/client.d.ts +31 -8
- package/dist/search/client.js +27 -22
- package/dist/search/index.d.ts +1 -2
- package/dist/search/index.js +41 -1
- package/dist/search/orama-cloud-legacy.d.ts +77 -0
- package/dist/search/orama-cloud-legacy.js +49 -0
- package/dist/search/orama-cloud.d.ts +5 -9
- package/dist/search/orama-cloud.js +1 -2
- package/dist/search/server.d.ts +87 -4
- package/dist/search/server.js +7 -8
- package/dist/source/client/index.d.ts +13 -11
- package/dist/source/client/index.js +22 -13
- package/dist/source/index.d.ts +5 -3
- package/dist/source/index.js +428 -333
- package/dist/source/plugins/lucide-icons.d.ts +5 -4
- package/dist/source/plugins/lucide-icons.js +2 -3
- package/dist/source/plugins/slugs.d.ts +24 -2
- package/dist/source/plugins/slugs.js +2 -3
- package/dist/source/plugins/status-badges.d.ts +52 -0
- package/dist/source/plugins/status-badges.js +54 -0
- package/dist/source/schema.d.ts +1 -3
- package/dist/source/schema.js +1 -2
- package/dist/{static-Dq8pA8Ay.js → static-DTxK4eHk.js} +5 -6
- package/dist/toc.d.ts +5 -6
- package/dist/toc.js +1 -2
- package/dist/{rehype-code-CdiZ1Y6P.js → transformer-icon-BYedaeE8.js} +1 -96
- package/dist/transformer-icon-D7-6aFzt.d.ts +18 -0
- package/dist/types-BSnJn7kF.d.ts +6 -0
- package/dist/{util-CK2ykiif.d.ts → util-C60LmklF.d.ts} +1 -2
- package/dist/{util-s9piKHsk.js → util-De0ALHOx.js} +1 -2
- package/dist/utils/use-media-query.d.ts +1 -2
- package/dist/utils/use-media-query.js +1 -2
- package/dist/utils/use-on-change.d.ts +1 -2
- package/dist/utils/use-on-change.js +1 -2
- package/dist/{utils-DUvi2WkD.js → utils-Bc53B3CJ.js} +8 -7
- package/dist/utils-IgHyYnrz.d.ts +45 -0
- package/package.json +58 -28
- package/dist/advanced-BRT5Ij43.js.map +0 -1
- package/dist/algolia-CBBN8R6-.d.ts +0 -68
- package/dist/algolia-CBBN8R6-.d.ts.map +0 -1
- package/dist/algolia-CQPXCnjV.js.map +0 -1
- package/dist/breadcrumb.d.ts.map +0 -1
- package/dist/breadcrumb.js.map +0 -1
- package/dist/codeblock-utils-lld8UiQo.d.ts +0 -37
- package/dist/codeblock-utils-lld8UiQo.d.ts.map +0 -1
- package/dist/content/github.d.ts.map +0 -1
- package/dist/content/github.js.map +0 -1
- package/dist/content/index.d.ts.map +0 -1
- package/dist/content/index.js.map +0 -1
- package/dist/content/mdx/preset-bundler.d.ts.map +0 -1
- package/dist/content/mdx/preset-bundler.js.map +0 -1
- package/dist/content/mdx/preset-runtime.d.ts.map +0 -1
- package/dist/content/mdx/preset-runtime.js.map +0 -1
- package/dist/content/toc.d.ts.map +0 -1
- package/dist/content/toc.js.map +0 -1
- package/dist/definitions-DuxDer_c.d.ts.map +0 -1
- package/dist/dynamic-link.d.ts.map +0 -1
- package/dist/dynamic-link.js.map +0 -1
- package/dist/fetch-B5e9CFfN.js.map +0 -1
- package/dist/framework/index.d.ts.map +0 -1
- package/dist/framework/index.js.map +0 -1
- package/dist/framework/next.d.ts.map +0 -1
- package/dist/framework/next.js.map +0 -1
- package/dist/framework/react-router.d.ts.map +0 -1
- package/dist/framework/react-router.js.map +0 -1
- package/dist/framework/tanstack.d.ts.map +0 -1
- package/dist/framework/tanstack.js.map +0 -1
- package/dist/framework/waku.d.ts.map +0 -1
- package/dist/framework/waku.js.map +0 -1
- package/dist/highlight/client.d.ts.map +0 -1
- package/dist/highlight/client.js.map +0 -1
- package/dist/i18n/index.js.map +0 -1
- package/dist/i18n/middleware.d.ts.map +0 -1
- package/dist/i18n/middleware.js.map +0 -1
- package/dist/icon-BWwSDabM.js.map +0 -1
- package/dist/index-2U6Tl4--.d.ts.map +0 -1
- package/dist/index-Bw-DCOra.d.ts +0 -41
- package/dist/index-Bw-DCOra.d.ts.map +0 -1
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js.map +0 -1
- package/dist/mdast-utils-mc9-X-PK.js.map +0 -1
- package/dist/mdx-plugins/codeblock-utils.js.map +0 -1
- package/dist/mdx-plugins/remark-admonition.js.map +0 -1
- package/dist/mdx-plugins/remark-code-tab.js.map +0 -1
- package/dist/mdx-plugins/remark-directive-admonition.js.map +0 -1
- package/dist/mdx-plugins/remark-heading.js.map +0 -1
- package/dist/mdx-plugins/remark-image.js.map +0 -1
- package/dist/mdx-plugins/remark-mdx-files.js.map +0 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.js.map +0 -1
- package/dist/mdx-plugins/remark-npm.js.map +0 -1
- package/dist/mdx-plugins/remark-steps.js.map +0 -1
- package/dist/mdx-plugins/remark-structure.js.map +0 -1
- package/dist/mixedbread-DlByNYSd.js.map +0 -1
- package/dist/negotiation/index.d.ts.map +0 -1
- package/dist/negotiation/index.js.map +0 -1
- package/dist/normalize-url-DP9-1I-S.js.map +0 -1
- package/dist/orama-cloud-DH3g37zc.js.map +0 -1
- package/dist/page-tree/index.d.ts.map +0 -1
- package/dist/path-DHIjrDBP.js.map +0 -1
- package/dist/rehype-code-CdiZ1Y6P.js.map +0 -1
- package/dist/rehype-code-vVWG4-ej.d.ts +0 -58
- package/dist/rehype-code-vVWG4-ej.d.ts.map +0 -1
- package/dist/rehype-toc-DJvSyE0o.d.ts +0 -18
- package/dist/rehype-toc-DJvSyE0o.d.ts.map +0 -1
- package/dist/rehype-toc-DVwJcwvA.js +0 -143
- package/dist/rehype-toc-DVwJcwvA.js.map +0 -1
- package/dist/remark-admonition-DOwBWzsH.d.ts +0 -22
- package/dist/remark-admonition-DOwBWzsH.d.ts.map +0 -1
- package/dist/remark-code-tab-CXsYlims.d.ts +0 -32
- package/dist/remark-code-tab-CXsYlims.d.ts.map +0 -1
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts +0 -36
- package/dist/remark-directive-admonition-BCm_yiU9.d.ts.map +0 -1
- package/dist/remark-gfm-CeWpMwyk.d.ts +0 -2
- package/dist/remark-heading-CXvCY0go.d.ts +0 -37
- package/dist/remark-heading-CXvCY0go.d.ts.map +0 -1
- package/dist/remark-image-CvUis4R1.d.ts +0 -65
- package/dist/remark-image-CvUis4R1.d.ts.map +0 -1
- package/dist/remark-mdx-files-DOYafA4x.d.ts +0 -42
- package/dist/remark-mdx-files-DOYafA4x.d.ts.map +0 -1
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts +0 -17
- package/dist/remark-mdx-mermaid-BdSUUiCG.d.ts.map +0 -1
- package/dist/remark-npm-BIvIEKT2.d.ts +0 -36
- package/dist/remark-npm-BIvIEKT2.d.ts.map +0 -1
- package/dist/remark-steps-CHJN-rtm.d.ts +0 -28
- package/dist/remark-steps-CHJN-rtm.d.ts.map +0 -1
- package/dist/remark-structure-RZD2gGKp.d.ts +0 -77
- package/dist/remark-structure-RZD2gGKp.d.ts.map +0 -1
- package/dist/remove-undefined-Cfs4o_mM.js.map +0 -1
- package/dist/search/algolia.js.map +0 -1
- package/dist/search/client.d.ts.map +0 -1
- package/dist/search/client.js.map +0 -1
- package/dist/search/index.d.ts.map +0 -1
- package/dist/search/orama-cloud.d.ts.map +0 -1
- package/dist/search/orama-cloud.js.map +0 -1
- package/dist/search/server.js.map +0 -1
- package/dist/search-D6ChCLhY.js +0 -44
- package/dist/search-D6ChCLhY.js.map +0 -1
- package/dist/server-CPR_fgkH.d.ts +0 -133
- package/dist/server-CPR_fgkH.d.ts.map +0 -1
- package/dist/shiki-4oMYwHED.js +0 -80
- package/dist/shiki-4oMYwHED.js.map +0 -1
- package/dist/shiki-CIBQys54.d.ts +0 -33
- package/dist/shiki-CIBQys54.d.ts.map +0 -1
- package/dist/source/client/index.d.ts.map +0 -1
- package/dist/source/client/index.js.map +0 -1
- package/dist/source/index.js.map +0 -1
- package/dist/source/plugins/lucide-icons.d.ts.map +0 -1
- package/dist/source/plugins/lucide-icons.js.map +0 -1
- package/dist/source/plugins/slugs.js.map +0 -1
- package/dist/source/schema.d.ts.map +0 -1
- package/dist/source/schema.js.map +0 -1
- package/dist/static-Dq8pA8Ay.js.map +0 -1
- package/dist/toc.d.ts.map +0 -1
- package/dist/toc.js.map +0 -1
- package/dist/util-CK2ykiif.d.ts.map +0 -1
- package/dist/util-s9piKHsk.js.map +0 -1
- package/dist/utils/use-effect-event.d.ts +0 -11
- package/dist/utils/use-effect-event.d.ts.map +0 -1
- package/dist/utils/use-effect-event.js +0 -19
- package/dist/utils/use-effect-event.js.map +0 -1
- package/dist/utils/use-media-query.d.ts.map +0 -1
- package/dist/utils/use-media-query.js.map +0 -1
- package/dist/utils/use-on-change.d.ts.map +0 -1
- package/dist/utils/use-on-change.js.map +0 -1
- package/dist/utils-DUvi2WkD.js.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/highlight/config.ts
|
|
2
|
+
/** define shared configurations for Shiki */
|
|
3
|
+
function defineShikiConfig(config) {
|
|
4
|
+
let created;
|
|
5
|
+
return {
|
|
6
|
+
id: Symbol(),
|
|
7
|
+
defaultThemes: config.defaultThemes,
|
|
8
|
+
createHighlighter() {
|
|
9
|
+
if (created) return created;
|
|
10
|
+
created = config.createHighlighter();
|
|
11
|
+
if ("then" in created) created = created.then((v) => created = v);
|
|
12
|
+
return created;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { defineShikiConfig };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { r as MakeOptional } from "../../types-BSnJn7kF.js";
|
|
2
|
+
import { ResolvedShikiConfig } from "../config.js";
|
|
3
|
+
import { CoreHighlightOptions } from "./index.js";
|
|
4
|
+
import { DependencyList, ReactNode } from "react";
|
|
5
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/highlight/core/client.d.ts
|
|
8
|
+
declare function useShikiConfigOptional(): ResolvedShikiConfig | null;
|
|
9
|
+
declare function useShikiConfig(forced?: ResolvedShikiConfig): ResolvedShikiConfig;
|
|
10
|
+
declare function ShikiConfigProvider({
|
|
11
|
+
config,
|
|
12
|
+
children
|
|
13
|
+
}: {
|
|
14
|
+
config: ResolvedShikiConfig;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}): react_jsx_runtime0.JSX.Element;
|
|
17
|
+
type UseShikiOptions = MakeOptional<CoreHighlightOptions, 'config'>;
|
|
18
|
+
/**
|
|
19
|
+
* get highlighted results (uncached), use `useEffect` instead of React 19 APIs.
|
|
20
|
+
*/
|
|
21
|
+
declare function useShikiDynamic(code: string, options: UseShikiOptions & {
|
|
22
|
+
defaultValue?: ReactNode;
|
|
23
|
+
}, deps: DependencyList): ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* get highlighted results, should be used with React Suspense API.
|
|
26
|
+
*
|
|
27
|
+
* note: results are cached with (lang, code) as keys, if this is not the desired behaviour, pass a `deps` instead.
|
|
28
|
+
*/
|
|
29
|
+
declare function useShiki(code: string, options: UseShikiOptions, deps?: DependencyList): ReactNode;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { ShikiConfigProvider, UseShikiOptions, useShiki, useShikiConfig, useShikiConfigOptional, useShikiDynamic };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { highlight } from "./index.js";
|
|
4
|
+
import { createContext, use, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
//#region src/highlight/core/client.tsx
|
|
8
|
+
const ShikiConfigContext = createContext(null);
|
|
9
|
+
function useShikiConfigOptional() {
|
|
10
|
+
return use(ShikiConfigContext);
|
|
11
|
+
}
|
|
12
|
+
function useShikiConfig(forced) {
|
|
13
|
+
if (forced) return forced;
|
|
14
|
+
const ctx = use(ShikiConfigContext);
|
|
15
|
+
if (!ctx) throw new Error(`missing <ShikiConfigProvider />`);
|
|
16
|
+
return ctx;
|
|
17
|
+
}
|
|
18
|
+
function ShikiConfigProvider({ config, children }) {
|
|
19
|
+
return /* @__PURE__ */ jsx(ShikiConfigContext, {
|
|
20
|
+
value: config,
|
|
21
|
+
children
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
const promises = {};
|
|
25
|
+
/**
|
|
26
|
+
* get highlighted results (uncached), use `useEffect` instead of React 19 APIs.
|
|
27
|
+
*/
|
|
28
|
+
function useShikiDynamic(code, options, deps) {
|
|
29
|
+
const [node, setNode] = useState(options.defaultValue);
|
|
30
|
+
const config = useShikiConfig(options.config);
|
|
31
|
+
const lastTask = useRef(null);
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
const promise = highlight(code, {
|
|
34
|
+
...options,
|
|
35
|
+
config
|
|
36
|
+
});
|
|
37
|
+
lastTask.current = promise;
|
|
38
|
+
promise.then((res) => {
|
|
39
|
+
if (lastTask.current === promise) setNode(res);
|
|
40
|
+
});
|
|
41
|
+
return () => {
|
|
42
|
+
lastTask.current = null;
|
|
43
|
+
};
|
|
44
|
+
}, deps);
|
|
45
|
+
return node;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* get highlighted results, should be used with React Suspense API.
|
|
49
|
+
*
|
|
50
|
+
* note: results are cached with (lang, code) as keys, if this is not the desired behaviour, pass a `deps` instead.
|
|
51
|
+
*/
|
|
52
|
+
function useShiki(code, options, deps) {
|
|
53
|
+
const config = useShikiConfig(options.config);
|
|
54
|
+
const key = useMemo(() => {
|
|
55
|
+
return deps ? JSON.stringify(deps) : `${options.lang}:${code}`;
|
|
56
|
+
}, [
|
|
57
|
+
code,
|
|
58
|
+
deps,
|
|
59
|
+
options.lang
|
|
60
|
+
]);
|
|
61
|
+
return use(promises[key] ??= highlight(code, {
|
|
62
|
+
...options,
|
|
63
|
+
config
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { ShikiConfigProvider, useShiki, useShikiConfig, useShikiConfigOptional, useShikiDynamic };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { n as DistributiveOmit } from "../../types-BSnJn7kF.js";
|
|
2
|
+
import { ResolvedShikiConfig } from "../config.js";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { Components } from "hast-util-to-jsx-runtime";
|
|
5
|
+
import { BundledLanguage, BundledTheme, CodeOptionsMeta, CodeOptionsThemes, CodeToHastOptionsCommon, HighlighterCore, LanguageRegistration, ThemeRegistrationAny } from "shiki";
|
|
6
|
+
import { Root } from "hast";
|
|
7
|
+
|
|
8
|
+
//#region src/highlight/core/index.d.ts
|
|
9
|
+
type CoreHighlightOptions = CodeToHastOptionsCommon<BundledLanguage> & CodeOptionsMeta & {
|
|
10
|
+
config: ResolvedShikiConfig;
|
|
11
|
+
components?: Partial<Components>;
|
|
12
|
+
fallbackLanguage?: BundledLanguage;
|
|
13
|
+
} & (CodeOptionsThemes<BundledTheme> | Record<never, never>);
|
|
14
|
+
declare function highlightHast(code: string, options: DistributiveOmit<CoreHighlightOptions, 'components'>): Promise<Root>;
|
|
15
|
+
/**
|
|
16
|
+
* Get Shiki highlighter instance of Hanzo Docs (mostly for internal use, you should use Shiki directly over this).
|
|
17
|
+
*
|
|
18
|
+
* @param engineType - Shiki Regex engine to use.
|
|
19
|
+
* @param options - Shiki options.
|
|
20
|
+
*/
|
|
21
|
+
declare function getHighlighter(config: ResolvedShikiConfig, options?: {
|
|
22
|
+
langs?: (BundledLanguage | LanguageRegistration)[];
|
|
23
|
+
themes?: (BundledTheme | ThemeRegistrationAny)[];
|
|
24
|
+
}): Promise<HighlighterCore>;
|
|
25
|
+
declare function highlight(code: string, options: CoreHighlightOptions): Promise<ReactNode>;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { CoreHighlightOptions, getHighlighter, highlight, highlightHast };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Fragment } from "react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { toJsxRuntime } from "hast-util-to-jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/highlight/core/index.ts
|
|
6
|
+
async function highlightHast(code, options) {
|
|
7
|
+
const { fallbackLanguage = "text", config, ...resolved } = options;
|
|
8
|
+
let themesToLoad;
|
|
9
|
+
if (!("theme" in resolved) && !("themes" in resolved)) Object.assign(resolved, config.defaultThemes);
|
|
10
|
+
if ("theme" in resolved) themesToLoad = [resolved.theme];
|
|
11
|
+
else if ("themes" in resolved) {
|
|
12
|
+
themesToLoad = Object.values(resolved.themes).filter((v) => v !== void 0);
|
|
13
|
+
resolved.defaultColor ??= false;
|
|
14
|
+
} else throw new Error("impossible");
|
|
15
|
+
const { isSpecialLang } = await import("shiki/core");
|
|
16
|
+
const highlighter = await config.createHighlighter();
|
|
17
|
+
if (!isSpecialLang(resolved.lang) && !(resolved.lang in highlighter.getBundledLanguages()) && !highlighter.getLoadedLanguages().includes(resolved.lang)) resolved.lang = fallbackLanguage;
|
|
18
|
+
await Promise.all([loadMissingTheme(highlighter, ...themesToLoad), loadMissingLanguage(highlighter, resolved.lang)]);
|
|
19
|
+
return highlighter.codeToHast(code, resolved);
|
|
20
|
+
}
|
|
21
|
+
async function loadMissingTheme(highlighter, ...themes) {
|
|
22
|
+
const { isSpecialTheme } = await import("shiki/core");
|
|
23
|
+
const missingThemes = themes.filter((theme) => {
|
|
24
|
+
if (isSpecialTheme(theme)) return false;
|
|
25
|
+
try {
|
|
26
|
+
highlighter.getTheme(theme);
|
|
27
|
+
return false;
|
|
28
|
+
} catch {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
if (missingThemes.length > 0) await highlighter.loadTheme(...missingThemes);
|
|
33
|
+
}
|
|
34
|
+
async function loadMissingLanguage(highlighter, ...langs) {
|
|
35
|
+
const { isSpecialLang } = await import("shiki/core");
|
|
36
|
+
const missingLangs = langs.filter((lang) => {
|
|
37
|
+
if (isSpecialLang(lang)) return false;
|
|
38
|
+
try {
|
|
39
|
+
highlighter.getLanguage(lang);
|
|
40
|
+
return false;
|
|
41
|
+
} catch {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (missingLangs.length > 0) await highlighter.loadLanguage(...missingLangs);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get Shiki highlighter instance of Hanzo Docs (mostly for internal use, you should use Shiki directly over this).
|
|
49
|
+
*
|
|
50
|
+
* @param engineType - Shiki Regex engine to use.
|
|
51
|
+
* @param options - Shiki options.
|
|
52
|
+
*/
|
|
53
|
+
async function getHighlighter(config, options) {
|
|
54
|
+
const highlighter = await config.createHighlighter();
|
|
55
|
+
await Promise.all([options?.langs && loadMissingLanguage(highlighter, ...options.langs), options?.themes && loadMissingTheme(highlighter, ...options.themes)]);
|
|
56
|
+
return highlighter;
|
|
57
|
+
}
|
|
58
|
+
async function highlight(code, options) {
|
|
59
|
+
return toJsxRuntime(await highlightHast(code, options), {
|
|
60
|
+
jsx,
|
|
61
|
+
jsxs,
|
|
62
|
+
development: false,
|
|
63
|
+
Fragment,
|
|
64
|
+
components: options.components
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { getHighlighter, highlight, highlightHast };
|
|
@@ -1,2 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as DistributiveOmit } from "../types-BSnJn7kF.js";
|
|
2
|
+
import { ResolvedShikiConfig } from "./config.js";
|
|
3
|
+
import { CoreHighlightOptions } from "./core/index.js";
|
|
4
|
+
import { ReactNode } from "react";
|
|
5
|
+
import * as shiki from "shiki";
|
|
6
|
+
import { BundledLanguage, BundledTheme, LanguageRegistration, ThemeRegistrationAny } from "shiki";
|
|
7
|
+
import { Root } from "hast";
|
|
8
|
+
|
|
9
|
+
//#region src/highlight/index.d.ts
|
|
10
|
+
type HighlightOptions = DistributiveOmit<CoreHighlightOptions, 'config'> & {
|
|
11
|
+
/**
|
|
12
|
+
* The Regex Engine for Shiki
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue 'js'
|
|
15
|
+
*/
|
|
16
|
+
engine?: 'js' | 'oniguruma';
|
|
17
|
+
};
|
|
18
|
+
declare function highlightHast(code: string, options: HighlightOptions): Promise<Root>;
|
|
19
|
+
/**
|
|
20
|
+
* Get Shiki highlighter instance of Hanzo Docs (mostly for internal use, you should use Shiki directly over this).
|
|
21
|
+
*
|
|
22
|
+
* @param engineType - Shiki Regex engine to use.
|
|
23
|
+
* @param options - Shiki options.
|
|
24
|
+
*/
|
|
25
|
+
declare function getHighlighter(engineType: 'js' | 'oniguruma', options?: {
|
|
26
|
+
langs?: (BundledLanguage | LanguageRegistration)[];
|
|
27
|
+
themes?: (BundledTheme | ThemeRegistrationAny)[];
|
|
28
|
+
}): Promise<shiki.HighlighterCore>;
|
|
29
|
+
declare function highlight(code: string, options: HighlightOptions): Promise<ReactNode>;
|
|
30
|
+
declare const configDefault: ResolvedShikiConfig;
|
|
31
|
+
/** config using the WASM powered Regex engine */
|
|
32
|
+
declare const configWASM: ResolvedShikiConfig;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { HighlightOptions, configDefault, configWASM, getHighlighter, highlight, highlightHast };
|
package/dist/highlight/index.js
CHANGED
|
@@ -1,3 +1,58 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getHighlighter as getHighlighter$1, highlight as highlight$1, highlightHast as highlightHast$1 } from "./core/index.js";
|
|
2
|
+
import { defineShikiConfig } from "./config.js";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
//#region src/highlight/index.ts
|
|
5
|
+
async function highlightHast(code, options) {
|
|
6
|
+
const engine = options.engine ?? "js";
|
|
7
|
+
return highlightHast$1(code, {
|
|
8
|
+
...options,
|
|
9
|
+
config: engine === "js" ? configDefault : configWASM
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get Shiki highlighter instance of Hanzo Docs (mostly for internal use, you should use Shiki directly over this).
|
|
14
|
+
*
|
|
15
|
+
* @param engineType - Shiki Regex engine to use.
|
|
16
|
+
* @param options - Shiki options.
|
|
17
|
+
*/
|
|
18
|
+
async function getHighlighter(engineType, options) {
|
|
19
|
+
return getHighlighter$1(engineType === "js" ? configDefault : configWASM, options);
|
|
20
|
+
}
|
|
21
|
+
async function highlight(code, options) {
|
|
22
|
+
const engine = options.engine ?? "js";
|
|
23
|
+
return highlight$1(code, {
|
|
24
|
+
...options,
|
|
25
|
+
config: engine === "js" ? configDefault : configWASM
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const defaultThemes = { themes: {
|
|
29
|
+
light: "github-light",
|
|
30
|
+
dark: "github-dark"
|
|
31
|
+
} };
|
|
32
|
+
const configDefault = defineShikiConfig({
|
|
33
|
+
defaultThemes,
|
|
34
|
+
async createHighlighter() {
|
|
35
|
+
const { createHighlighter } = await import("shiki");
|
|
36
|
+
const { createJavaScriptRegexEngine } = await import("shiki/engine/javascript");
|
|
37
|
+
return createHighlighter({
|
|
38
|
+
langs: [],
|
|
39
|
+
themes: [],
|
|
40
|
+
engine: createJavaScriptRegexEngine()
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
/** config using the WASM powered Regex engine */
|
|
45
|
+
const configWASM = defineShikiConfig({
|
|
46
|
+
defaultThemes,
|
|
47
|
+
async createHighlighter() {
|
|
48
|
+
const { createHighlighter, createOnigurumaEngine } = await import("shiki");
|
|
49
|
+
return createHighlighter({
|
|
50
|
+
langs: [],
|
|
51
|
+
themes: [],
|
|
52
|
+
engine: createOnigurumaEngine(import("shiki/wasm"))
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { configDefault, configWASM, getHighlighter, highlight, highlightHast };
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,2 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/i18n/index.d.ts
|
|
2
|
+
interface I18nConfig<Languages extends string = string> {
|
|
3
|
+
/**
|
|
4
|
+
* Supported locale codes.
|
|
5
|
+
*
|
|
6
|
+
* A page tree will be built for each language.
|
|
7
|
+
*/
|
|
8
|
+
languages: Languages[];
|
|
9
|
+
/**
|
|
10
|
+
* Default locale if not specified
|
|
11
|
+
*/
|
|
12
|
+
defaultLanguage: Languages;
|
|
13
|
+
/**
|
|
14
|
+
* Don't show the locale prefix on URL.
|
|
15
|
+
*
|
|
16
|
+
* - `always`: Always hide the prefix
|
|
17
|
+
* - `default-locale`: Only hide the default locale
|
|
18
|
+
* - `never`: Never hide the prefix
|
|
19
|
+
*
|
|
20
|
+
* This API uses `NextResponse.rewrite`.
|
|
21
|
+
*
|
|
22
|
+
* @defaultValue 'never'
|
|
23
|
+
*/
|
|
24
|
+
hideLocale?: 'always' | 'default-locale' | 'never';
|
|
25
|
+
/**
|
|
26
|
+
* Used by `loader()`, specify the way to parse i18n file structure.
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue 'dot'
|
|
29
|
+
*/
|
|
30
|
+
parser?: 'dot' | 'dir' | 'none';
|
|
31
|
+
/**
|
|
32
|
+
* the fallback language when the page has no translations available for a given locale.
|
|
33
|
+
*
|
|
34
|
+
* Default to `defaultLanguage`, no fallback when set to `null`.
|
|
35
|
+
*/
|
|
36
|
+
fallbackLanguage?: Languages | null;
|
|
37
|
+
}
|
|
38
|
+
declare function defineI18n<Languages extends string>(config: I18nConfig<Languages>): I18nConfig<Languages>;
|
|
39
|
+
//#endregion
|
|
2
40
|
export { I18nConfig, defineI18n };
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I18nConfig } from "./index.js";
|
|
2
2
|
import { NextProxy } from "next/server";
|
|
3
3
|
import { NextURL } from "next/dist/server/web/next-url";
|
|
4
4
|
|
|
@@ -38,5 +38,4 @@ declare function createI18nMiddleware({
|
|
|
38
38
|
hideLocale
|
|
39
39
|
}: MiddlewareOptions): NextProxy;
|
|
40
40
|
//#endregion
|
|
41
|
-
export { DefaultFormatter, URLFormatter, createI18nMiddleware };
|
|
42
|
-
//# sourceMappingURL=middleware.d.ts.map
|
|
41
|
+
export { DefaultFormatter, URLFormatter, createI18nMiddleware };
|
package/dist/i18n/middleware.js
CHANGED
package/dist/link.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react from "react";
|
|
2
2
|
import { AnchorHTMLAttributes } from "react";
|
|
3
3
|
|
|
4
4
|
//#region src/link.d.ts
|
|
@@ -14,7 +14,6 @@ interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
14
14
|
*/
|
|
15
15
|
prefetch?: boolean;
|
|
16
16
|
}
|
|
17
|
-
declare const Link:
|
|
17
|
+
declare const Link: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLAnchorElement>>;
|
|
18
18
|
//#endregion
|
|
19
|
-
export { LinkProps, Link as default };
|
|
20
|
-
//# sourceMappingURL=link.d.ts.map
|
|
19
|
+
export { LinkProps, Link as default };
|
package/dist/link.js
CHANGED
|
@@ -1,2 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockContent, Text } from "mdast";
|
|
2
|
+
import { MdxJsxAttribute, MdxJsxFlowElement } from "mdast-util-mdx-jsx";
|
|
3
|
+
|
|
4
|
+
//#region src/mdx-plugins/codeblock-utils.d.ts
|
|
5
|
+
interface CodeBlockTabsOptions {
|
|
6
|
+
attributes?: MdxJsxAttribute[];
|
|
7
|
+
defaultValue?: string;
|
|
8
|
+
persist?: {
|
|
9
|
+
id: string;
|
|
10
|
+
} | false;
|
|
11
|
+
triggers: {
|
|
12
|
+
value: string;
|
|
13
|
+
children: (BlockContent | Text)[];
|
|
14
|
+
}[];
|
|
15
|
+
tabs: {
|
|
16
|
+
value: string;
|
|
17
|
+
children: BlockContent[];
|
|
18
|
+
}[];
|
|
19
|
+
}
|
|
20
|
+
declare function generateCodeBlockTabs({
|
|
21
|
+
persist,
|
|
22
|
+
defaultValue,
|
|
23
|
+
triggers,
|
|
24
|
+
tabs,
|
|
25
|
+
...options
|
|
26
|
+
}: CodeBlockTabsOptions): MdxJsxFlowElement;
|
|
27
|
+
interface CodeBlockAttributes<Name extends string = string> {
|
|
28
|
+
attributes: Partial<Record<Name, string | null>>;
|
|
29
|
+
rest: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Parse Hanzo Docs-style code block attributes from meta string, like `title="hello world"`
|
|
33
|
+
*/
|
|
34
|
+
declare function parseCodeBlockAttributes<Name extends string = string>(meta: string, allowedNames?: Name[]): CodeBlockAttributes<Name>;
|
|
35
|
+
//#endregion
|
|
2
36
|
export { CodeBlockAttributes, CodeBlockTabsOptions, generateCodeBlockTabs, parseCodeBlockAttributes };
|
|
@@ -49,7 +49,7 @@ function generateCodeBlockTabs({ persist = false, defaultValue, triggers, tabs,
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Parse
|
|
52
|
+
* Parse Hanzo Docs-style code block attributes from meta string, like `title="hello world"`
|
|
53
53
|
*/
|
|
54
54
|
function parseCodeBlockAttributes(meta, allowedNames) {
|
|
55
55
|
let str = meta;
|
|
@@ -67,5 +67,4 @@ function parseCodeBlockAttributes(meta, allowedNames) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
//#endregion
|
|
70
|
-
export { generateCodeBlockTabs, parseCodeBlockAttributes };
|
|
71
|
-
//# sourceMappingURL=codeblock-utils.js.map
|
|
70
|
+
export { generateCodeBlockTabs, parseCodeBlockAttributes };
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
1
|
+
import { RemarkGfmOptions, remarkGfm } from "./remark-gfm.js";
|
|
2
|
+
import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-D7-6aFzt.js";
|
|
3
|
+
import { transformerTab } from "./rehype-code.core.js";
|
|
4
|
+
import { RehypeCodeOptions, rehypeCode, rehypeCodeDefaultOptions } from "./rehype-code.js";
|
|
5
|
+
import { RemarkImageOptions, remarkImage } from "./remark-image.js";
|
|
6
|
+
import { StructureOptions, StructuredData, remarkStructure, remarkStructureDefaultOptions, structure } from "./remark-structure.js";
|
|
7
|
+
import { RemarkHeadingOptions, remarkHeading } from "./remark-heading.js";
|
|
8
|
+
import { RemarkAdmonitionOptions, remarkAdmonition } from "./remark-admonition.js";
|
|
9
|
+
import { RemarkDirectiveAdmonitionOptions, remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
|
|
10
|
+
import { RehypeTocOptions, rehypeToc } from "./rehype-toc.js";
|
|
11
|
+
import { RemarkCodeTabOptions, remarkCodeTab } from "./remark-code-tab.js";
|
|
12
|
+
import { RemarkStepsOptions, remarkSteps } from "./remark-steps.js";
|
|
13
|
+
import { RemarkNpmOptions, remarkNpm } from "./remark-npm.js";
|
|
14
|
+
import { CodeBlockAttributes, CodeBlockTabsOptions, generateCodeBlockTabs, parseCodeBlockAttributes } from "./codeblock-utils.js";
|
|
15
|
+
import { RemarkMdxFilesOptions, remarkMdxFiles } from "./remark-mdx-files.js";
|
|
16
|
+
import { RemarkMdxMermaidOptions, remarkMdxMermaid } from "./remark-mdx-mermaid.js";
|
|
17
|
+
import { FeedbackBlockProps, RemarkFeedbackBlockOptions, remarkFeedbackBlock } from "./remark-feedback-block.js";
|
|
18
|
+
export { CodeBlockAttributes, CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, RehypeCodeOptions, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StructureOptions, StructuredData, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import "../mdast-utils-
|
|
1
|
+
import "../mdast-utils-gJMY143g.js";
|
|
2
2
|
import { remarkHeading } from "./remark-heading.js";
|
|
3
|
-
import "../shiki-4oMYwHED.js";
|
|
4
3
|
import { generateCodeBlockTabs, parseCodeBlockAttributes } from "./codeblock-utils.js";
|
|
5
4
|
import { remarkGfm } from "./remark-gfm.js";
|
|
6
|
-
import {
|
|
5
|
+
import { t as transformerIcon } from "../transformer-icon-BYedaeE8.js";
|
|
6
|
+
import { transformerTab } from "./rehype-code.core.js";
|
|
7
|
+
import { rehypeCode, rehypeCodeDefaultOptions } from "./rehype-code.js";
|
|
7
8
|
import { remarkImage } from "./remark-image.js";
|
|
8
9
|
import { remarkStructure, remarkStructureDefaultOptions, structure } from "./remark-structure.js";
|
|
9
10
|
import { remarkAdmonition } from "./remark-admonition.js";
|
|
10
11
|
import { remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
|
|
11
|
-
import {
|
|
12
|
+
import { rehypeToc } from "./rehype-toc.js";
|
|
12
13
|
import { remarkCodeTab } from "./remark-code-tab.js";
|
|
13
14
|
import { remarkSteps } from "./remark-steps.js";
|
|
14
15
|
import { remarkNpm } from "./remark-npm.js";
|
|
15
16
|
import { remarkMdxFiles } from "./remark-mdx-files.js";
|
|
16
17
|
import { remarkMdxMermaid } from "./remark-mdx-mermaid.js";
|
|
18
|
+
import { remarkFeedbackBlock } from "./remark-feedback-block.js";
|
|
17
19
|
|
|
18
|
-
export { generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
20
|
+
export { generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { n as IconOptions, r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-D7-6aFzt.js";
|
|
2
|
+
import { n as DistributiveOmit } from "../types-BSnJn7kF.js";
|
|
3
|
+
import { ResolvedShikiConfig } from "../highlight/config.js";
|
|
4
|
+
import { ShikiTransformer } from "shiki";
|
|
5
|
+
import { Processor, Transformer } from "unified";
|
|
6
|
+
import { Root } from "hast";
|
|
7
|
+
import { RehypeShikiOptions } from "@shikijs/rehype";
|
|
8
|
+
|
|
9
|
+
//#region src/mdx-plugins/rehype-code.core.d.ts
|
|
10
|
+
declare function rehypeCodeDefaultOptions(config: ResolvedShikiConfig): RehypeCodeOptionsCommon;
|
|
11
|
+
type RehypeCodeOptionsCommon = DistributiveOmit<RehypeShikiOptions, 'lazy'> & {
|
|
12
|
+
/**
|
|
13
|
+
* Load languages and themes on-demand.
|
|
14
|
+
* @defaultValue true
|
|
15
|
+
*/
|
|
16
|
+
lazy?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Filter meta string before processing
|
|
19
|
+
*/
|
|
20
|
+
filterMetaString?: (metaString: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Add icon to code blocks
|
|
23
|
+
*/
|
|
24
|
+
icon?: IconOptions | false;
|
|
25
|
+
/**
|
|
26
|
+
* Wrap code blocks in `<Tab>` component when "tab" meta string presents
|
|
27
|
+
*
|
|
28
|
+
* @defaultValue true
|
|
29
|
+
*/
|
|
30
|
+
tab?: boolean;
|
|
31
|
+
};
|
|
32
|
+
declare function createRehypeCode<Options extends Partial<RehypeCodeOptionsCommon> = Partial<RehypeCodeOptionsCommon>>(configFactory: ResolvedShikiConfig | ((options?: Options) => {
|
|
33
|
+
config: ResolvedShikiConfig;
|
|
34
|
+
options: RehypeCodeOptionsCommon;
|
|
35
|
+
})): (this: Processor, _options: Options | undefined) => Transformer<Root, Root>;
|
|
36
|
+
declare function transformerTab(): ShikiTransformer;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { type CodeBlockIcon, RehypeCodeOptionsCommon, createRehypeCode, rehypeCodeDefaultOptions, transformerIcon, transformerTab };
|