@hanzo/docs-core 16.2.5

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.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/dist/algolia-IZEDLPHE.js +58 -0
  4. package/dist/breadcrumb.d.ts +46 -0
  5. package/dist/breadcrumb.js +81 -0
  6. package/dist/chunk-5PMI7QDD.js +220 -0
  7. package/dist/chunk-ADBHPKXG.js +78 -0
  8. package/dist/chunk-APKPSBSB.js +74 -0
  9. package/dist/chunk-CH7YHH7V.js +222 -0
  10. package/dist/chunk-EFVXL2PP.js +144 -0
  11. package/dist/chunk-EMWGTXSW.js +19 -0
  12. package/dist/chunk-FAEPKD7U.js +20 -0
  13. package/dist/chunk-FUUVPEA5.js +29 -0
  14. package/dist/chunk-GINBKBVQ.js +12 -0
  15. package/dist/chunk-GLRQBLGN.js +59 -0
  16. package/dist/chunk-JUF4WZ6G.js +117 -0
  17. package/dist/chunk-K4WNLOVQ.js +75 -0
  18. package/dist/chunk-L4JKQWCM.js +131 -0
  19. package/dist/chunk-MA6O2UUE.js +50 -0
  20. package/dist/chunk-ONG4RVCR.js +8 -0
  21. package/dist/chunk-OTD7MV33.js +53 -0
  22. package/dist/chunk-PFNP6PEB.js +11 -0
  23. package/dist/chunk-QJRXMG4S.js +275 -0
  24. package/dist/chunk-SH7BNTG7.js +38 -0
  25. package/dist/chunk-TWIDBWFG.js +84 -0
  26. package/dist/chunk-U67V476Y.js +35 -0
  27. package/dist/chunk-VLSDGCJE.js +47 -0
  28. package/dist/chunk-W6WTLKRA.js +73 -0
  29. package/dist/chunk-X2HFD5QJ.js +275 -0
  30. package/dist/chunk-XJ6ZQNEX.js +91 -0
  31. package/dist/chunk-XN2LKXFZ.js +101 -0
  32. package/dist/chunk-XOFXGHS4.js +93 -0
  33. package/dist/chunk-XZSI7AHE.js +67 -0
  34. package/dist/chunk-YVVDKJ2H.js +34 -0
  35. package/dist/chunk-ZMWYLUDP.js +21 -0
  36. package/dist/content/github.d.ts +40 -0
  37. package/dist/content/github.js +44 -0
  38. package/dist/content/index.d.ts +16 -0
  39. package/dist/content/index.js +30 -0
  40. package/dist/content/mdx/preset-bundler.d.ts +31 -0
  41. package/dist/content/mdx/preset-bundler.js +72 -0
  42. package/dist/content/mdx/preset-runtime.d.ts +31 -0
  43. package/dist/content/mdx/preset-runtime.js +71 -0
  44. package/dist/content/toc.d.ts +21 -0
  45. package/dist/content/toc.js +22 -0
  46. package/dist/definitions-pJ7PybYY.d.ts +60 -0
  47. package/dist/dynamic-link.d.ts +12 -0
  48. package/dist/dynamic-link.js +32 -0
  49. package/dist/fetch-IBTWQCJR.js +22 -0
  50. package/dist/framework/index.d.ts +41 -0
  51. package/dist/framework/index.js +18 -0
  52. package/dist/framework/next.d.ts +12 -0
  53. package/dist/framework/next.js +31 -0
  54. package/dist/framework/react-router.d.ts +12 -0
  55. package/dist/framework/react-router.js +59 -0
  56. package/dist/framework/tanstack.d.ts +15 -0
  57. package/dist/framework/tanstack.js +72 -0
  58. package/dist/framework/waku.d.ts +12 -0
  59. package/dist/framework/waku.js +63 -0
  60. package/dist/highlight/client.d.ts +15 -0
  61. package/dist/highlight/client.js +18 -0
  62. package/dist/highlight/index.d.ts +30 -0
  63. package/dist/highlight/index.js +13 -0
  64. package/dist/i18n/index.d.ts +39 -0
  65. package/dist/i18n/index.js +9 -0
  66. package/dist/i18n/middleware.d.ts +34 -0
  67. package/dist/i18n/middleware.js +76 -0
  68. package/dist/link.d.ts +18 -0
  69. package/dist/link.js +9 -0
  70. package/dist/loader-BvlPPJX0.d.ts +321 -0
  71. package/dist/mdx-plugins/codeblock-utils.d.ts +29 -0
  72. package/dist/mdx-plugins/codeblock-utils.js +9 -0
  73. package/dist/mdx-plugins/index.d.ts +20 -0
  74. package/dist/mdx-plugins/index.js +73 -0
  75. package/dist/mdx-plugins/rehype-code.d.ts +55 -0
  76. package/dist/mdx-plugins/rehype-code.js +15 -0
  77. package/dist/mdx-plugins/rehype-toc.d.ts +14 -0
  78. package/dist/mdx-plugins/rehype-toc.js +7 -0
  79. package/dist/mdx-plugins/remark-admonition.d.ts +20 -0
  80. package/dist/mdx-plugins/remark-admonition.js +8 -0
  81. package/dist/mdx-plugins/remark-code-tab.d.ts +30 -0
  82. package/dist/mdx-plugins/remark-code-tab.js +8 -0
  83. package/dist/mdx-plugins/remark-directive-admonition.d.ts +27 -0
  84. package/dist/mdx-plugins/remark-directive-admonition.js +7 -0
  85. package/dist/mdx-plugins/remark-gfm.d.ts +1 -0
  86. package/dist/mdx-plugins/remark-gfm.js +7 -0
  87. package/dist/mdx-plugins/remark-heading.d.ts +31 -0
  88. package/dist/mdx-plugins/remark-heading.js +8 -0
  89. package/dist/mdx-plugins/remark-image.d.ts +57 -0
  90. package/dist/mdx-plugins/remark-image.js +7 -0
  91. package/dist/mdx-plugins/remark-mdx-files.d.ts +40 -0
  92. package/dist/mdx-plugins/remark-mdx-files.js +7 -0
  93. package/dist/mdx-plugins/remark-mdx-mermaid.d.ts +15 -0
  94. package/dist/mdx-plugins/remark-mdx-mermaid.js +7 -0
  95. package/dist/mdx-plugins/remark-npm.d.ts +31 -0
  96. package/dist/mdx-plugins/remark-npm.js +8 -0
  97. package/dist/mdx-plugins/remark-steps.d.ts +23 -0
  98. package/dist/mdx-plugins/remark-steps.js +7 -0
  99. package/dist/mdx-plugins/remark-structure.d.ts +71 -0
  100. package/dist/mdx-plugins/remark-structure.js +12 -0
  101. package/dist/mixedbread-RAHDVXGJ.js +118 -0
  102. package/dist/negotiation/index.d.ts +19 -0
  103. package/dist/negotiation/index.js +11 -0
  104. package/dist/orama-cloud-UZAPMPFV.js +93 -0
  105. package/dist/page-tree/index.d.ts +33 -0
  106. package/dist/page-tree/index.js +17 -0
  107. package/dist/search/algolia.d.ts +69 -0
  108. package/dist/search/algolia.js +71 -0
  109. package/dist/search/client.d.ts +140 -0
  110. package/dist/search/client.js +99 -0
  111. package/dist/search/index.d.ts +26 -0
  112. package/dist/search/index.js +7 -0
  113. package/dist/search/orama-cloud.d.ts +79 -0
  114. package/dist/search/orama-cloud.js +60 -0
  115. package/dist/search/server.d.ts +136 -0
  116. package/dist/search/server.js +400 -0
  117. package/dist/source/client/index.d.ts +16 -0
  118. package/dist/source/client/index.js +41 -0
  119. package/dist/source/index.d.ts +42 -0
  120. package/dist/source/index.js +776 -0
  121. package/dist/source/plugins/lucide-icons.d.ts +14 -0
  122. package/dist/source/plugins/lucide-icons.js +23 -0
  123. package/dist/source/schema.d.ts +26 -0
  124. package/dist/source/schema.js +25 -0
  125. package/dist/static-A2YJ5TXV.js +62 -0
  126. package/dist/toc.d.ts +43 -0
  127. package/dist/toc.js +151 -0
  128. package/dist/util-bZU2QeJ2.d.ts +6 -0
  129. package/dist/utils/use-effect-event.d.ts +9 -0
  130. package/dist/utils/use-effect-event.js +16 -0
  131. package/dist/utils/use-media-query.d.ts +3 -0
  132. package/dist/utils/use-media-query.js +23 -0
  133. package/dist/utils/use-on-change.d.ts +8 -0
  134. package/dist/utils/use-on-change.js +7 -0
  135. package/package.json +222 -0
@@ -0,0 +1,93 @@
1
+ import {
2
+ removeUndefined
3
+ } from "./chunk-ZMWYLUDP.js";
4
+ import {
5
+ createContentHighlighter
6
+ } from "./chunk-OTD7MV33.js";
7
+
8
+ // src/search/orama/search/simple.ts
9
+ import { search } from "@orama/orama";
10
+ async function searchSimple(db, query, params = {}) {
11
+ const highlighter = createContentHighlighter(query);
12
+ const result = await search(db, {
13
+ term: query,
14
+ tolerance: 1,
15
+ ...params,
16
+ boost: {
17
+ title: 2,
18
+ ..."boost" in params ? params.boost : void 0
19
+ }
20
+ });
21
+ return result.hits.map((hit) => ({
22
+ type: "page",
23
+ content: hit.document.title,
24
+ breadcrumbs: hit.document.breadcrumbs,
25
+ contentWithHighlights: highlighter.highlight(hit.document.title),
26
+ id: hit.document.url,
27
+ url: hit.document.url
28
+ }));
29
+ }
30
+
31
+ // src/search/orama/search/advanced.ts
32
+ import { getByID, search as search2 } from "@orama/orama";
33
+ async function searchAdvanced(db, query, tag = [], {
34
+ mode = "fulltext",
35
+ ...override
36
+ } = {}) {
37
+ if (typeof tag === "string") tag = [tag];
38
+ let params = {
39
+ ...override,
40
+ mode,
41
+ where: removeUndefined({
42
+ tags: tag.length > 0 ? {
43
+ containsAll: tag
44
+ } : void 0,
45
+ ...override.where
46
+ }),
47
+ groupBy: {
48
+ properties: ["page_id"],
49
+ maxResult: 8,
50
+ ...override.groupBy
51
+ }
52
+ };
53
+ if (query.length > 0) {
54
+ params = {
55
+ ...params,
56
+ term: query,
57
+ properties: mode === "fulltext" ? ["content"] : ["content", "embeddings"]
58
+ };
59
+ }
60
+ const highlighter = createContentHighlighter(query);
61
+ const result = await search2(db, params);
62
+ const list = [];
63
+ for (const item of result.groups ?? []) {
64
+ const pageId = item.values[0];
65
+ const page = getByID(db, pageId);
66
+ if (!page) continue;
67
+ list.push({
68
+ id: pageId,
69
+ type: "page",
70
+ content: page.content,
71
+ breadcrumbs: page.breadcrumbs,
72
+ contentWithHighlights: highlighter.highlight(page.content),
73
+ url: page.url
74
+ });
75
+ for (const hit of item.result) {
76
+ if (hit.document.type === "page") continue;
77
+ list.push({
78
+ id: hit.document.id.toString(),
79
+ content: hit.document.content,
80
+ breadcrumbs: hit.document.breadcrumbs,
81
+ contentWithHighlights: highlighter.highlight(hit.document.content),
82
+ type: hit.document.type,
83
+ url: hit.document.url
84
+ });
85
+ }
86
+ }
87
+ return list;
88
+ }
89
+
90
+ export {
91
+ searchSimple,
92
+ searchAdvanced
93
+ };
@@ -0,0 +1,67 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-U67V476Y.js";
4
+
5
+ // src/source/path.ts
6
+ var path_exports = {};
7
+ __export(path_exports, {
8
+ basename: () => basename,
9
+ dirname: () => dirname,
10
+ extname: () => extname,
11
+ joinPath: () => joinPath,
12
+ slash: () => slash,
13
+ splitPath: () => splitPath
14
+ });
15
+ function basename(path, ext) {
16
+ const idx = path.lastIndexOf("/");
17
+ return path.substring(
18
+ idx === -1 ? 0 : idx + 1,
19
+ ext ? path.length - ext.length : path.length
20
+ );
21
+ }
22
+ function extname(path) {
23
+ const dotIdx = path.lastIndexOf(".");
24
+ if (dotIdx !== -1) {
25
+ return path.substring(dotIdx);
26
+ }
27
+ return "";
28
+ }
29
+ function dirname(path) {
30
+ return path.split("/").slice(0, -1).join("/");
31
+ }
32
+ function splitPath(path) {
33
+ return path.split("/").filter((p) => p.length > 0);
34
+ }
35
+ function joinPath(...paths) {
36
+ const out = [];
37
+ const parsed = paths.flatMap(splitPath);
38
+ for (const seg of parsed) {
39
+ switch (seg) {
40
+ case "..":
41
+ out.pop();
42
+ break;
43
+ case ".":
44
+ break;
45
+ default:
46
+ out.push(seg);
47
+ }
48
+ }
49
+ return out.join("/");
50
+ }
51
+ function slash(path) {
52
+ const isExtendedLengthPath = path.startsWith("\\\\?\\");
53
+ if (isExtendedLengthPath) {
54
+ return path;
55
+ }
56
+ return path.replaceAll("\\", "/");
57
+ }
58
+
59
+ export {
60
+ basename,
61
+ extname,
62
+ dirname,
63
+ splitPath,
64
+ joinPath,
65
+ slash,
66
+ path_exports
67
+ };
@@ -0,0 +1,34 @@
1
+ // src/negotiation/index.ts
2
+ import Negotiator from "negotiator";
3
+ import { compile, match } from "path-to-regexp";
4
+ function getNegotiator(request) {
5
+ const headers = {};
6
+ request.headers.forEach((value, key) => {
7
+ headers[key] = value;
8
+ });
9
+ return new Negotiator({ headers });
10
+ }
11
+ function rewritePath(source, destination) {
12
+ const matcher = match(source, { decode: false });
13
+ const compiler = compile(destination, { encode: false });
14
+ return {
15
+ rewrite(pathname) {
16
+ const result = matcher(pathname);
17
+ if (!result) return false;
18
+ return compiler(result.params);
19
+ }
20
+ };
21
+ }
22
+ function isMarkdownPreferred(request, options) {
23
+ const {
24
+ markdownMediaTypes = ["text/plain", "text/markdown", "text/x-markdown"]
25
+ } = options ?? {};
26
+ const mediaTypes = getNegotiator(request).mediaTypes();
27
+ return markdownMediaTypes.some((type) => mediaTypes.includes(type));
28
+ }
29
+
30
+ export {
31
+ getNegotiator,
32
+ rewritePath,
33
+ isMarkdownPreferred
34
+ };
@@ -0,0 +1,21 @@
1
+ // src/utils/remove-undefined.ts
2
+ function removeUndefined(value, deep = false) {
3
+ const obj = value;
4
+ for (const key in obj) {
5
+ if (obj[key] === void 0) delete obj[key];
6
+ if (!deep) continue;
7
+ const entry = obj[key];
8
+ if (typeof entry === "object" && entry !== null) {
9
+ removeUndefined(entry, deep);
10
+ continue;
11
+ }
12
+ if (Array.isArray(entry)) {
13
+ for (const item of entry) removeUndefined(item, deep);
14
+ }
15
+ }
16
+ return value;
17
+ }
18
+
19
+ export {
20
+ removeUndefined
21
+ };
@@ -0,0 +1,40 @@
1
+ interface GetGithubLastCommitOptions {
2
+ /**
3
+ * Repository name, like "fumadocs"
4
+ */
5
+ repo: string;
6
+ /** Owner of repository */
7
+ owner: string;
8
+ /**
9
+ * Path to file
10
+ */
11
+ path: string;
12
+ /**
13
+ * GitHub access token
14
+ */
15
+ token?: string;
16
+ /**
17
+ * SHA or ref (branch or tag) name.
18
+ */
19
+ sha?: string;
20
+ /**
21
+ * Base URL for GitHub API
22
+ * @default "https://api.github.com"
23
+ * @link https://docs.github.com/en/get-started/using-github-docs/about-versions-of-github-docs#determining-which-github-product-you-use
24
+ */
25
+ baseUrl?: string;
26
+ /**
27
+ * Custom query parameters
28
+ */
29
+ params?: Record<string, string>;
30
+ options?: RequestInit;
31
+ }
32
+ /**
33
+ * Get the last edit time of a file using GitHub API
34
+ *
35
+ * By default, this will cache the result forever.
36
+ * Set `options.next.revalidate` to customise this.
37
+ */
38
+ declare function getGithubLastEdit({ repo, token, owner, path, sha, baseUrl, options, params: customParams, }: GetGithubLastCommitOptions): Promise<Date | null>;
39
+
40
+ export { type GetGithubLastCommitOptions, getGithubLastEdit };
@@ -0,0 +1,44 @@
1
+ import "../chunk-U67V476Y.js";
2
+
3
+ // src/content/github.ts
4
+ async function getGithubLastEdit({
5
+ repo,
6
+ token,
7
+ owner,
8
+ path,
9
+ sha,
10
+ baseUrl = "https://api.github.com",
11
+ options = {},
12
+ params: customParams = {}
13
+ }) {
14
+ const headers = new Headers(options.headers);
15
+ const params = new URLSearchParams();
16
+ params.set("path", path);
17
+ params.set("page", "1");
18
+ params.set("per_page", "1");
19
+ if (sha) params.set("sha", sha);
20
+ for (const [key, value] of Object.entries(customParams)) {
21
+ params.set(key, value);
22
+ }
23
+ if (token) {
24
+ headers.append("authorization", token);
25
+ }
26
+ const res = await fetch(
27
+ `${baseUrl}/repos/${owner}/${repo}/commits?${params.toString()}`,
28
+ {
29
+ cache: "force-cache",
30
+ ...options,
31
+ headers
32
+ }
33
+ );
34
+ if (!res.ok)
35
+ throw new Error(
36
+ `Failed to fetch last edit time from Git ${await res.text()}`
37
+ );
38
+ const data = await res.json();
39
+ if (data.length === 0) return null;
40
+ return new Date(data[0].commit.committer.date);
41
+ }
42
+ export {
43
+ getGithubLastEdit
44
+ };
@@ -0,0 +1,16 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { Compatible } from 'vfile';
4
+ import { Components } from 'hast-util-to-jsx-runtime';
5
+ import { PluggableList } from 'unified';
6
+
7
+ interface MarkdownProps {
8
+ components?: Components;
9
+ }
10
+ declare function Markdown({ children: content, remarkPlugins, rehypePlugins, ...options }: MarkdownProps & {
11
+ remarkPlugins?: PluggableList;
12
+ rehypePlugins?: PluggableList;
13
+ children: Compatible;
14
+ }): Promise<react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | (string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined)>;
15
+
16
+ export { Markdown, type MarkdownProps };
@@ -0,0 +1,30 @@
1
+ import "../chunk-U67V476Y.js";
2
+
3
+ // src/content/index.ts
4
+ import { remark } from "remark";
5
+ import remarkGfm from "remark-gfm";
6
+ import remarkRehype from "remark-rehype";
7
+ import { toJsxRuntime } from "hast-util-to-jsx-runtime";
8
+ import * as JsxRuntime from "react/jsx-runtime";
9
+ function rehypeReact(options = {}) {
10
+ this.compiler = (tree, file) => {
11
+ return toJsxRuntime(tree, {
12
+ development: false,
13
+ filePath: file.path,
14
+ ...JsxRuntime,
15
+ ...options
16
+ });
17
+ };
18
+ }
19
+ async function Markdown({
20
+ children: content,
21
+ remarkPlugins = [],
22
+ rehypePlugins = [],
23
+ ...options
24
+ }) {
25
+ const processor = remark().use(remarkGfm).use(remarkPlugins).use(remarkRehype).use(rehypePlugins).use(rehypeReact, options);
26
+ return (await processor.process(content)).result;
27
+ }
28
+ export {
29
+ Markdown
30
+ };
@@ -0,0 +1,31 @@
1
+ import { ProcessorOptions } from '@mdx-js/mdx';
2
+ import { RehypeCodeOptions } from '../../mdx-plugins/rehype-code.js';
3
+ import { RemarkImageOptions } from '../../mdx-plugins/remark-image.js';
4
+ import { StructureOptions } from '../../mdx-plugins/remark-structure.js';
5
+ import { RemarkHeadingOptions } from '../../mdx-plugins/remark-heading.js';
6
+ import { RemarkCodeTabOptions } from '../../mdx-plugins/remark-code-tab.js';
7
+ import { RemarkNpmOptions } from '../../mdx-plugins/remark-npm.js';
8
+ import { R as ResolvePlugins } from '../../util-bZU2QeJ2.js';
9
+ import 'hast';
10
+ import '@shikijs/rehype';
11
+ import 'unified';
12
+ import 'shiki';
13
+ import 'mdast';
14
+ import 'mdast-util-mdx-jsx';
15
+
16
+ type MDXBundlerPresetOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins'> & {
17
+ rehypePlugins?: ResolvePlugins;
18
+ remarkPlugins?: ResolvePlugins;
19
+ remarkStructureOptions?: StructureOptions | false;
20
+ remarkHeadingOptions?: RemarkHeadingOptions;
21
+ remarkImageOptions?: RemarkImageOptions | false;
22
+ remarkCodeTabOptions?: RemarkCodeTabOptions | false;
23
+ remarkNpmOptions?: RemarkNpmOptions | false;
24
+ rehypeCodeOptions?: RehypeCodeOptions | false;
25
+ };
26
+ /**
27
+ * apply MDX processor presets
28
+ */
29
+ declare function mdxPreset(options?: MDXBundlerPresetOptions): Promise<ProcessorOptions>;
30
+
31
+ export { type MDXBundlerPresetOptions, mdxPreset };
@@ -0,0 +1,72 @@
1
+ import {
2
+ resolvePlugins
3
+ } from "../../chunk-GINBKBVQ.js";
4
+ import "../../chunk-U67V476Y.js";
5
+
6
+ // src/content/mdx/preset-bundler.ts
7
+ async function mdxPreset(options = {}) {
8
+ const {
9
+ rehypeCodeOptions,
10
+ remarkImageOptions,
11
+ remarkHeadingOptions,
12
+ remarkStructureOptions,
13
+ remarkCodeTabOptions,
14
+ remarkNpmOptions,
15
+ ...mdxOptions
16
+ } = options;
17
+ const remarkPlugins = await resolvePlugins(
18
+ (v) => [
19
+ import("remark-gfm").then((mod) => mod.default),
20
+ import("../../mdx-plugins/remark-heading.js").then((mod) => [
21
+ mod.remarkHeading,
22
+ {
23
+ generateToc: false,
24
+ ...remarkHeadingOptions
25
+ }
26
+ ]),
27
+ remarkImageOptions !== false && import("../../mdx-plugins/remark-image.js").then((mod) => [
28
+ mod.remarkImage,
29
+ {
30
+ ...remarkImageOptions,
31
+ useImport: remarkImageOptions?.useImport ?? true
32
+ }
33
+ ]),
34
+ remarkCodeTabOptions !== false && import("../../mdx-plugins/remark-code-tab.js").then((mod) => [
35
+ mod.remarkCodeTab,
36
+ remarkCodeTabOptions
37
+ ]),
38
+ remarkNpmOptions !== false && import("../../mdx-plugins/remark-npm.js").then((mod) => [
39
+ mod.remarkNpm,
40
+ remarkNpmOptions
41
+ ]),
42
+ ...v,
43
+ remarkStructureOptions !== false && import("../../mdx-plugins/remark-structure.js").then((mod) => [
44
+ mod.remarkStructure,
45
+ {
46
+ exportAs: "structuredData",
47
+ ...remarkStructureOptions
48
+ }
49
+ ])
50
+ ],
51
+ mdxOptions.remarkPlugins
52
+ );
53
+ const rehypePlugins = await resolvePlugins(
54
+ (v) => [
55
+ rehypeCodeOptions !== false && import("../../mdx-plugins/rehype-code.js").then((mod) => [
56
+ mod.rehypeCode,
57
+ rehypeCodeOptions
58
+ ]),
59
+ ...v,
60
+ import("../../mdx-plugins/rehype-toc.js").then((mod) => mod.rehypeToc)
61
+ ],
62
+ mdxOptions.rehypePlugins
63
+ );
64
+ return {
65
+ ...mdxOptions,
66
+ remarkPlugins,
67
+ rehypePlugins
68
+ };
69
+ }
70
+ export {
71
+ mdxPreset
72
+ };
@@ -0,0 +1,31 @@
1
+ import { ProcessorOptions } from '@mdx-js/mdx';
2
+ import { RehypeCodeOptions } from '../../mdx-plugins/rehype-code.js';
3
+ import { RemarkImageOptions } from '../../mdx-plugins/remark-image.js';
4
+ import { StructureOptions } from '../../mdx-plugins/remark-structure.js';
5
+ import { RemarkHeadingOptions } from '../../mdx-plugins/remark-heading.js';
6
+ import { RemarkCodeTabOptions } from '../../mdx-plugins/remark-code-tab.js';
7
+ import { RemarkNpmOptions } from '../../mdx-plugins/remark-npm.js';
8
+ import { R as ResolvePlugins } from '../../util-bZU2QeJ2.js';
9
+ import 'hast';
10
+ import '@shikijs/rehype';
11
+ import 'unified';
12
+ import 'shiki';
13
+ import 'mdast';
14
+ import 'mdast-util-mdx-jsx';
15
+
16
+ type MDXRuntimePresetOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins'> & {
17
+ rehypePlugins?: ResolvePlugins;
18
+ remarkPlugins?: ResolvePlugins;
19
+ remarkStructureOptions?: StructureOptions | false;
20
+ remarkHeadingOptions?: RemarkHeadingOptions;
21
+ remarkImageOptions?: RemarkImageOptions | false;
22
+ remarkCodeTabOptions?: RemarkCodeTabOptions | false;
23
+ remarkNpmOptions?: RemarkNpmOptions | false;
24
+ rehypeCodeOptions?: RehypeCodeOptions | false;
25
+ };
26
+ /**
27
+ * apply MDX processor presets
28
+ */
29
+ declare function mdxPreset(options?: MDXRuntimePresetOptions): Promise<ProcessorOptions>;
30
+
31
+ export { type MDXRuntimePresetOptions, mdxPreset };
@@ -0,0 +1,71 @@
1
+ import {
2
+ resolvePlugins
3
+ } from "../../chunk-GINBKBVQ.js";
4
+ import "../../chunk-U67V476Y.js";
5
+
6
+ // src/content/mdx/preset-runtime.ts
7
+ async function mdxPreset(options = {}) {
8
+ const {
9
+ rehypeCodeOptions,
10
+ remarkImageOptions,
11
+ remarkHeadingOptions,
12
+ remarkStructureOptions,
13
+ remarkCodeTabOptions,
14
+ remarkNpmOptions,
15
+ outputFormat = "function-body",
16
+ ...mdxOptions
17
+ } = options;
18
+ const remarkPlugins = await resolvePlugins(
19
+ (v) => [
20
+ import("remark-gfm").then((mod) => mod.default),
21
+ import("../../mdx-plugins/remark-heading.js").then((mod) => [
22
+ mod.remarkHeading,
23
+ {
24
+ generateToc: false,
25
+ ...remarkHeadingOptions
26
+ }
27
+ ]),
28
+ remarkImageOptions !== false && import("../../mdx-plugins/remark-image.js").then((mod) => [
29
+ mod.remarkImage,
30
+ remarkImageOptions
31
+ ]),
32
+ remarkCodeTabOptions !== false && import("../../mdx-plugins/remark-code-tab.js").then((mod) => [
33
+ mod.remarkCodeTab,
34
+ remarkCodeTabOptions
35
+ ]),
36
+ remarkNpmOptions !== false && import("../../mdx-plugins/remark-npm.js").then((mod) => [
37
+ mod.remarkNpm,
38
+ remarkNpmOptions
39
+ ]),
40
+ ...v,
41
+ remarkStructureOptions !== false && import("../../mdx-plugins/remark-structure.js").then((mod) => [
42
+ mod.remarkStructure,
43
+ {
44
+ exportAs: "structuredData",
45
+ ...remarkStructureOptions
46
+ }
47
+ ])
48
+ ],
49
+ mdxOptions.remarkPlugins
50
+ );
51
+ const rehypePlugins = await resolvePlugins(
52
+ (v) => [
53
+ rehypeCodeOptions !== false && import("../../mdx-plugins/rehype-code.js").then((mod) => [
54
+ mod.rehypeCode,
55
+ rehypeCodeOptions
56
+ ]),
57
+ ...v,
58
+ import("../../mdx-plugins/rehype-toc.js").then((mod) => mod.rehypeToc)
59
+ ],
60
+ mdxOptions.rehypePlugins
61
+ );
62
+ return {
63
+ ...mdxOptions,
64
+ outputFormat,
65
+ remarkPlugins,
66
+ rehypePlugins
67
+ };
68
+ }
69
+ export {
70
+ mdxPreset
71
+ };
@@ -0,0 +1,21 @@
1
+ import { PluggableList } from 'unified';
2
+ import { Compatible } from 'vfile';
3
+ import { TOCItemType } from '../toc.js';
4
+ import 'react/jsx-runtime';
5
+ import 'react';
6
+
7
+ /**
8
+ * Get Table of Contents from markdown/mdx document (using remark)
9
+ *
10
+ * @param content - Markdown content or file
11
+ */
12
+ declare function getTableOfContents(content: Compatible): TOCItemType[];
13
+ /**
14
+ * Get Table of Contents from markdown/mdx document (using remark)
15
+ *
16
+ * @param content - Markdown content or file
17
+ * @param remarkPlugins - remark plugins to be applied first
18
+ */
19
+ declare function getTableOfContents(content: Compatible, remarkPlugins: PluggableList): Promise<TOCItemType[]>;
20
+
21
+ export { getTableOfContents };
@@ -0,0 +1,22 @@
1
+ import {
2
+ remarkHeading
3
+ } from "../chunk-MA6O2UUE.js";
4
+ import "../chunk-VLSDGCJE.js";
5
+ import "../chunk-U67V476Y.js";
6
+
7
+ // src/content/toc.ts
8
+ import { remark } from "remark";
9
+ function getTableOfContents(content, remarkPlugins) {
10
+ if (remarkPlugins) {
11
+ return remark().use(remarkPlugins).use(remarkHeading).process(content).then((result2) => {
12
+ if ("toc" in result2.data) return result2.data.toc;
13
+ return [];
14
+ });
15
+ }
16
+ const result = remark().use(remarkHeading).processSync(content);
17
+ if ("toc" in result.data) return result.data.toc;
18
+ return [];
19
+ }
20
+ export {
21
+ getTableOfContents
22
+ };
@@ -0,0 +1,60 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ interface ID {
4
+ /**
5
+ * ID for the node, unique in all page trees (even across different locales)
6
+ */
7
+ $id?: string;
8
+ }
9
+ interface Root extends ID {
10
+ name: ReactNode;
11
+ children: Node[];
12
+ /**
13
+ * Another page tree that won't be displayed unless being opened.
14
+ */
15
+ fallback?: Root;
16
+ }
17
+ type Node = Item | Separator | Folder;
18
+ interface Item extends ID {
19
+ /**
20
+ * @internal
21
+ */
22
+ $ref?: {
23
+ file: string;
24
+ };
25
+ type: 'page';
26
+ name: ReactNode;
27
+ url: string;
28
+ /**
29
+ * Whether the link should be treated as external (e.g. use HTML <a> tag).
30
+ *
31
+ * When unspecified, it depends on the value of `url`.
32
+ */
33
+ external?: boolean;
34
+ description?: ReactNode;
35
+ icon?: ReactNode;
36
+ }
37
+ interface Separator extends ID {
38
+ type: 'separator';
39
+ name?: ReactNode;
40
+ icon?: ReactNode;
41
+ }
42
+ interface Folder extends ID {
43
+ /**
44
+ * @internal
45
+ */
46
+ $ref?: {
47
+ metaFile?: string;
48
+ };
49
+ type: 'folder';
50
+ name: ReactNode;
51
+ description?: ReactNode;
52
+ root?: boolean;
53
+ defaultOpen?: boolean;
54
+ collapsible?: boolean;
55
+ index?: Item;
56
+ icon?: ReactNode;
57
+ children: Node[];
58
+ }
59
+
60
+ export type { Folder as F, Item as I, Node as N, Root as R, Separator as S };
@@ -0,0 +1,12 @@
1
+ import * as react from 'react';
2
+ import { LinkProps } from './link.js';
3
+
4
+ type DynamicLinkProps = LinkProps;
5
+ /**
6
+ * Extends the default `Link` component
7
+ *
8
+ * It supports dynamic hrefs, which means you can use `/[lang]/my-page` with `dynamicHrefs` enabled
9
+ */
10
+ declare const DynamicLink: react.ForwardRefExoticComponent<LinkProps & react.RefAttributes<HTMLAnchorElement>>;
11
+
12
+ export { DynamicLink, type DynamicLinkProps, DynamicLink as default };