fumadocs-core 16.18.3 → 16.19.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/dist/{algolia-DsNJZd4P.d.ts → algolia-BU6WTadf.d.ts} +2 -2
- package/dist/{client-Bv_2P4D3.d.ts → client-D5_Oxm3d.d.ts} +3 -3
- package/dist/code-output-CTZ8RNSo.js +371 -0
- package/dist/content/mdx/preset-bundler.d.ts +4 -4
- package/dist/content/mdx/preset-runtime.d.ts +4 -4
- package/dist/{dynamic-CENrXFis.js → dynamic-BOCEF-LU.js} +19 -3
- package/dist/framework/plugin.d.ts +2 -2
- package/dist/heading-id-DV5jeAL8.js +78 -0
- package/dist/index--VTdzHy3.d.ts +18 -0
- package/dist/{index-CE1OSGGq.d.ts → index-BlFx9iJj.d.ts} +1 -1
- package/dist/{index-BOhS1UKT.d.ts → index-xpLrpK8K.d.ts} +39 -78
- package/dist/mcp.d.ts +2 -2
- package/dist/mdx-plugins/index.d.ts +8 -7
- package/dist/mdx-plugins/index.js +5 -5
- package/dist/mdx-plugins/rehype-code.core.js +1 -1
- package/dist/mdx-plugins/rehype-code.js +1 -1
- package/dist/mdx-plugins/rehype-toc.d.ts +1 -1
- package/dist/mdx-plugins/rehype-toc.js +74 -110
- package/dist/mdx-plugins/remark-admonition.js +1 -1
- package/dist/mdx-plugins/remark-block-id.js +1 -1
- package/dist/mdx-plugins/remark-code-tab.d.ts +1 -1
- package/dist/mdx-plugins/remark-code-tab.js +1 -192
- package/dist/mdx-plugins/remark-directive-admonition.js +1 -1
- package/dist/mdx-plugins/remark-feedback-block.js +1 -1
- package/dist/mdx-plugins/remark-heading.d.ts +2 -2
- package/dist/mdx-plugins/remark-heading.js +51 -13
- package/dist/mdx-plugins/remark-heading.runtime.d.ts +11 -0
- package/dist/mdx-plugins/remark-heading.runtime.js +30 -0
- package/dist/mdx-plugins/remark-image.js +1 -1
- package/dist/mdx-plugins/remark-include.js +2 -2
- package/dist/mdx-plugins/remark-llms.d.ts +1 -1
- package/dist/mdx-plugins/remark-llms.js +18 -297
- package/dist/mdx-plugins/remark-mdx-files.js +1 -1
- package/dist/mdx-plugins/remark-mdx-mermaid.js +1 -1
- package/dist/mdx-plugins/remark-npm.js +1 -1
- package/dist/mdx-plugins/remark-show.d.ts +2 -2
- package/dist/mdx-plugins/remark-show.js +14 -154
- package/dist/mdx-plugins/remark-steps.js +11 -84
- package/dist/mdx-plugins/remark-structure.d.ts +1 -1
- package/dist/mdx-plugins/remark-structure.js +2 -157
- package/dist/mdx-plugins/stringifier.d.ts +23 -4
- package/dist/mdx-plugins/stringifier.js +3 -2
- package/dist/{meilisearch-DzjbVbAn.d.ts → meilisearch-C4oclDaO.d.ts} +2 -2
- package/dist/{mixedbread-CMi5F-zO.d.ts → mixedbread-8oiVgbAM.d.ts} +3 -3
- package/dist/{rehype-code.core-Jt2VtK1A.js → rehype-code.core-aegwEr3K.js} +1 -1
- package/dist/{rehype-toc-BBnmTg-x.d.ts → rehype-toc-B0HyD0yu.d.ts} +1 -1
- package/dist/{remark-code-tab-Dj_--R3y.d.ts → remark-code-tab-Bp3EItqr.d.ts} +3 -9
- package/dist/remark-code-tab-CS8aN0DX.js +154 -0
- package/dist/remark-heading-BfD2dpns.d.ts +49 -0
- package/dist/{remark-llms-eA0WMw4X.d.ts → remark-llms-BCyfmS02.d.ts} +9 -10
- package/dist/remark-show-uR9rtiVe.d.ts +8 -0
- package/dist/{remark-structure-50nmY6sX.d.ts → remark-structure-CV606E7e.d.ts} +7 -2
- package/dist/remark-structure-DG_c2J4O.js +212 -0
- package/dist/search/algolia.d.ts +1 -1
- package/dist/search/client/algolia.d.ts +1 -1
- package/dist/search/client/docs-search.d.ts +1 -1
- package/dist/search/client/fetch.d.ts +1 -1
- package/dist/search/client/flexsearch-static.d.ts +1 -1
- package/dist/search/client/meilisearch.d.ts +1 -1
- package/dist/search/client/mixedbread.d.ts +2 -2
- package/dist/search/client/orama-cloud-legacy.d.ts +1 -1
- package/dist/search/client/orama-cloud.d.ts +1 -1
- package/dist/search/client/orama-static.d.ts +1 -1
- package/dist/search/client.d.ts +1 -1
- package/dist/search/flexsearch.d.ts +3 -3
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +1 -1
- package/dist/search/meilisearch.d.ts +1 -1
- package/dist/search/mixedbread.d.ts +2 -2
- package/dist/search/orama-cloud-legacy.d.ts +2 -2
- package/dist/search/orama-cloud.d.ts +3 -2
- package/dist/search/server.d.ts +1 -1
- package/dist/{server-MsDv36PV.d.ts → server-CazrloBV.d.ts} +3 -3
- package/dist/server.d.ts +7 -3
- package/dist/server.js +30 -11
- package/dist/source/dynamic.d.ts +1 -1
- package/dist/source/dynamic.js +1 -1
- package/dist/source/index.d.ts +2 -2
- package/dist/source/index.js +1 -1
- package/dist/source/llms.d.ts +1 -1
- package/dist/source/plugins/lucide-icons.d.ts +1 -1
- package/dist/source/plugins/slugs.d.ts +1 -1
- package/dist/source/plugins/status-badges.d.ts +1 -1
- package/dist/steps-D4-CDiVv.js +135 -0
- package/dist/utils-DfA1qEJN.js +98 -0
- package/package.json +5 -2
- package/dist/heading-id-BXARvmRb.js +0 -15
- package/dist/remark-heading-Dhiig5Fv.d.ts +0 -31
- package/dist/utils-DV8PBZiI.js +0 -58
|
@@ -1,29 +1,11 @@
|
|
|
1
|
-
import "./remark-gfm-DpVfAX1x.js";
|
|
2
|
-
import "./rehype-code-Czh_8L5z.js";
|
|
3
|
-
import "./remark-image-BwyGdFld.js";
|
|
4
|
-
import "./remark-include-D_FmDdtI.js";
|
|
5
|
-
import { n as StructuredData } from "./remark-structure-50nmY6sX.js";
|
|
6
|
-
import "./remark-heading-Dhiig5Fv.js";
|
|
7
|
-
import "./remark-admonition-BxacgP6i.js";
|
|
8
|
-
import "./remark-directive-admonition-BT_PH6hL.js";
|
|
9
|
-
import "./rehype-toc-BBnmTg-x.js";
|
|
10
|
-
import "./remark-code-tab-Dj_--R3y.js";
|
|
11
|
-
import "./remark-steps-CKvq9VmR.js";
|
|
12
|
-
import "./remark-npm-IH35Vls_.js";
|
|
13
|
-
import "./codeblock-utils-D65x-Jra.js";
|
|
14
|
-
import "./remark-mdx-files-BJvKexDp.js";
|
|
15
|
-
import "./remark-mdx-mermaid-BrK4YVTJ.js";
|
|
16
|
-
import "./remark-feedback-block-2Ei4IDr4.js";
|
|
17
1
|
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
|
|
18
2
|
import { n as I18nConfig } from "./index-DFrWGSeW.js";
|
|
19
|
-
import {
|
|
3
|
+
import { n as StructuredData } from "./remark-structure-CV606E7e.js";
|
|
4
|
+
import { a as Separator, i as Root, n as Item, r as Node, t as Folder } from "./definitions-BQVehOBz.js";
|
|
20
5
|
import { n as SerializedPageTree } from "./index-B2EN5xn0.js";
|
|
6
|
+
import "./index--VTdzHy3.js";
|
|
21
7
|
import "./index-DMxrC6WS.js";
|
|
22
|
-
import "./remark-llms-eA0WMw4X.js";
|
|
23
8
|
import { ReactNode } from "react";
|
|
24
|
-
import { Expression } from "estree-jsx";
|
|
25
|
-
import { Processor, Transformer } from "unified";
|
|
26
|
-
import { Root } from "mdast";
|
|
27
9
|
/**
|
|
28
10
|
* In memory file system.
|
|
29
11
|
*/
|
|
@@ -71,6 +53,11 @@ interface ContentStoragePageFile<Type extends string | undefined = string | unde
|
|
|
71
53
|
data: Data;
|
|
72
54
|
/** for a page of a dynamic file, its params */
|
|
73
55
|
params?: Params;
|
|
56
|
+
/** see `dataAt` of `VirtualFile`, for custom props */
|
|
57
|
+
dataAt?(params: Params, custom?: {
|
|
58
|
+
props: Record<string, unknown>;
|
|
59
|
+
data: Data;
|
|
60
|
+
}): Data;
|
|
74
61
|
}
|
|
75
62
|
interface PageTreeBuilderContext<S extends ContentStorage = ContentStorage> {
|
|
76
63
|
transformers: PageTreeTransformer<S>[];
|
|
@@ -85,7 +72,7 @@ interface PageTreeTransformer<S extends ContentStorage = ContentStorage> {
|
|
|
85
72
|
file?: (this: PageTreeBuilderContext<S>, node: Item, filePath?: string) => Item;
|
|
86
73
|
folder?: (this: PageTreeBuilderContext<S>, node: Folder, folderPath: string, metaPath?: string) => Folder;
|
|
87
74
|
separator?: (this: PageTreeBuilderContext<S>, node: Separator) => Separator;
|
|
88
|
-
root?: (this: PageTreeBuilderContext<S>, node: Root
|
|
75
|
+
root?: (this: PageTreeBuilderContext<S>, node: Root) => Root;
|
|
89
76
|
}
|
|
90
77
|
interface PageTreeOptions<S extends ContentStorage = ContentStorage> {
|
|
91
78
|
/** generate URL from page */
|
|
@@ -119,7 +106,7 @@ interface PageTreeOptions<S extends ContentStorage = ContentStorage> {
|
|
|
119
106
|
}
|
|
120
107
|
interface PageTreeBuilder {
|
|
121
108
|
resolveFlattenPath(name: string, format: string): string;
|
|
122
|
-
root(id?: string, path?: string): Root
|
|
109
|
+
root(id?: string, path?: string): Root;
|
|
123
110
|
}
|
|
124
111
|
/**
|
|
125
112
|
* a function to generate slugs, return `undefined` to generate default slugs.
|
|
@@ -206,6 +193,15 @@ interface Page<Type extends string | undefined = string | undefined, Data extend
|
|
|
206
193
|
params?: Params;
|
|
207
194
|
locale?: string | undefined;
|
|
208
195
|
}
|
|
196
|
+
interface GetPageOptions {
|
|
197
|
+
/** if unspecified, the default language */
|
|
198
|
+
language?: string;
|
|
199
|
+
/**
|
|
200
|
+
* The props you pass to the content of the page, its outputs (like the table of contents) render for them too. The
|
|
201
|
+
* page is not cached.
|
|
202
|
+
*/
|
|
203
|
+
props?: Record<string, unknown>;
|
|
204
|
+
}
|
|
209
205
|
interface Meta<Type extends string | undefined = string | undefined, Data extends MetaData = MetaData> extends SharedFileInfo {
|
|
210
206
|
type: Type;
|
|
211
207
|
data: Data;
|
|
@@ -214,8 +210,8 @@ interface LoaderOutput<Config extends LoaderConfig = LoaderConfig> {
|
|
|
214
210
|
readonly $inferPage: Config['page'];
|
|
215
211
|
readonly $inferMeta: Config['meta'];
|
|
216
212
|
readonly $infer: Config;
|
|
217
|
-
pageTree: Config['i18n'] extends I18nConfig ? Record<string, Root
|
|
218
|
-
getPageTree: (locale?: string) => Root
|
|
213
|
+
pageTree: Config['i18n'] extends I18nConfig ? Record<string, Root> : Root;
|
|
214
|
+
getPageTree: (locale?: string) => Root;
|
|
219
215
|
/**
|
|
220
216
|
* get referenced page from href, supported:
|
|
221
217
|
*
|
|
@@ -258,9 +254,9 @@ interface LoaderOutput<Config extends LoaderConfig = LoaderConfig> {
|
|
|
258
254
|
/**
|
|
259
255
|
* Get page with slugs, they can be URI encoded or decoded.
|
|
260
256
|
*
|
|
261
|
-
* @param
|
|
257
|
+
* @param options - the language, or the options. If unspecified, the default language will be used.
|
|
262
258
|
*/
|
|
263
|
-
getPage: (slugs: string[] | undefined,
|
|
259
|
+
getPage: (slugs: string[] | undefined, options?: string | GetPageOptions) => Config['page'] | undefined;
|
|
264
260
|
/**
|
|
265
261
|
* Get page by its URL (pathname).
|
|
266
262
|
*
|
|
@@ -268,7 +264,7 @@ interface LoaderOutput<Config extends LoaderConfig = LoaderConfig> {
|
|
|
268
264
|
*/
|
|
269
265
|
getPageByUrl: (url: string, language?: string) => Config['page'] | undefined;
|
|
270
266
|
getNodePage: (node: Item, language?: string) => Config['page'] | undefined;
|
|
271
|
-
getNodeMeta: (node: Folder | Root
|
|
267
|
+
getNodeMeta: (node: Folder | Root, language?: string) => Config['meta'] | undefined;
|
|
272
268
|
/**
|
|
273
269
|
* generate static params for Next.js SSG
|
|
274
270
|
*
|
|
@@ -279,7 +275,7 @@ interface LoaderOutput<Config extends LoaderConfig = LoaderConfig> {
|
|
|
279
275
|
/**
|
|
280
276
|
* serialize page tree for non-RSC environments
|
|
281
277
|
*/
|
|
282
|
-
serializePageTree: (tree: Root
|
|
278
|
+
serializePageTree: (tree: Root) => Promise<SerializedPageTree>;
|
|
283
279
|
}
|
|
284
280
|
declare function createGetUrl(baseUrl: string, i18n?: I18nConfig): ResolvedLoaderConfig['url'];
|
|
285
281
|
/** content loader API for static content sources */
|
|
@@ -446,8 +442,17 @@ interface VirtualPage<Data extends PageData> extends BaseVirtualFile {
|
|
|
446
442
|
*/
|
|
447
443
|
slugs?: string[];
|
|
448
444
|
data: Data;
|
|
449
|
-
/**
|
|
450
|
-
|
|
445
|
+
/**
|
|
446
|
+
* The data of the page at some params, for a file of a dynamic path like `[framework]/deploy.mdx`.
|
|
447
|
+
*
|
|
448
|
+
* With `custom`, the page with custom props passed to its content, for `getPage(slugs, { props })`: like the
|
|
449
|
+
* content, its outputs render for them, with the params. `custom.data` is the data of the page after the plugins of
|
|
450
|
+
* the loader.
|
|
451
|
+
*/
|
|
452
|
+
dataAt?(params: Params, custom?: {
|
|
453
|
+
props: Record<string, unknown>;
|
|
454
|
+
data: Data;
|
|
455
|
+
}): Data;
|
|
451
456
|
}
|
|
452
457
|
interface VirtualMeta<Data extends MetaData> extends BaseVirtualFile {
|
|
453
458
|
type: 'meta';
|
|
@@ -542,8 +547,8 @@ interface Context {
|
|
|
542
547
|
}
|
|
543
548
|
interface LLMsConfig<Page = unknown> {
|
|
544
549
|
TAB?: string;
|
|
545
|
-
renderName?: (item: Node | Root
|
|
546
|
-
renderDescription?: (item: Root
|
|
550
|
+
renderName?: (item: Node | Root, ctx: Context) => string;
|
|
551
|
+
renderDescription?: (item: Root | Item | Folder, ctx: Context) => string;
|
|
547
552
|
renderUrl?: (item: Item, ctx: Context) => string;
|
|
548
553
|
/**
|
|
549
554
|
* Render a page as Markdown, required by `page()` and `full()`.
|
|
@@ -580,48 +585,4 @@ declare function llms<C extends LoaderConfig = LoaderConfig>(input: () => Awaita
|
|
|
580
585
|
renderPage: (page: C['page']) => Awaitable<string>;
|
|
581
586
|
}): LLMsWithPages<C['page'], Promise<string>>;
|
|
582
587
|
declare function llms<C extends LoaderConfig = LoaderConfig>(input: () => Awaitable<LoaderOutput<C>>, config?: LLMsConfig<C['page']>): LLMs<Promise<string>>;
|
|
583
|
-
|
|
584
|
-
interface DataMap {
|
|
585
|
-
/** [Fumadocs: remark-show] for a page of a dynamic file, its params, read as `props` */
|
|
586
|
-
params?: Params;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
interface RemarkShowOptions {
|
|
590
|
-
/**
|
|
591
|
-
* Values resolved at build time, by the names code reads them with, like the `define` option of Vite:
|
|
592
|
-
* `{ 'import.meta.env.EDITION': 'pro' }`. They are added to the defaults.
|
|
593
|
-
*
|
|
594
|
-
* A function decides them per page from its params, the defaults it doesn't return aren't resolved.
|
|
595
|
-
*
|
|
596
|
-
* @defaultValue the params of the page as `props`, and the env vars that bundlers inline into pages, with a
|
|
597
|
-
* `NEXT_PUBLIC_`, `VITE_` or `PUBLIC_` prefix, as `process.env` and `import.meta.env`
|
|
598
|
-
*/
|
|
599
|
-
define?: Record<string, unknown> | ((page: {
|
|
600
|
-
params?: Params;
|
|
601
|
-
defaults: Record<string, unknown>;
|
|
602
|
-
}) => Record<string, unknown>);
|
|
603
|
-
}
|
|
604
|
-
/** the element of the branches checked when rendering, defined by the `declaration` of {@link ShowContext} */
|
|
605
|
-
declare const showElement = "_Show";
|
|
606
|
-
interface ShowContext {
|
|
607
|
-
/** the value of an expression, when the build-time values decide it */
|
|
608
|
-
evaluate: (expression: Expression) => {
|
|
609
|
-
value: unknown;
|
|
610
|
-
} | undefined;
|
|
611
|
-
/** whether code may read build-time values, to skip parsing the code that doesn't */
|
|
612
|
-
reads: (code: string) => boolean;
|
|
613
|
-
/** the ESM code that defines `showElement` */
|
|
614
|
-
declaration: string;
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* The build-time values of pages, for ports of `remarkShow()` to other compilers. Call it with the params of each
|
|
618
|
-
* page.
|
|
619
|
-
*/
|
|
620
|
-
declare function createShowContext({ define }?: RemarkShowOptions): (params?: Params) => ShowContext;
|
|
621
|
-
/**
|
|
622
|
-
* Decide `<show when={...}>` branches before other plugins see the tree: a branch decided by `define` or the params of
|
|
623
|
-
* the page (`file.data.params`, as `props`) is removed or unwrapped, the others are checked when rendering. Text
|
|
624
|
-
* interpolations they decide, like `{props.framework}`, become text. Other expressions read `props` when rendering.
|
|
625
|
-
*/
|
|
626
|
-
declare function remarkShow(this: Processor, options?: RemarkShowOptions): Transformer<Root, Root>;
|
|
627
|
-
export { LoaderOptions as A, SlugFn as B, update as C, InferMetaType as D, dynamicLoader as E, Page as F, PageTreeBuilder as G, getSlugs as H, ResolvedLoaderConfig as I, PageTreeTransformer as J, PageTreeBuilderContext as K, createGetUrl as L, LoaderPlugin as M, LoaderPluginOption as N, InferPageType as O, Meta as P, FileSystem as Q, loader as R, multiple as S, DynamicLoaderConfig as T, slugsFromData as U, SlugsPluginOptions as V, slugsPlugin as W, ContentStorageMetaFile as X, ContentStorage as Y, ContentStoragePageFile as Z, Params as _, showElement as a, StaticSource as b, LLMsWithPages as c, getStaticParams as d, isDynamicPath as f, PageData as g, MetaData as h, remarkShow as i, LoaderOutput as j, LoaderConfig as k, llms as l, DynamicSource as m, ShowContext as n, LLMs as o, path_d_exports as p, PageTreeOptions as q, createShowContext as r, LLMsConfig as s, RemarkShowOptions as t, StaticParamsOptions as u, Source as v, DynamicLoader as w, VirtualFile as x, SourceUnion as y, types_d_exports as z };
|
|
588
|
+
export { Meta as A, slugsPlugin as B, InferMetaType as C, LoaderOutput as D, LoaderOptions as E, types_d_exports as F, ContentStorage as G, PageTreeBuilderContext as H, SlugFn as I, FileSystem as J, ContentStorageMetaFile as K, SlugsPluginOptions as L, ResolvedLoaderConfig as M, createGetUrl as N, LoaderPlugin as O, loader as P, getSlugs as R, GetPageOptions as S, LoaderConfig as T, PageTreeOptions as U, PageTreeBuilder as V, PageTreeTransformer as W, multiple as _, StaticParamsOptions as a, DynamicLoaderConfig as b, path_d_exports as c, PageData as d, Params as f, VirtualFile as g, StaticSource as h, llms as i, Page as j, LoaderPluginOption as k, DynamicSource as l, SourceUnion as m, LLMsConfig as n, getStaticParams as o, Source as p, ContentStoragePageFile as q, LLMsWithPages as r, isDynamicPath as s, LLMs as t, MetaData as u, update as v, InferPageType as w, dynamicLoader as x, DynamicLoader as y, slugsFromData as z };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as SearchServer } from "./server-
|
|
2
|
-
import {
|
|
1
|
+
import { r as SearchServer } from "./server-CazrloBV.js";
|
|
2
|
+
import { D as LoaderOutput, T as LoaderConfig, r as LLMsWithPages } from "./index-xpLrpK8K.js";
|
|
3
3
|
import { t as Awaitable } from "./types-Dvkw0Kd0.js";
|
|
4
4
|
import { McpServer } from "@modelcontextprotocol/server";
|
|
5
5
|
/**
|
|
@@ -4,18 +4,19 @@ import { r as transformerIcon, t as CodeBlockIcon } from "../transformer-icon-Bi
|
|
|
4
4
|
import { n as rehypeCode, r as rehypeCodeDefaultOptions, t as RehypeCodeOptions } from "../rehype-code-Czh_8L5z.js";
|
|
5
5
|
import { n as remarkImage, t as RemarkImageOptions } from "../remark-image-BwyGdFld.js";
|
|
6
6
|
import { n as extractCodeRegion, r as remarkInclude, t as RemarkIncludeOptions } from "../remark-include-D_FmDdtI.js";
|
|
7
|
-
import { a as remarkStructureDefaultOptions, i as remarkStructure, n as StructuredData, o as structure, r as StructuredDataContent, t as StructureOptions } from "../remark-structure-
|
|
8
|
-
import { n as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-
|
|
7
|
+
import { a as remarkStructureDefaultOptions, i as remarkStructure, n as StructuredData, o as structure, r as StructuredDataContent, t as StructureOptions } from "../remark-structure-CV606E7e.js";
|
|
8
|
+
import { n as rehypeHeading, r as remarkHeading, t as RemarkHeadingOptions } from "../remark-heading-BfD2dpns.js";
|
|
9
9
|
import { n as remarkAdmonition, t as RemarkAdmonitionOptions } from "../remark-admonition-BxacgP6i.js";
|
|
10
10
|
import { n as remarkDirectiveAdmonition, t as RemarkDirectiveAdmonitionOptions } from "../remark-directive-admonition-BT_PH6hL.js";
|
|
11
|
-
import { n as RehypeTocOptions, r as rehypeToc, t as RehypeTOCItemType } from "../rehype-toc-
|
|
12
|
-
import { n as remarkCodeTab, t as RemarkCodeTabOptions } from "../remark-code-tab-
|
|
11
|
+
import { n as RehypeTocOptions, r as rehypeToc, t as RehypeTOCItemType } from "../rehype-toc-B0HyD0yu.js";
|
|
12
|
+
import { n as remarkCodeTab, t as RemarkCodeTabOptions } from "../remark-code-tab-Bp3EItqr.js";
|
|
13
13
|
import { n as remarkSteps, t as RemarkStepsOptions } from "../remark-steps-CKvq9VmR.js";
|
|
14
14
|
import { n as remarkNpm, t as RemarkNpmOptions } from "../remark-npm-IH35Vls_.js";
|
|
15
15
|
import { i as parseCodeBlockAttributes, n as CodeBlockTabsOptions, r as generateCodeBlockTabs, t as CodeBlockAttributes } from "../codeblock-utils-D65x-Jra.js";
|
|
16
16
|
import { a as remarkMdxFiles, r as RemarkMdxFilesOptions } from "../remark-mdx-files-BJvKexDp.js";
|
|
17
17
|
import { n as remarkMdxMermaid, t as RemarkMdxMermaidOptions } from "../remark-mdx-mermaid-BrK4YVTJ.js";
|
|
18
18
|
import { n as RemarkFeedbackBlockOptions, r as remarkFeedbackBlock, t as FeedbackBlockProps } from "../remark-feedback-block-2Ei4IDr4.js";
|
|
19
|
-
import {
|
|
20
|
-
import { t as LLMsOptions } from "../remark-llms-
|
|
21
|
-
|
|
19
|
+
import { t as remarkShow } from "../remark-show-uR9rtiVe.js";
|
|
20
|
+
import { t as LLMsOptions } from "../remark-llms-BCyfmS02.js";
|
|
21
|
+
import "../index--VTdzHy3.js";
|
|
22
|
+
export { CodeBlockAttributes, type CodeBlockIcon, CodeBlockTabsOptions, FeedbackBlockProps, type LLMsOptions, RehypeCodeOptions, RehypeTOCItemType, RehypeTocOptions, RemarkAdmonitionOptions, RemarkCodeTabOptions, RemarkDirectiveAdmonitionOptions, RemarkFeedbackBlockOptions, type RemarkGfmOptions, RemarkHeadingOptions, RemarkImageOptions, RemarkIncludeOptions, type RemarkMdxFilesOptions, RemarkMdxMermaidOptions, RemarkNpmOptions, RemarkStepsOptions, StructureOptions, StructuredData, StructuredDataContent, extractCodeRegion, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeHeading, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkInclude, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkShow, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { remarkGfm } from "./remark-gfm.js";
|
|
2
2
|
import { rehypeCode, rehypeCodeDefaultOptions } from "./rehype-code.js";
|
|
3
3
|
import { remarkImage } from "./remark-image.js";
|
|
4
|
-
import { i as transformerTab } from "../rehype-code.core-
|
|
4
|
+
import { i as transformerTab } from "../rehype-code.core-aegwEr3K.js";
|
|
5
5
|
import { transformerIcon } from "./transformer-icon.js";
|
|
6
6
|
import { extractCodeRegion, remarkInclude } from "./remark-include.js";
|
|
7
|
-
import {
|
|
8
|
-
import { remarkHeading } from "./remark-heading.js";
|
|
7
|
+
import { n as remarkStructureDefaultOptions, r as structure, t as remarkStructure } from "../remark-structure-DG_c2J4O.js";
|
|
8
|
+
import { rehypeHeading, remarkHeading } from "./remark-heading.js";
|
|
9
9
|
import { remarkAdmonition } from "./remark-admonition.js";
|
|
10
10
|
import { remarkDirectiveAdmonition } from "./remark-directive-admonition.js";
|
|
11
11
|
import { rehypeToc } from "./rehype-toc.js";
|
|
12
|
-
import { remarkCodeTab } from "
|
|
12
|
+
import { t as remarkCodeTab } from "../remark-code-tab-CS8aN0DX.js";
|
|
13
13
|
import { remarkSteps } from "./remark-steps.js";
|
|
14
14
|
import { remarkNpm } from "./remark-npm.js";
|
|
15
15
|
import { generateCodeBlockTabs, parseCodeBlockAttributes } from "./codeblock-utils.js";
|
|
@@ -17,4 +17,4 @@ import { remarkMdxFiles } from "./remark-mdx-files.js";
|
|
|
17
17
|
import { remarkMdxMermaid } from "./remark-mdx-mermaid.js";
|
|
18
18
|
import { remarkFeedbackBlock } from "./remark-feedback-block.js";
|
|
19
19
|
import { remarkShow } from "./remark-show.js";
|
|
20
|
-
export { extractCodeRegion, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkInclude, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkShow, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
20
|
+
export { extractCodeRegion, generateCodeBlockTabs, parseCodeBlockAttributes, rehypeCode, rehypeCodeDefaultOptions, rehypeHeading, rehypeToc, remarkAdmonition, remarkCodeTab, remarkDirectiveAdmonition, remarkFeedbackBlock, remarkGfm, remarkHeading, remarkImage, remarkInclude, remarkMdxFiles, remarkMdxMermaid, remarkNpm, remarkShow, remarkSteps, remarkStructure, remarkStructureDefaultOptions, structure, transformerIcon, transformerTab };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as transformerTab, n as rehypeCodeDefaultOptions, r as rehypeCodeFromHighlighter, t as createRehypeCode } from "../rehype-code.core-
|
|
1
|
+
import { i as transformerTab, n as rehypeCodeDefaultOptions, r as rehypeCodeFromHighlighter, t as createRehypeCode } from "../rehype-code.core-aegwEr3K.js";
|
|
2
2
|
import { transformerIcon } from "./transformer-icon.js";
|
|
3
3
|
export { createRehypeCode, rehypeCodeDefaultOptions, rehypeCodeFromHighlighter, transformerIcon, transformerTab };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defaultShikiFactory, wasmShikiFactory } from "../highlight/shiki/full.js";
|
|
2
|
-
import { i as transformerTab, n as rehypeCodeDefaultOptions$1, t as createRehypeCode } from "../rehype-code.core-
|
|
2
|
+
import { i as transformerTab, n as rehypeCodeDefaultOptions$1, t as createRehypeCode } from "../rehype-code.core-aegwEr3K.js";
|
|
3
3
|
import { transformerIcon } from "./transformer-icon.js";
|
|
4
4
|
// src/mdx-plugins/rehype-code.ts
|
|
5
5
|
const rehypeCodeDefaultOptions = {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as RehypeTocOptions, r as rehypeToc, t as RehypeTOCItemType } from "../rehype-toc-
|
|
1
|
+
import { n as RehypeTocOptions, r as rehypeToc, t as RehypeTOCItemType } from "../rehype-toc-B0HyD0yu.js";
|
|
2
2
|
export { RehypeTOCItemType, RehypeTocOptions, rehypeToc };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as handleTag, c as toEsm, n as esmScope } from "../utils-DfA1qEJN.js";
|
|
2
|
+
import { a as listCode, i as jsxComponents, m as walkBranches, n as componentsCode, u as isStaticOutput } from "../code-output-CTZ8RNSo.js";
|
|
3
|
+
import { n as stepNumberCode } from "../steps-D4-CDiVv.js";
|
|
2
4
|
import { toEstree } from "hast-util-to-estree";
|
|
3
5
|
// src/mdx-plugins/rehype-toc.ts
|
|
4
6
|
const TocOnlyTag = "[toc]";
|
|
@@ -27,123 +29,85 @@ function rehypeToc({ exportToc = true } = {}) {
|
|
|
27
29
|
as: "esm",
|
|
28
30
|
name: "toc"
|
|
29
31
|
};
|
|
30
|
-
if (exportToc === false) return () => void 0;
|
|
31
32
|
return (tree, file) => {
|
|
33
|
+
/** `hidden` is a step that isn't in the TOC, which counts among the steps */
|
|
32
34
|
const items = [];
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
if (typeof id !== "string") return "skip";
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (noToc !== false) {
|
|
43
|
-
last.value = noToc;
|
|
44
|
-
return "skip";
|
|
45
|
-
}
|
|
46
|
-
const tocOnly = handleTag(last.value, TocOnlyTag);
|
|
47
|
-
if (tocOnly !== false) {
|
|
48
|
-
isTocOnly = true;
|
|
49
|
-
last.value = tocOnly;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
items.push({
|
|
53
|
-
title: element,
|
|
54
|
-
depth: Number(element.tagName[1]),
|
|
35
|
+
walkBranches(tree, (node, when, parent) => {
|
|
36
|
+
if (node.type !== "element" || !HeadingTags.has(node.tagName)) return;
|
|
37
|
+
const { id } = node.properties;
|
|
38
|
+
const last = node.children.at(-1);
|
|
39
|
+
if (typeof id !== "string" || !last) return "skip";
|
|
40
|
+
const text = last.type === "text" ? last : void 0;
|
|
41
|
+
const item = {
|
|
42
|
+
title: node,
|
|
43
|
+
depth: Number(node.tagName[1]),
|
|
55
44
|
url: `#${id}`,
|
|
56
|
-
_step: getStep(
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
_step: getStep(node.properties),
|
|
46
|
+
when
|
|
47
|
+
};
|
|
48
|
+
const noToc = text && handleTag(text.value, NoTocTag);
|
|
49
|
+
if (typeof noToc === "string") {
|
|
50
|
+
text.value = noToc;
|
|
51
|
+
if (item._step !== void 0) items.push({
|
|
52
|
+
...item,
|
|
53
|
+
hidden: true
|
|
54
|
+
});
|
|
55
|
+
return "skip";
|
|
56
|
+
}
|
|
57
|
+
const tocOnly = text && handleTag(text.value, TocOnlyTag);
|
|
58
|
+
if (typeof tocOnly === "string") {
|
|
59
|
+
text.value = tocOnly;
|
|
60
|
+
const siblings = parent.children;
|
|
61
|
+
siblings.splice(siblings.indexOf(node), 1);
|
|
62
|
+
}
|
|
63
|
+
items.push(item);
|
|
59
64
|
return "skip";
|
|
60
65
|
});
|
|
66
|
+
if (exportToc === false) return;
|
|
61
67
|
if (exportToc.as === "esm") {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
const titles = [];
|
|
69
|
+
const list = [];
|
|
70
|
+
const components = /* @__PURE__ */ new Set();
|
|
71
|
+
const isStatic = isStaticOutput(file.data);
|
|
72
|
+
const numbers = file.data._show ? stepNumberCode() : void 0;
|
|
73
|
+
for (const { title, when, url, depth, _step, hidden } of items) {
|
|
74
|
+
const step = _step === void 0 ? void 0 : numbers?.next(_step, depth) ?? String(_step);
|
|
75
|
+
if (hidden) {
|
|
76
|
+
if (numbers) list.push({
|
|
77
|
+
code: step,
|
|
78
|
+
when,
|
|
79
|
+
run: true
|
|
80
|
+
});
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
const { children } = toJsx(title);
|
|
84
|
+
jsxComponents(children, components);
|
|
85
|
+
const i = titles.push({
|
|
86
|
+
type: "JSXFragment",
|
|
87
|
+
openingFragment: { type: "JSXOpeningFragment" },
|
|
88
|
+
closingFragment: { type: "JSXClosingFragment" },
|
|
89
|
+
children
|
|
90
|
+
});
|
|
91
|
+
const id = file.data._headingIds?.[url.slice(1)];
|
|
92
|
+
let code = `{depth: ${depth}, url: ${id ? `"#" + ${id}` : JSON.stringify(url)}`;
|
|
93
|
+
if (step) code += `, _step: ${step}`;
|
|
94
|
+
list.push({
|
|
95
|
+
code: `${code}, title: _fumadocs${i - 1}}`,
|
|
96
|
+
when
|
|
71
97
|
});
|
|
72
98
|
}
|
|
73
|
-
tree.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
type: "Property",
|
|
81
|
-
method: false,
|
|
82
|
-
shorthand: false,
|
|
83
|
-
computed: false,
|
|
84
|
-
key: {
|
|
85
|
-
type: "Identifier",
|
|
86
|
-
name: "depth"
|
|
87
|
-
},
|
|
88
|
-
value: {
|
|
89
|
-
type: "Literal",
|
|
90
|
-
value: item.depth
|
|
91
|
-
},
|
|
92
|
-
kind: "init"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
type: "Property",
|
|
96
|
-
method: false,
|
|
97
|
-
shorthand: false,
|
|
98
|
-
computed: false,
|
|
99
|
-
key: {
|
|
100
|
-
type: "Identifier",
|
|
101
|
-
name: "url"
|
|
102
|
-
},
|
|
103
|
-
value: {
|
|
104
|
-
type: "Literal",
|
|
105
|
-
value: item.url
|
|
106
|
-
},
|
|
107
|
-
kind: "init"
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
type: "Property",
|
|
111
|
-
method: false,
|
|
112
|
-
shorthand: false,
|
|
113
|
-
computed: false,
|
|
114
|
-
key: {
|
|
115
|
-
type: "Identifier",
|
|
116
|
-
name: "title"
|
|
117
|
-
},
|
|
118
|
-
value: {
|
|
119
|
-
type: "JSXFragment",
|
|
120
|
-
openingFragment: { type: "JSXOpeningFragment" },
|
|
121
|
-
closingFragment: { type: "JSXClosingFragment" },
|
|
122
|
-
children: item.title.children
|
|
123
|
-
},
|
|
124
|
-
kind: "init"
|
|
125
|
-
}
|
|
126
|
-
]
|
|
127
|
-
};
|
|
128
|
-
if (typeof item._step === "number") obj.properties.push({
|
|
129
|
-
type: "Property",
|
|
130
|
-
method: false,
|
|
131
|
-
shorthand: false,
|
|
132
|
-
computed: false,
|
|
133
|
-
key: {
|
|
134
|
-
type: "Identifier",
|
|
135
|
-
name: "_step"
|
|
136
|
-
},
|
|
137
|
-
value: {
|
|
138
|
-
type: "Literal",
|
|
139
|
-
value: item._step
|
|
140
|
-
},
|
|
141
|
-
kind: "init"
|
|
142
|
-
});
|
|
143
|
-
return obj;
|
|
144
|
-
})
|
|
145
|
-
}));
|
|
146
|
-
} else file.data.rehypeToc = items;
|
|
99
|
+
const declaration = componentsCode(components, esmScope(tree), "props.components ?? {}", "((props) => props.children)");
|
|
100
|
+
tree.children.push(toEsm(`export const ${exportToc.name} = ${listCode(list, isStatic, (numbers?.declaration ?? "") + declaration)};`, titles));
|
|
101
|
+
} else {
|
|
102
|
+
file.data.rehypeToc = [];
|
|
103
|
+
for (const { when: _, hidden, ...item } of items) if (!hidden) file.data.rehypeToc.push(item);
|
|
104
|
+
}
|
|
147
105
|
};
|
|
148
106
|
}
|
|
107
|
+
function toJsx(element) {
|
|
108
|
+
return toEstree(element, {
|
|
109
|
+
elementAttributeNameCase: "react",
|
|
110
|
+
stylePropertyNameCase: "dom"
|
|
111
|
+
}).body[0].expression;
|
|
112
|
+
}
|
|
149
113
|
export { rehypeToc };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as remarkCodeTab, t as RemarkCodeTabOptions } from "../remark-code-tab-
|
|
1
|
+
import { n as remarkCodeTab, t as RemarkCodeTabOptions } from "../remark-code-tab-Bp3EItqr.js";
|
|
2
2
|
export { RemarkCodeTabOptions, remarkCodeTab };
|