@depup/nextra 4.6.1-depup.0
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/LICENSE +21 -0
- package/README.md +56 -0
- package/changes.json +110 -0
- package/dist/client/components/banner/close-banner-button.d.ts +8 -0
- package/dist/client/components/banner/close-banner-button.js +45 -0
- package/dist/client/components/banner/index.client.d.ts +5 -0
- package/dist/client/components/banner/index.client.js +46 -0
- package/dist/client/components/banner/index.d.ts +51 -0
- package/dist/client/components/banner/index.js +93 -0
- package/dist/client/components/bleed.d.ts +63 -0
- package/dist/client/components/bleed.js +54 -0
- package/dist/client/components/button.d.ts +9 -0
- package/dist/client/components/button.js +55 -0
- package/dist/client/components/callout.d.ts +136 -0
- package/dist/client/components/callout.js +99 -0
- package/dist/client/components/cards.d.ts +104 -0
- package/dist/client/components/cards.js +132 -0
- package/dist/client/components/collapse.d.ts +12 -0
- package/dist/client/components/collapse.js +143 -0
- package/dist/client/components/file-tree/file.d.ts +9 -0
- package/dist/client/components/file-tree/file.js +43 -0
- package/dist/client/components/file-tree/folder.d.ts +12 -0
- package/dist/client/components/file-tree/folder.js +94 -0
- package/dist/client/components/file-tree/index.d.ts +57 -0
- package/dist/client/components/file-tree/index.js +12 -0
- package/dist/client/components/file-tree/tree.d.ts +5 -0
- package/dist/client/components/file-tree/tree.js +41 -0
- package/dist/client/components/head.d.ts +139 -0
- package/dist/client/components/head.js +202 -0
- package/dist/client/components/image-zoom.d.ts +6 -0
- package/dist/client/components/image-zoom.js +79 -0
- package/dist/client/components/index.d.ts +56 -0
- package/dist/client/components/index.js +42 -0
- package/dist/client/components/playground.d.ts +90 -0
- package/dist/client/components/playground.js +103 -0
- package/dist/client/components/popup/index.client.d.ts +7 -0
- package/dist/client/components/popup/index.client.js +83 -0
- package/dist/client/components/popup/index.d.ts +12 -0
- package/dist/client/components/popup/index.js +11 -0
- package/dist/client/components/search.d.ts +88 -0
- package/dist/client/components/search.js +426 -0
- package/dist/client/components/select.d.ts +19 -0
- package/dist/client/components/select.js +109 -0
- package/dist/client/components/skip-nav/index.client.d.ts +5 -0
- package/dist/client/components/skip-nav/index.client.js +45 -0
- package/dist/client/components/skip-nav/index.d.ts +6 -0
- package/dist/client/components/skip-nav/index.js +24 -0
- package/dist/client/components/steps.d.ts +64 -0
- package/dist/client/components/steps.js +74 -0
- package/dist/client/components/tabs/index.client.d.ts +21 -0
- package/dist/client/components/tabs/index.client.js +243 -0
- package/dist/client/components/tabs/index.d.ts +53 -0
- package/dist/client/components/tabs/index.js +9 -0
- package/dist/client/evaluate.d.ts +30 -0
- package/dist/client/evaluate.js +17 -0
- package/dist/client/hocs/index.d.ts +4 -0
- package/dist/client/hocs/index.js +6 -0
- package/dist/client/hocs/with-github-alert.d.ts +11 -0
- package/dist/client/hocs/with-github-alert.js +30 -0
- package/dist/client/hocs/with-icons.d.ts +6 -0
- package/dist/client/hocs/with-icons.js +76 -0
- package/dist/client/hooks/index.d.ts +4 -0
- package/dist/client/hooks/index.js +10 -0
- package/dist/client/hooks/use-copy.d.ts +9 -0
- package/dist/client/hooks/use-copy.js +77 -0
- package/dist/client/hooks/use-fs-route.d.ts +3 -0
- package/dist/client/hooks/use-fs-route.js +20 -0
- package/dist/client/hooks/use-hash.d.ts +3 -0
- package/dist/client/hooks/use-hash.js +20 -0
- package/dist/client/hooks/use-mounted.d.ts +3 -0
- package/dist/client/hooks/use-mounted.js +13 -0
- package/dist/client/icons/arrow-right.d.ts +5 -0
- package/dist/client/icons/arrow-right.js +24 -0
- package/dist/client/icons/chatgpt.d.ts +2 -0
- package/dist/client/icons/chatgpt.js +24 -0
- package/dist/client/icons/check.d.ts +2 -0
- package/dist/client/icons/check.js +24 -0
- package/dist/client/icons/claude.d.ts +2 -0
- package/dist/client/icons/claude.js +81 -0
- package/dist/client/icons/copy.d.ts +2 -0
- package/dist/client/icons/copy.js +31 -0
- package/dist/client/icons/cpp.d.ts +2 -0
- package/dist/client/icons/cpp.js +24 -0
- package/dist/client/icons/cross-circled.d.ts +2 -0
- package/dist/client/icons/cross-circled.js +24 -0
- package/dist/client/icons/csharp.d.ts +2 -0
- package/dist/client/icons/csharp.js +24 -0
- package/dist/client/icons/css.d.ts +2 -0
- package/dist/client/icons/css.js +24 -0
- package/dist/client/icons/discord.d.ts +2 -0
- package/dist/client/icons/discord.js +24 -0
- package/dist/client/icons/expand.d.ts +2 -0
- package/dist/client/icons/expand.js +31 -0
- package/dist/client/icons/file.d.ts +2 -0
- package/dist/client/icons/file.js +24 -0
- package/dist/client/icons/folder-open.d.ts +2 -0
- package/dist/client/icons/folder-open.js +24 -0
- package/dist/client/icons/folder.d.ts +2 -0
- package/dist/client/icons/folder.js +24 -0
- package/dist/client/icons/github-caution.d.ts +2 -0
- package/dist/client/icons/github-caution.js +24 -0
- package/dist/client/icons/github-important.d.ts +2 -0
- package/dist/client/icons/github-important.js +24 -0
- package/dist/client/icons/github-note.d.ts +2 -0
- package/dist/client/icons/github-note.js +24 -0
- package/dist/client/icons/github-tip.d.ts +2 -0
- package/dist/client/icons/github-tip.js +24 -0
- package/dist/client/icons/github-warning.d.ts +2 -0
- package/dist/client/icons/github-warning.js +24 -0
- package/dist/client/icons/github.d.ts +2 -0
- package/dist/client/icons/github.js +24 -0
- package/dist/client/icons/globe.d.ts +2 -0
- package/dist/client/icons/globe.js +24 -0
- package/dist/client/icons/go.d.ts +2 -0
- package/dist/client/icons/go.js +46 -0
- package/dist/client/icons/graphql.d.ts +2 -0
- package/dist/client/icons/graphql.js +56 -0
- package/dist/client/icons/index.d.ts +2 -0
- package/dist/client/icons/index.js +92 -0
- package/dist/client/icons/javascript.d.ts +2 -0
- package/dist/client/icons/javascript.js +24 -0
- package/dist/client/icons/json.d.ts +2 -0
- package/dist/client/icons/json.js +41 -0
- package/dist/client/icons/link-arrow.d.ts +2 -0
- package/dist/client/icons/link-arrow.js +31 -0
- package/dist/client/icons/link.d.ts +2 -0
- package/dist/client/icons/link.js +24 -0
- package/dist/client/icons/markdown.d.ts +2 -0
- package/dist/client/icons/markdown.js +24 -0
- package/dist/client/icons/mdx.d.ts +2 -0
- package/dist/client/icons/mdx.js +24 -0
- package/dist/client/icons/menu.d.ts +2 -0
- package/dist/client/icons/menu.js +36 -0
- package/dist/client/icons/moon.d.ts +2 -0
- package/dist/client/icons/moon.js +24 -0
- package/dist/client/icons/move.d.ts +2 -0
- package/dist/client/icons/move.js +24 -0
- package/dist/client/icons/python.d.ts +2 -0
- package/dist/client/icons/python.js +31 -0
- package/dist/client/icons/react.d.ts +2 -0
- package/dist/client/icons/react.js +38 -0
- package/dist/client/icons/rust.d.ts +2 -0
- package/dist/client/icons/rust.js +31 -0
- package/dist/client/icons/spinner.d.ts +2 -0
- package/dist/client/icons/spinner.js +31 -0
- package/dist/client/icons/sun.d.ts +2 -0
- package/dist/client/icons/sun.js +24 -0
- package/dist/client/icons/svelte.d.ts +2 -0
- package/dist/client/icons/svelte.js +31 -0
- package/dist/client/icons/terminal.d.ts +2 -0
- package/dist/client/icons/terminal.js +24 -0
- package/dist/client/icons/terraform.d.ts +2 -0
- package/dist/client/icons/terraform.js +24 -0
- package/dist/client/icons/typescript.d.ts +2 -0
- package/dist/client/icons/typescript.js +24 -0
- package/dist/client/icons/word-wrap.d.ts +2 -0
- package/dist/client/icons/word-wrap.js +24 -0
- package/dist/client/icons/x.d.ts +2 -0
- package/dist/client/icons/x.js +24 -0
- package/dist/client/mdx-components/anchor.d.ts +10 -0
- package/dist/client/mdx-components/anchor.js +109 -0
- package/dist/client/mdx-components/code.d.ts +7 -0
- package/dist/client/mdx-components/code.js +52 -0
- package/dist/client/mdx-components/details.d.ts +5 -0
- package/dist/client/mdx-components/details.js +166 -0
- package/dist/client/mdx-components/image.d.ts +28 -0
- package/dist/client/mdx-components/image.js +39 -0
- package/dist/client/mdx-components/index.d.ts +11 -0
- package/dist/client/mdx-components/index.js +16 -0
- package/dist/client/mdx-components/pre/copy-to-clipboard.d.ts +5 -0
- package/dist/client/mdx-components/pre/copy-to-clipboard.js +49 -0
- package/dist/client/mdx-components/pre/index.d.ts +16 -0
- package/dist/client/mdx-components/pre/index.js +156 -0
- package/dist/client/mdx-components/pre/toggle-word-wrap-button.d.ts +7 -0
- package/dist/client/mdx-components/pre/toggle-word-wrap-button.js +31 -0
- package/dist/client/mdx-components/summary.d.ts +5 -0
- package/dist/client/mdx-components/summary.js +80 -0
- package/dist/client/mdx-components/table.d.ts +57 -0
- package/dist/client/mdx-components/table.js +95 -0
- package/dist/client/mdx-components.d.ts +89 -0
- package/dist/client/mdx-components.js +15 -0
- package/dist/client/mdx-remote.d.ts +62 -0
- package/dist/client/mdx-remote.js +36 -0
- package/dist/client/normalize-pages.d.ts +84 -0
- package/dist/client/normalize-pages.js +232 -0
- package/dist/client/package.json +1 -0
- package/dist/client/pages.d.ts +131 -0
- package/dist/client/pages.js +39 -0
- package/dist/client/remove-links.d.ts +6 -0
- package/dist/client/remove-links.js +35 -0
- package/dist/client/setup-page.d.ts +18 -0
- package/dist/client/setup-page.js +14 -0
- package/dist/server/compile-metadata.d.ts +12 -0
- package/dist/server/compile-metadata.js +39 -0
- package/dist/server/compile.d.ts +39 -0
- package/dist/server/compile.js +158 -0
- package/dist/server/constants.d.ts +15 -0
- package/dist/server/constants.js +22 -0
- package/dist/server/fetch-filepaths-from-github.d.ts +10 -0
- package/dist/server/fetch-filepaths-from-github.js +36 -0
- package/dist/server/index.d.ts +39 -0
- package/dist/server/index.js +203 -0
- package/dist/server/loader.d.ts +18 -0
- package/dist/server/loader.js +155 -0
- package/dist/server/locales.d.ts +22 -0
- package/dist/server/locales.js +38 -0
- package/dist/server/page-map/find-meta-and-page-file-paths.d.ts +8 -0
- package/dist/server/page-map/find-meta-and-page-file-paths.js +32 -0
- package/dist/server/page-map/get.d.ts +50 -0
- package/dist/server/page-map/get.js +28 -0
- package/dist/server/page-map/index-page.d.ts +21 -0
- package/dist/server/page-map/index-page.js +57 -0
- package/dist/server/page-map/index.d.ts +26 -0
- package/dist/server/page-map/index.js +24 -0
- package/dist/server/page-map/merge-meta-with-page-map.d.ts +17 -0
- package/dist/server/page-map/merge-meta-with-page-map.js +74 -0
- package/dist/server/page-map/normalize.d.ts +17 -0
- package/dist/server/page-map/normalize.js +122 -0
- package/dist/server/page-map/placeholder.d.ts +2 -0
- package/dist/server/page-map/placeholder.js +0 -0
- package/dist/server/page-map/to-ast.d.ts +18 -0
- package/dist/server/page-map/to-ast.js +47 -0
- package/dist/server/page-map/to-js.d.ts +21 -0
- package/dist/server/page-map/to-js.js +72 -0
- package/dist/server/page-map/to-page-map.d.ts +26 -0
- package/dist/server/page-map/to-page-map.js +101 -0
- package/dist/server/recma-plugins/index.d.ts +3 -0
- package/dist/server/recma-plugins/index.js +4 -0
- package/dist/server/recma-plugins/recma-rewrite.d.ts +11 -0
- package/dist/server/recma-plugins/recma-rewrite.js +98 -0
- package/dist/server/rehype-plugins/index.d.ts +18 -0
- package/dist/server/rehype-plugins/index.js +16 -0
- package/dist/server/rehype-plugins/rehype-better-react-mathjax.d.ts +24 -0
- package/dist/server/rehype-plugins/rehype-better-react-mathjax.js +96 -0
- package/dist/server/rehype-plugins/rehype-extract-toc-content.d.ts +6 -0
- package/dist/server/rehype-plugins/rehype-extract-toc-content.js +119 -0
- package/dist/server/rehype-plugins/rehype-twoslash-popup.d.ts +6 -0
- package/dist/server/rehype-plugins/rehype-twoslash-popup.js +50 -0
- package/dist/server/rehype-plugins/rehype.d.ts +21 -0
- package/dist/server/rehype-plugins/rehype.js +84 -0
- package/dist/server/remark-plugins/index.d.ts +15 -0
- package/dist/server/remark-plugins/index.js +26 -0
- package/dist/server/remark-plugins/remark-assign-frontmatter.d.ts +10 -0
- package/dist/server/remark-plugins/remark-assign-frontmatter.js +24 -0
- package/dist/server/remark-plugins/remark-custom-heading-id.d.ts +9 -0
- package/dist/server/remark-plugins/remark-custom-heading-id.js +18 -0
- package/dist/server/remark-plugins/remark-export-only-metadata.d.ts +6 -0
- package/dist/server/remark-plugins/remark-export-only-metadata.js +18 -0
- package/dist/server/remark-plugins/remark-export-source-code.d.ts +6 -0
- package/dist/server/remark-plugins/remark-export-source-code.js +35 -0
- package/dist/server/remark-plugins/remark-headings.d.ts +12 -0
- package/dist/server/remark-plugins/remark-headings.js +133 -0
- package/dist/server/remark-plugins/remark-link-rewrite.d.ts +11 -0
- package/dist/server/remark-plugins/remark-link-rewrite.js +12 -0
- package/dist/server/remark-plugins/remark-mdx-disable-explicit-jsx.d.ts +10 -0
- package/dist/server/remark-plugins/remark-mdx-disable-explicit-jsx.js +10 -0
- package/dist/server/remark-plugins/remark-mdx-frontmatter.d.ts +6 -0
- package/dist/server/remark-plugins/remark-mdx-frontmatter.js +37 -0
- package/dist/server/remark-plugins/remark-mdx-title.d.ts +10 -0
- package/dist/server/remark-plugins/remark-mdx-title.js +53 -0
- package/dist/server/remark-plugins/remark-remove-imports.d.ts +6 -0
- package/dist/server/remark-plugins/remark-remove-imports.js +12 -0
- package/dist/server/remark-plugins/remark-static-image.d.ts +6 -0
- package/dist/server/remark-plugins/remark-static-image.js +107 -0
- package/dist/server/schemas.d.ts +352 -0
- package/dist/server/schemas.js +240 -0
- package/dist/server/tsdoc/base.d.ts +38 -0
- package/dist/server/tsdoc/base.js +284 -0
- package/dist/server/tsdoc/index.d.ts +6 -0
- package/dist/server/tsdoc/index.js +10 -0
- package/dist/server/tsdoc/tsdoc.d.ts +102 -0
- package/dist/server/tsdoc/tsdoc.js +262 -0
- package/dist/server/tsdoc/types.d.ts +64 -0
- package/dist/server/tsdoc/types.js +0 -0
- package/dist/server/tsdoc/zod-to-ts.d.ts +5 -0
- package/dist/server/tsdoc/zod-to-ts.js +107 -0
- package/dist/server/twoslash.d.ts +6 -0
- package/dist/server/twoslash.js +60 -0
- package/dist/server/utils.d.ts +12 -0
- package/dist/server/utils.js +45 -0
- package/dist/types.d.ts +128 -0
- package/dist/types.generated.d.ts +203 -0
- package/dist/types.generated.js +0 -0
- package/dist/types.js +0 -0
- package/loader.cjs +24 -0
- package/package.json +265 -0
- package/styles/cards.css +24 -0
- package/styles/code-block.css +266 -0
- package/styles/default.css +55 -0
- package/styles/react-medium-image-zoom.css +101 -0
- package/styles/scrollbar.css +14 -0
- package/styles/steps.css +22 -0
- package/styles/subheading-anchor.css +25 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactElement, ReactNode } from 'react';
|
|
3
|
+
import { PluggableList } from './lib/index.js';
|
|
4
|
+
import * as rehype_katex_lib_index_js from 'rehype-katex/lib/index.js';
|
|
5
|
+
import { MathJax3Config } from 'better-react-mathjax';
|
|
6
|
+
import { Options } from 'rehype-pretty-code';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
|
|
9
|
+
declare const MathJaxOptionsSchema: z.ZodObject<{
|
|
10
|
+
src: z.ZodOptional<z.ZodString>;
|
|
11
|
+
config: z.ZodOptional<z.ZodCustom<MathJax3Config, MathJax3Config>>;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
declare const NextraConfigSchema: z.ZodObject<{
|
|
14
|
+
defaultShowCopyCode: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
search: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
16
|
+
codeblocks: z.ZodBoolean;
|
|
17
|
+
}, z.core.$strict>]>>;
|
|
18
|
+
staticImage: z.ZodDefault<z.ZodBoolean>;
|
|
19
|
+
readingTime: z.ZodOptional<z.ZodBoolean>;
|
|
20
|
+
latex: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
21
|
+
renderer: z.ZodLiteral<"mathjax">;
|
|
22
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
src: z.ZodOptional<z.ZodString>;
|
|
24
|
+
config: z.ZodOptional<z.ZodCustom<MathJax3Config, MathJax3Config>>;
|
|
25
|
+
}, z.core.$strict>>;
|
|
26
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
27
|
+
renderer: z.ZodLiteral<"katex">;
|
|
28
|
+
options: z.ZodCustom<rehype_katex_lib_index_js.Options, rehype_katex_lib_index_js.Options>;
|
|
29
|
+
}, z.core.$strict>]>>;
|
|
30
|
+
codeHighlight: z.ZodDefault<z.ZodBoolean>;
|
|
31
|
+
mdxOptions: z.ZodDefault<z.ZodObject<{
|
|
32
|
+
rehypePlugins: z.ZodOptional<z.ZodCustom<PluggableList | null | undefined, PluggableList | null | undefined>>;
|
|
33
|
+
remarkPlugins: z.ZodOptional<z.ZodCustom<PluggableList | null | undefined, PluggableList | null | undefined>>;
|
|
34
|
+
recmaPlugins: z.ZodOptional<z.ZodCustom<PluggableList | null | undefined, PluggableList | null | undefined>>;
|
|
35
|
+
format: z.ZodDefault<z.ZodEnum<{
|
|
36
|
+
detect: "detect";
|
|
37
|
+
mdx: "mdx";
|
|
38
|
+
md: "md";
|
|
39
|
+
}>>;
|
|
40
|
+
rehypePrettyCodeOptions: z.ZodDefault<z.ZodCustom<Options, Options>>;
|
|
41
|
+
}, z.core.$strict>>;
|
|
42
|
+
whiteListTagsStyling: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
+
contentDirBasePath: z.ZodDefault<z.ZodString>;
|
|
44
|
+
unstable_shouldAddLocaleToLinks: z.ZodDefault<z.ZodBoolean>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
declare const element: z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>;
|
|
47
|
+
/**
|
|
48
|
+
* https://react.dev/reference/react/isValidElement#react-elements-vs-react-nodes
|
|
49
|
+
*/
|
|
50
|
+
declare const reactNode: z.ZodCustom<ReactNode, ReactNode>;
|
|
51
|
+
declare const pageThemeSchema: z.ZodObject<{
|
|
52
|
+
breadcrumb: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
copyPage: z.ZodOptional<z.ZodBoolean>;
|
|
55
|
+
footer: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
layout: z.ZodOptional<z.ZodLiteral<"default" | "full">>;
|
|
57
|
+
navbar: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
pagination: z.ZodOptional<z.ZodBoolean>;
|
|
59
|
+
sidebar: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
timestamp: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
toc: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
typesetting: z.ZodOptional<z.ZodLiteral<"default" | "article">>;
|
|
63
|
+
}, z.core.$strict>;
|
|
64
|
+
declare const separatorItemSchema: z.ZodObject<{
|
|
65
|
+
type: z.ZodLiteral<"separator">;
|
|
66
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
67
|
+
}, z.core.$strict>;
|
|
68
|
+
declare const menuSchema: z.ZodObject<{
|
|
69
|
+
type: z.ZodLiteral<"menu">;
|
|
70
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
71
|
+
items: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>, z.ZodObject<{
|
|
72
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
73
|
+
href: z.ZodString;
|
|
74
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
75
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>;
|
|
76
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
77
|
+
type: z.ZodLiteral<"separator">;
|
|
78
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
79
|
+
}, z.core.$strict>]>, z.ZodTransform<string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
80
|
+
href: string;
|
|
81
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
82
|
+
} | {
|
|
83
|
+
type: "separator";
|
|
84
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
85
|
+
} | {
|
|
86
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
87
|
+
} | {
|
|
88
|
+
title: ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
89
|
+
href: string;
|
|
90
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
91
|
+
} | {
|
|
92
|
+
type: "separator";
|
|
93
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
94
|
+
} | {
|
|
95
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
96
|
+
}) & string) | ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
97
|
+
href: string;
|
|
98
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
99
|
+
} | {
|
|
100
|
+
type: "separator";
|
|
101
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
102
|
+
} | {
|
|
103
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
104
|
+
}) & ReactElement<unknown, string | react.JSXElementConstructor<any>>);
|
|
105
|
+
}, string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
106
|
+
href: string;
|
|
107
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
108
|
+
} | {
|
|
109
|
+
type: "separator";
|
|
110
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
111
|
+
} | {
|
|
112
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
113
|
+
}>>>, z.ZodTransform<Record<string, string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
114
|
+
href: string;
|
|
115
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
116
|
+
} | {
|
|
117
|
+
type: "separator";
|
|
118
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
119
|
+
} | {
|
|
120
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
121
|
+
} | {
|
|
122
|
+
title: ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
123
|
+
href: string;
|
|
124
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
125
|
+
} | {
|
|
126
|
+
type: "separator";
|
|
127
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
128
|
+
} | {
|
|
129
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
130
|
+
}) & string) | ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
131
|
+
href: string;
|
|
132
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
133
|
+
} | {
|
|
134
|
+
type: "separator";
|
|
135
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
136
|
+
} | {
|
|
137
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
138
|
+
}) & ReactElement<unknown, string | react.JSXElementConstructor<any>>);
|
|
139
|
+
}>, Record<string, string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
140
|
+
href: string;
|
|
141
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
142
|
+
} | {
|
|
143
|
+
type: "separator";
|
|
144
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
145
|
+
} | {
|
|
146
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
147
|
+
} | {
|
|
148
|
+
title: ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
149
|
+
href: string;
|
|
150
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
151
|
+
} | {
|
|
152
|
+
type: "separator";
|
|
153
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
154
|
+
} | {
|
|
155
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
156
|
+
}) & string) | ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
157
|
+
href: string;
|
|
158
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
159
|
+
} | {
|
|
160
|
+
type: "separator";
|
|
161
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
162
|
+
} | {
|
|
163
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
164
|
+
}) & ReactElement<unknown, string | react.JSXElementConstructor<any>>);
|
|
165
|
+
}>>>;
|
|
166
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
167
|
+
normal: "normal";
|
|
168
|
+
hidden: "hidden";
|
|
169
|
+
}>>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
declare const itemSchema: z.ZodObject<{
|
|
172
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
173
|
+
page: "page";
|
|
174
|
+
doc: "doc";
|
|
175
|
+
}>>;
|
|
176
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
177
|
+
/**
|
|
178
|
+
* An option to control how an item should be displayed in the sidebar:
|
|
179
|
+
* - `normal`: the default behavior, item will be displayed
|
|
180
|
+
* - `hidden`: the item will not be displayed in the sidebar entirely
|
|
181
|
+
* - `children`: if the item is a folder, itself will be hidden but all its children will still be processed
|
|
182
|
+
*/
|
|
183
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
184
|
+
normal: "normal";
|
|
185
|
+
hidden: "hidden";
|
|
186
|
+
children: "children";
|
|
187
|
+
}>>;
|
|
188
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
breadcrumb: z.ZodOptional<z.ZodBoolean>;
|
|
190
|
+
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
191
|
+
copyPage: z.ZodOptional<z.ZodBoolean>;
|
|
192
|
+
footer: z.ZodOptional<z.ZodBoolean>;
|
|
193
|
+
layout: z.ZodOptional<z.ZodLiteral<"default" | "full">>;
|
|
194
|
+
navbar: z.ZodOptional<z.ZodBoolean>;
|
|
195
|
+
pagination: z.ZodOptional<z.ZodBoolean>;
|
|
196
|
+
sidebar: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
+
timestamp: z.ZodOptional<z.ZodBoolean>;
|
|
198
|
+
toc: z.ZodOptional<z.ZodBoolean>;
|
|
199
|
+
typesetting: z.ZodOptional<z.ZodLiteral<"default" | "article">>;
|
|
200
|
+
}, z.core.$strict>>;
|
|
201
|
+
}, z.core.$strict>;
|
|
202
|
+
declare const metaSchema: z.ZodUnion<readonly [z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>, z.ZodTransform<string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
203
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | (ReactElement<unknown, string | react.JSXElementConstructor<any>> & string) | (string & ReactElement<unknown, string | react.JSXElementConstructor<any>>);
|
|
204
|
+
}, string | ReactElement<unknown, string | react.JSXElementConstructor<any>>>>, z.ZodObject<{
|
|
205
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
206
|
+
page: "page";
|
|
207
|
+
doc: "doc";
|
|
208
|
+
}>>;
|
|
209
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
210
|
+
/**
|
|
211
|
+
* An option to control how an item should be displayed in the sidebar:
|
|
212
|
+
* - `normal`: the default behavior, item will be displayed
|
|
213
|
+
* - `hidden`: the item will not be displayed in the sidebar entirely
|
|
214
|
+
* - `children`: if the item is a folder, itself will be hidden but all its children will still be processed
|
|
215
|
+
*/
|
|
216
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
217
|
+
normal: "normal";
|
|
218
|
+
hidden: "hidden";
|
|
219
|
+
children: "children";
|
|
220
|
+
}>>;
|
|
221
|
+
theme: z.ZodOptional<z.ZodObject<{
|
|
222
|
+
breadcrumb: z.ZodOptional<z.ZodBoolean>;
|
|
223
|
+
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
224
|
+
copyPage: z.ZodOptional<z.ZodBoolean>;
|
|
225
|
+
footer: z.ZodOptional<z.ZodBoolean>;
|
|
226
|
+
layout: z.ZodOptional<z.ZodLiteral<"default" | "full">>;
|
|
227
|
+
navbar: z.ZodOptional<z.ZodBoolean>;
|
|
228
|
+
pagination: z.ZodOptional<z.ZodBoolean>;
|
|
229
|
+
sidebar: z.ZodOptional<z.ZodBoolean>;
|
|
230
|
+
timestamp: z.ZodOptional<z.ZodBoolean>;
|
|
231
|
+
toc: z.ZodOptional<z.ZodBoolean>;
|
|
232
|
+
typesetting: z.ZodOptional<z.ZodLiteral<"default" | "article">>;
|
|
233
|
+
}, z.core.$strict>>;
|
|
234
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
235
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
236
|
+
href: z.ZodString;
|
|
237
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
238
|
+
page: "page";
|
|
239
|
+
doc: "doc";
|
|
240
|
+
}>>;
|
|
241
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
242
|
+
normal: "normal";
|
|
243
|
+
hidden: "hidden";
|
|
244
|
+
}>>;
|
|
245
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
246
|
+
type: z.ZodLiteral<"separator">;
|
|
247
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
248
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
249
|
+
type: z.ZodLiteral<"menu">;
|
|
250
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
251
|
+
items: z.ZodPipe<z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>, z.ZodObject<{
|
|
252
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
253
|
+
href: z.ZodString;
|
|
254
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
255
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>;
|
|
256
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
257
|
+
type: z.ZodLiteral<"separator">;
|
|
258
|
+
title: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<ReactElement<unknown, string | react.JSXElementConstructor<any>>, ReactElement<unknown, string | react.JSXElementConstructor<any>>>]>>;
|
|
259
|
+
}, z.core.$strict>]>, z.ZodTransform<string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
260
|
+
href: string;
|
|
261
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
262
|
+
} | {
|
|
263
|
+
type: "separator";
|
|
264
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
265
|
+
} | {
|
|
266
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
267
|
+
} | {
|
|
268
|
+
title: ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
269
|
+
href: string;
|
|
270
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
271
|
+
} | {
|
|
272
|
+
type: "separator";
|
|
273
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
274
|
+
} | {
|
|
275
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
276
|
+
}) & string) | ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
277
|
+
href: string;
|
|
278
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
279
|
+
} | {
|
|
280
|
+
type: "separator";
|
|
281
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
282
|
+
} | {
|
|
283
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
284
|
+
}) & ReactElement<unknown, string | react.JSXElementConstructor<any>>);
|
|
285
|
+
}, string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
286
|
+
href: string;
|
|
287
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
288
|
+
} | {
|
|
289
|
+
type: "separator";
|
|
290
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
291
|
+
} | {
|
|
292
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
293
|
+
}>>>, z.ZodTransform<Record<string, string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
294
|
+
href: string;
|
|
295
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
296
|
+
} | {
|
|
297
|
+
type: "separator";
|
|
298
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
299
|
+
} | {
|
|
300
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
301
|
+
} | {
|
|
302
|
+
title: ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
303
|
+
href: string;
|
|
304
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
305
|
+
} | {
|
|
306
|
+
type: "separator";
|
|
307
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
308
|
+
} | {
|
|
309
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
310
|
+
}) & string) | ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
311
|
+
href: string;
|
|
312
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
313
|
+
} | {
|
|
314
|
+
type: "separator";
|
|
315
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
316
|
+
} | {
|
|
317
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
318
|
+
}) & ReactElement<unknown, string | react.JSXElementConstructor<any>>);
|
|
319
|
+
}>, Record<string, string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
320
|
+
href: string;
|
|
321
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
322
|
+
} | {
|
|
323
|
+
type: "separator";
|
|
324
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
325
|
+
} | {
|
|
326
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
327
|
+
} | {
|
|
328
|
+
title: ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
329
|
+
href: string;
|
|
330
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
331
|
+
} | {
|
|
332
|
+
type: "separator";
|
|
333
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
334
|
+
} | {
|
|
335
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
336
|
+
}) & string) | ((string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | {
|
|
337
|
+
href: string;
|
|
338
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
339
|
+
} | {
|
|
340
|
+
type: "separator";
|
|
341
|
+
title?: string | ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
342
|
+
} | {
|
|
343
|
+
title: string | ReactElement<unknown, string | react.JSXElementConstructor<any>>;
|
|
344
|
+
}) & ReactElement<unknown, string | react.JSXElementConstructor<any>>);
|
|
345
|
+
}>>>;
|
|
346
|
+
display: z.ZodOptional<z.ZodEnum<{
|
|
347
|
+
normal: "normal";
|
|
348
|
+
hidden: "hidden";
|
|
349
|
+
}>>;
|
|
350
|
+
}, z.core.$strict>]>;
|
|
351
|
+
|
|
352
|
+
export { MathJaxOptionsSchema, NextraConfigSchema, element, itemSchema, menuSchema, metaSchema, pageThemeSchema, reactNode, separatorItemSchema };
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { isValidElement } from "react";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { pageTitleFromFilename } from "./utils.js";
|
|
4
|
+
const MathJaxOptionsSchema = z.strictObject({
|
|
5
|
+
src: z.string().optional().meta({
|
|
6
|
+
description: "URL for MathJax.",
|
|
7
|
+
default: '"https://cdnjs.cloudflare.com"'
|
|
8
|
+
}),
|
|
9
|
+
config: z.custom().optional().meta({
|
|
10
|
+
description: "MathJax config. See [configuring MathJax](https://docs.mathjax.org/en/latest/options/index.html).",
|
|
11
|
+
type: 'import("better-react-mathjax").MathJax3Config'
|
|
12
|
+
})
|
|
13
|
+
});
|
|
14
|
+
const MdxOptionsSchema = z.strictObject({
|
|
15
|
+
rehypePlugins: z.custom().optional().meta({
|
|
16
|
+
description: "List of rehype plugins.",
|
|
17
|
+
type: 'import("@mdx-js/mdx").ProcessorOptions["rehypePlugins"]'
|
|
18
|
+
}),
|
|
19
|
+
remarkPlugins: z.custom().optional().meta({
|
|
20
|
+
description: "List of remark plugins.",
|
|
21
|
+
type: 'import("@mdx-js/mdx").ProcessorOptions["remarkPlugins"]'
|
|
22
|
+
}),
|
|
23
|
+
recmaPlugins: z.custom().optional().meta({
|
|
24
|
+
description: "List of recma plugins. This is a new ecosystem, currently in beta, to transform esast trees (JavaScript).",
|
|
25
|
+
type: 'import("@mdx-js/mdx").ProcessorOptions["recmaPlugins"]'
|
|
26
|
+
}),
|
|
27
|
+
format: z.enum(["detect", "mdx", "md"]).default("detect").meta({
|
|
28
|
+
description: `Format of the file.
|
|
29
|
+
- \`'md'\` means treat as markdown
|
|
30
|
+
- \`'mdx'\` means treat as MDX
|
|
31
|
+
- \`'detect'\` means try to detect the format based on file path.`
|
|
32
|
+
}),
|
|
33
|
+
rehypePrettyCodeOptions: z.custom().default({}).meta({
|
|
34
|
+
description: `Configuration options for [Rehype Pretty Code](https://github.com/rehype-pretty/rehype-pretty-code).
|
|
35
|
+
@remarks \`RehypePrettyCodeOptions\``,
|
|
36
|
+
type: 'import("rehype-pretty-code").Options'
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
const NextraConfigSchema = z.strictObject({
|
|
40
|
+
defaultShowCopyCode: z.boolean().optional().meta({
|
|
41
|
+
description: `Enable the copy button for all code blocks by default, without needing to set \`copy=true\` attribute in the code block metadata.
|
|
42
|
+
> [!TIP]
|
|
43
|
+
>
|
|
44
|
+
> You could still disable the button for specific blocks using \`copy=false\` attribute.`
|
|
45
|
+
}),
|
|
46
|
+
search: z.union([
|
|
47
|
+
z.boolean(),
|
|
48
|
+
z.strictObject({
|
|
49
|
+
codeblocks: z.boolean().meta({
|
|
50
|
+
description: "Whether to index code blocks."
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
]).default({ codeblocks: false }).meta({
|
|
54
|
+
description: `Option to enable search functionality. When enabled, it sets the \`data-pagefind-body\` attribute on the \`<main>\` element.
|
|
55
|
+
> [!TIP]
|
|
56
|
+
>
|
|
57
|
+
> When set to \`codeblocks: false\`, it adds the \`data-pagefind-ignore="all"\` attribute to all code blocks (\`<pre>\` elements).`
|
|
58
|
+
}),
|
|
59
|
+
staticImage: z.boolean().default(true).meta({
|
|
60
|
+
description: `Option to automatically optimizing your static image imports with the Markdown syntax.
|
|
61
|
+
> [!TIP]
|
|
62
|
+
>
|
|
63
|
+
> Example: \`\`.`
|
|
64
|
+
}),
|
|
65
|
+
readingTime: z.boolean().optional().meta({
|
|
66
|
+
description: `Adds estimated reading time of \`.md\` and \`.mdx\` files using [readingTime](https://npmjs.com/package/reading-time) package.
|
|
67
|
+
> [!TIP]
|
|
68
|
+
>
|
|
69
|
+
> The reading time is added to the front matter under the \`readingTime\` key.`
|
|
70
|
+
}),
|
|
71
|
+
latex: z.union([
|
|
72
|
+
z.boolean(),
|
|
73
|
+
z.strictObject({
|
|
74
|
+
renderer: z.literal("mathjax"),
|
|
75
|
+
options: MathJaxOptionsSchema.optional()
|
|
76
|
+
}),
|
|
77
|
+
z.strictObject({
|
|
78
|
+
renderer: z.literal("katex"),
|
|
79
|
+
options: z.custom().meta({
|
|
80
|
+
description: "KaTeX options. See https://katex.org/docs/options.html.",
|
|
81
|
+
type: 'import("rehype-katex").Options'
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
]).optional().meta({
|
|
85
|
+
description: "Enable LaTeX either with [KaTeX](https://katex.org) to pre-render LaTeX expressions directly in MDX or [MathJax](https://mathjax.org) to dynamically render math in the browser."
|
|
86
|
+
}),
|
|
87
|
+
codeHighlight: z.boolean().default(true).meta({
|
|
88
|
+
description: "Enable or disable syntax highlighting."
|
|
89
|
+
}),
|
|
90
|
+
mdxOptions: MdxOptionsSchema.default(MdxOptionsSchema.parse({})).meta({
|
|
91
|
+
description: `Options specific to MDX compiling.
|
|
92
|
+
@remarks \`MdxOptions\``
|
|
93
|
+
}),
|
|
94
|
+
whiteListTagsStyling: z.array(z.string()).optional().meta({
|
|
95
|
+
description: `Allows you to whitelist HTML elements to be replaced with components defined in the \`mdx-components.js\` file.
|
|
96
|
+
> [!TIP]
|
|
97
|
+
>
|
|
98
|
+
> By default, Nextra only replaces \`<details>\` and \`<summary>\` elements.`
|
|
99
|
+
}),
|
|
100
|
+
contentDirBasePath: z.string().startsWith("/").refine((value) => value.length === 1 || !value.endsWith("/"), {
|
|
101
|
+
error: 'Must not end with "/"'
|
|
102
|
+
}).default("/").meta({
|
|
103
|
+
description: "Option to serve your `.md` and `.mdx` files from the `content` directory at a custom path instead of the root (`/`)."
|
|
104
|
+
}),
|
|
105
|
+
unstable_shouldAddLocaleToLinks: z.boolean().default(false).meta({
|
|
106
|
+
description: "Prefixes locale to all links in the page map information. Useful for i18n when you don't want to use Nextra's `middleware` function."
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
const element = z.custom(
|
|
110
|
+
function checkReactElement(data) {
|
|
111
|
+
return isValidElement(data);
|
|
112
|
+
},
|
|
113
|
+
{ error: "Must be a valid React element" }
|
|
114
|
+
);
|
|
115
|
+
const reactNode = z.custom(
|
|
116
|
+
function checkReactNode(data) {
|
|
117
|
+
if (
|
|
118
|
+
// Check if it's a valid React element
|
|
119
|
+
isValidElement(data) || // Check if it's null or undefined
|
|
120
|
+
data == null || typeof data === "string" || typeof data === "number" || typeof data === "boolean"
|
|
121
|
+
) {
|
|
122
|
+
return true;
|
|
123
|
+
}
|
|
124
|
+
if (Array.isArray(data)) {
|
|
125
|
+
return data.every((item) => checkReactNode(item));
|
|
126
|
+
}
|
|
127
|
+
const isServerComponent = typeof data === "object" && "$$typeof" in data && data.$$typeof === Symbol.for("react.lazy");
|
|
128
|
+
return isServerComponent;
|
|
129
|
+
},
|
|
130
|
+
{ error: "Must be a valid React node" }
|
|
131
|
+
);
|
|
132
|
+
const stringOrElement = z.union([z.string(), element]);
|
|
133
|
+
const pageThemeSchema = z.strictObject({
|
|
134
|
+
breadcrumb: z.boolean().optional().meta({
|
|
135
|
+
description: "Show or hide breadcrumb navigation.",
|
|
136
|
+
default: true
|
|
137
|
+
}),
|
|
138
|
+
collapsed: z.boolean().optional().meta({
|
|
139
|
+
description: "Indicates whether the item in sidebar is collapsed by default.",
|
|
140
|
+
default: false
|
|
141
|
+
}),
|
|
142
|
+
copyPage: z.boolean().optional().meta({
|
|
143
|
+
description: "Specifies whether to display the copy page button.",
|
|
144
|
+
default: true
|
|
145
|
+
}),
|
|
146
|
+
footer: z.boolean().optional().meta({
|
|
147
|
+
description: "Specifies whether to display the footer.",
|
|
148
|
+
default: true
|
|
149
|
+
}),
|
|
150
|
+
layout: z.literal(["default", "full"]).optional().meta({
|
|
151
|
+
description: "Defines the layout style.",
|
|
152
|
+
default: "'default'"
|
|
153
|
+
}),
|
|
154
|
+
navbar: z.boolean().optional().meta({
|
|
155
|
+
description: "Specifies whether to display the navbar.",
|
|
156
|
+
default: true
|
|
157
|
+
}),
|
|
158
|
+
pagination: z.boolean().optional().meta({
|
|
159
|
+
description: "Determines if pagination controls are shown.",
|
|
160
|
+
default: true
|
|
161
|
+
}),
|
|
162
|
+
sidebar: z.boolean().optional().meta({
|
|
163
|
+
description: "Specifies whether to display the sidebar.",
|
|
164
|
+
default: true
|
|
165
|
+
}),
|
|
166
|
+
timestamp: z.boolean().optional().meta({
|
|
167
|
+
description: 'Indicates if "last updated" timestamps are displayed.',
|
|
168
|
+
default: true
|
|
169
|
+
}),
|
|
170
|
+
toc: z.boolean().optional().meta({
|
|
171
|
+
description: "Determines whether a table of contents is displayed.",
|
|
172
|
+
default: true
|
|
173
|
+
}),
|
|
174
|
+
typesetting: z.literal(["default", "article"]).optional().meta({
|
|
175
|
+
description: "Configures the text typesetting style.",
|
|
176
|
+
default: "'default'"
|
|
177
|
+
})
|
|
178
|
+
});
|
|
179
|
+
const title = stringOrElement.optional();
|
|
180
|
+
const linkSchema = z.strictObject({
|
|
181
|
+
title,
|
|
182
|
+
href: z.string()
|
|
183
|
+
});
|
|
184
|
+
const separatorItemSchema = z.strictObject({
|
|
185
|
+
type: z.literal("separator"),
|
|
186
|
+
title
|
|
187
|
+
});
|
|
188
|
+
const menuItemSchema = z.union([
|
|
189
|
+
stringOrElement,
|
|
190
|
+
linkSchema,
|
|
191
|
+
z.strictObject({ title: stringOrElement }),
|
|
192
|
+
separatorItemSchema
|
|
193
|
+
]).transform(transformTitle);
|
|
194
|
+
const menuSchema = z.strictObject({
|
|
195
|
+
type: z.literal("menu"),
|
|
196
|
+
title,
|
|
197
|
+
items: z.record(z.string(), menuItemSchema).transform((obj) => {
|
|
198
|
+
for (const key in obj) {
|
|
199
|
+
obj[key].title ||= pageTitleFromFilename(key);
|
|
200
|
+
}
|
|
201
|
+
return obj;
|
|
202
|
+
}),
|
|
203
|
+
display: z.enum(["normal", "hidden"]).optional()
|
|
204
|
+
});
|
|
205
|
+
const itemSchema = z.strictObject({
|
|
206
|
+
type: z.enum(["page", "doc"]).optional(),
|
|
207
|
+
title,
|
|
208
|
+
/**
|
|
209
|
+
* An option to control how an item should be displayed in the sidebar:
|
|
210
|
+
* - `normal`: the default behavior, item will be displayed
|
|
211
|
+
* - `hidden`: the item will not be displayed in the sidebar entirely
|
|
212
|
+
* - `children`: if the item is a folder, itself will be hidden but all its children will still be processed
|
|
213
|
+
*/
|
|
214
|
+
display: z.enum(["normal", "hidden", "children"]).optional(),
|
|
215
|
+
theme: pageThemeSchema.optional()
|
|
216
|
+
});
|
|
217
|
+
const metaSchema = z.union([
|
|
218
|
+
stringOrElement.transform(transformTitle),
|
|
219
|
+
itemSchema,
|
|
220
|
+
linkSchema.extend({
|
|
221
|
+
type: z.enum(["page", "doc"]).optional(),
|
|
222
|
+
display: z.enum(["normal", "hidden"]).optional()
|
|
223
|
+
}),
|
|
224
|
+
separatorItemSchema,
|
|
225
|
+
menuSchema
|
|
226
|
+
]);
|
|
227
|
+
function transformTitle(title2) {
|
|
228
|
+
return typeof title2 === "string" || isValidElement(title2) ? { title: title2 } : title2;
|
|
229
|
+
}
|
|
230
|
+
export {
|
|
231
|
+
MathJaxOptionsSchema,
|
|
232
|
+
NextraConfigSchema,
|
|
233
|
+
element,
|
|
234
|
+
itemSchema,
|
|
235
|
+
menuSchema,
|
|
236
|
+
metaSchema,
|
|
237
|
+
pageThemeSchema,
|
|
238
|
+
reactNode,
|
|
239
|
+
separatorItemSchema
|
|
240
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseArgs, GeneratedDefinition, GeneratedType, GeneratedFunction } from './types.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Generate documentation for properties of `type` and `interface` and parameters and returns
|
|
5
|
+
* signature of `function`.
|
|
6
|
+
* @returns Parsed TSDoc definition from TypeScript `type`, `interface` or `function`.
|
|
7
|
+
* @example
|
|
8
|
+
* To generate documentation for a `type`, `interface`, or `function`, export it via the `code`
|
|
9
|
+
* argument.
|
|
10
|
+
*
|
|
11
|
+
* ### As a `default` export
|
|
12
|
+
*
|
|
13
|
+
* ```mdx
|
|
14
|
+
* import { generateDefinition, TSDoc } from 'nextra/tsdoc'
|
|
15
|
+
*
|
|
16
|
+
* <TSDoc
|
|
17
|
+
* definition={generateDefinition({
|
|
18
|
+
* code: "export { yourTypeOrFunction as default } from 'your-package'",
|
|
19
|
+
* })}
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* ### As a named export
|
|
24
|
+
*
|
|
25
|
+
* ```mdx
|
|
26
|
+
* import { generateDefinition, TSDoc } from 'nextra/tsdoc'
|
|
27
|
+
*
|
|
28
|
+
* <TSDoc
|
|
29
|
+
* definition={generateDefinition({
|
|
30
|
+
* code: "export { yourTypeOrFunction } from 'your-package'",
|
|
31
|
+
* exportName: 'yourTypeOrFunction'
|
|
32
|
+
* })}
|
|
33
|
+
* />
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare function generateDefinition({ code, exportName, flattened }: BaseArgs): GeneratedDefinition & (GeneratedType | GeneratedFunction);
|
|
37
|
+
|
|
38
|
+
export { generateDefinition };
|