fumadocs-mdx 14.2.3 → 14.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 (116) hide show
  1. package/dist/adapter-DI4cexsC.js +145 -0
  2. package/dist/adapter-DI4cexsC.js.map +1 -0
  3. package/dist/bin.d.ts +1 -1
  4. package/dist/bin.js +21 -12
  5. package/dist/bin.js.map +1 -0
  6. package/dist/build-BTTNEFmV.js +100 -0
  7. package/dist/build-BTTNEFmV.js.map +1 -0
  8. package/dist/build-mdx-10MrLupc.d.ts +53 -0
  9. package/dist/build-mdx-10MrLupc.d.ts.map +1 -0
  10. package/dist/build-mdx-BVeBo4jT.js +153 -0
  11. package/dist/build-mdx-BVeBo4jT.js.map +1 -0
  12. package/dist/build-mdx-ChjP7zAn.js +5 -0
  13. package/dist/bun/index.d.ts +10 -21
  14. package/dist/bun/index.d.ts.map +1 -0
  15. package/dist/bun/index.js +30 -49
  16. package/dist/bun/index.js.map +1 -0
  17. package/dist/codegen-DleOVLNr.js +101 -0
  18. package/dist/codegen-DleOVLNr.js.map +1 -0
  19. package/dist/config/index.d.ts +2 -18
  20. package/dist/config/index.js +50 -53
  21. package/dist/config/index.js.map +1 -0
  22. package/dist/core-DG43f_AU.d.ts +364 -0
  23. package/dist/core-DG43f_AU.d.ts.map +1 -0
  24. package/dist/core-DjldE3H9.js +212 -0
  25. package/dist/core-DjldE3H9.js.map +1 -0
  26. package/dist/fuma-matter-CHgJa_-B.js +27 -0
  27. package/dist/fuma-matter-CHgJa_-B.js.map +1 -0
  28. package/dist/index-Bc_4I1HE.d.ts +12 -0
  29. package/dist/index-Bc_4I1HE.d.ts.map +1 -0
  30. package/dist/index-file-D9HsrWU_.js +264 -0
  31. package/dist/index-file-D9HsrWU_.js.map +1 -0
  32. package/dist/index.d.ts +3 -61
  33. package/dist/index.js +1 -0
  34. package/dist/load-from-file-B7Rswy9i.js +5 -0
  35. package/dist/load-from-file-Doc98oEB.js +38 -0
  36. package/dist/load-from-file-Doc98oEB.js.map +1 -0
  37. package/dist/loaders-BVwYfelL.js +7 -0
  38. package/dist/loaders-BVwYfelL.js.map +1 -0
  39. package/dist/mdx-CRT-jSh5.js +91 -0
  40. package/dist/mdx-CRT-jSh5.js.map +1 -0
  41. package/dist/meta-BKBx8Gab.js +81 -0
  42. package/dist/meta-BKBx8Gab.js.map +1 -0
  43. package/dist/next/index.cjs +863 -1076
  44. package/dist/next/index.d.ts +17 -28
  45. package/dist/next/index.d.ts.map +1 -0
  46. package/dist/next/index.js +141 -170
  47. package/dist/next/index.js.map +1 -0
  48. package/dist/node/loader.d.ts +4 -2
  49. package/dist/node/loader.d.ts.map +1 -0
  50. package/dist/node/loader.js +26 -38
  51. package/dist/node/loader.js.map +1 -0
  52. package/dist/plugins/index-file.d.ts +2 -14
  53. package/dist/plugins/index-file.js +5 -8
  54. package/dist/plugins/json-schema.d.ts +14 -23
  55. package/dist/plugins/json-schema.d.ts.map +1 -0
  56. package/dist/plugins/json-schema.js +70 -78
  57. package/dist/plugins/json-schema.js.map +1 -0
  58. package/dist/plugins/last-modified.d.ts +21 -32
  59. package/dist/plugins/last-modified.d.ts.map +1 -0
  60. package/dist/plugins/last-modified.js +70 -78
  61. package/dist/plugins/last-modified.js.map +1 -0
  62. package/dist/preset-gmDZnBcg.js +61 -0
  63. package/dist/preset-gmDZnBcg.js.map +1 -0
  64. package/dist/remark-include-D3G3mAnv.js +247 -0
  65. package/dist/remark-include-D3G3mAnv.js.map +1 -0
  66. package/dist/runtime/browser.d.ts +33 -42
  67. package/dist/runtime/browser.d.ts.map +1 -0
  68. package/dist/runtime/browser.js +54 -63
  69. package/dist/runtime/browser.js.map +1 -0
  70. package/dist/runtime/dynamic.d.ts +13 -21
  71. package/dist/runtime/dynamic.d.ts.map +1 -0
  72. package/dist/runtime/dynamic.js +64 -76
  73. package/dist/runtime/dynamic.js.map +1 -0
  74. package/dist/runtime/server.d.ts +2 -14
  75. package/dist/runtime/server.js +111 -8
  76. package/dist/runtime/server.js.map +1 -0
  77. package/dist/runtime/types.d.ts +2 -61
  78. package/dist/runtime/types.js +1 -0
  79. package/dist/types-B6myALSk.d.ts +63 -0
  80. package/dist/types-B6myALSk.d.ts.map +1 -0
  81. package/dist/vite/index.d.ts +28 -39
  82. package/dist/vite/index.d.ts.map +1 -0
  83. package/dist/vite/index.js +79 -122
  84. package/dist/vite/index.js.map +1 -0
  85. package/dist/webpack/mdx.d.ts +6 -3
  86. package/dist/webpack/mdx.d.ts.map +1 -0
  87. package/dist/webpack/mdx.js +21 -34
  88. package/dist/webpack/mdx.js.map +1 -0
  89. package/dist/webpack/meta.d.ts +6 -3
  90. package/dist/webpack/meta.d.ts.map +1 -0
  91. package/dist/webpack/meta.js +23 -37
  92. package/dist/webpack/meta.js.map +1 -0
  93. package/dist/webpack--VSEE6Zp.js +15 -0
  94. package/dist/webpack--VSEE6Zp.js.map +1 -0
  95. package/loader-mdx.cjs +1 -3
  96. package/loader-meta.cjs +1 -3
  97. package/package.json +40 -40
  98. package/dist/build-mdx-5XLFMP5P.js +0 -8
  99. package/dist/chunk-257RZJEQ.js +0 -17
  100. package/dist/chunk-2PY3JUIC.js +0 -126
  101. package/dist/chunk-4EUH5CD2.js +0 -173
  102. package/dist/chunk-4JSFLXXT.js +0 -8
  103. package/dist/chunk-5OBUOALK.js +0 -141
  104. package/dist/chunk-DTFUANSF.js +0 -40
  105. package/dist/chunk-KWSETXYC.js +0 -274
  106. package/dist/chunk-OLD35ARB.js +0 -116
  107. package/dist/chunk-RSASAHLX.js +0 -91
  108. package/dist/chunk-S7KOJHHO.js +0 -89
  109. package/dist/chunk-STLEUNK7.js +0 -335
  110. package/dist/chunk-USQZ5OLE.js +0 -116
  111. package/dist/chunk-VWJKRQZR.js +0 -19
  112. package/dist/chunk-WFDF56IJ.js +0 -290
  113. package/dist/chunk-XYVVDDIF.js +0 -180
  114. package/dist/core-X5ggQtBM.d.ts +0 -350
  115. package/dist/index-BqkSNsGO.d.ts +0 -8
  116. package/dist/load-from-file-FHW724YY.js +0 -8
@@ -1,274 +0,0 @@
1
- import {
2
- ident
3
- } from "./chunk-2PY3JUIC.js";
4
-
5
- // src/utils/validation.ts
6
- var ValidationError = class extends Error {
7
- constructor(message, issues) {
8
- super(
9
- `${message}:
10
- ${issues.map((issue) => ` ${issue.path}: ${issue.message}`).join("\n")}`
11
- );
12
- this.title = message;
13
- this.issues = issues;
14
- }
15
- async toStringFormatted() {
16
- const picocolorsModule = await import("picocolors");
17
- const picocolors = picocolorsModule.default ?? picocolorsModule;
18
- return [
19
- picocolors.bold(`[MDX] ${this.title}:`),
20
- ...this.issues.map(
21
- (issue) => picocolors.redBright(
22
- `- ${picocolors.bold(issue.path?.join(".") ?? "*")}: ${issue.message}`
23
- )
24
- )
25
- ].join("\n");
26
- }
27
- };
28
- async function validate(schema, data, context, errorMessage) {
29
- if (typeof schema === "function" && !("~standard" in schema)) {
30
- schema = schema(context);
31
- }
32
- if ("~standard" in schema) {
33
- const result = await schema["~standard"].validate(
34
- data
35
- );
36
- if (result.issues) {
37
- throw new ValidationError(errorMessage, result.issues);
38
- }
39
- return result.value;
40
- }
41
- return data;
42
- }
43
-
44
- // src/core.ts
45
- import path from "path";
46
- import fs from "fs/promises";
47
- var _Defaults = {
48
- configPath: "source.config.ts",
49
- outDir: ".source"
50
- };
51
- async function getPlugins(pluginOptions) {
52
- const plugins = [];
53
- for await (const option of pluginOptions) {
54
- if (!option) continue;
55
- if (Array.isArray(option)) plugins.push(...await getPlugins(option));
56
- else plugins.push(option);
57
- }
58
- return plugins;
59
- }
60
- function createCore(options) {
61
- let config;
62
- let plugins;
63
- const workspaces = /* @__PURE__ */ new Map();
64
- async function transformMetadata({
65
- collection,
66
- filePath,
67
- source
68
- }, data) {
69
- if (collection.schema) {
70
- data = await validate(
71
- collection.schema,
72
- data,
73
- { path: filePath, source },
74
- collection.type === "doc" ? `invalid frontmatter in ${filePath}` : `invalid data in ${filePath}`
75
- );
76
- }
77
- return data;
78
- }
79
- return {
80
- /**
81
- * Convenient cache store, reset when config changes
82
- */
83
- cache: /* @__PURE__ */ new Map(),
84
- async init({ config: newConfig }) {
85
- config = await newConfig;
86
- this.cache.clear();
87
- workspaces.clear();
88
- plugins = await getPlugins([
89
- postprocessPlugin(),
90
- options.plugins,
91
- config.global.plugins
92
- ]);
93
- for (const plugin of plugins) {
94
- const out = await plugin.config?.call(this.getPluginContext(), config);
95
- if (out) config = out;
96
- }
97
- if (!options.workspace) {
98
- await Promise.all(
99
- Object.entries(config.workspaces).map(async ([name, workspace]) => {
100
- const core = createCore({
101
- ...options,
102
- outDir: path.join(options.outDir, name),
103
- workspace: {
104
- name,
105
- parent: this,
106
- dir: workspace.dir
107
- }
108
- });
109
- await core.init({ config: workspace.config });
110
- workspaces.set(name, core);
111
- })
112
- );
113
- }
114
- },
115
- getWorkspaces() {
116
- return workspaces;
117
- },
118
- getOptions() {
119
- return options;
120
- },
121
- getConfig() {
122
- return config;
123
- },
124
- /**
125
- * The file path of compiled config file, the file may not exist (e.g. on Vite, or still compiling)
126
- */
127
- getCompiledConfigPath() {
128
- return path.join(options.outDir, "source.config.mjs");
129
- },
130
- getPlugins() {
131
- return plugins;
132
- },
133
- getCollections() {
134
- return Array.from(config.collections.values());
135
- },
136
- getCollection(name) {
137
- return config.collections.get(name);
138
- },
139
- getPluginContext() {
140
- return {
141
- core: this
142
- };
143
- },
144
- async initServer(server) {
145
- const ctx = this.getPluginContext();
146
- for (const plugin of plugins) {
147
- await plugin.configureServer?.call(ctx, server);
148
- }
149
- for (const workspace of workspaces.values()) {
150
- await workspace.initServer(server);
151
- }
152
- },
153
- async emit(emitOptions = {}) {
154
- const { filterPlugin, filterWorkspace, write = false } = emitOptions;
155
- const start = performance.now();
156
- const ctx = this.getPluginContext();
157
- const added = /* @__PURE__ */ new Set();
158
- const out = {
159
- entries: [],
160
- workspaces: {}
161
- };
162
- for (const li of await Promise.all(
163
- plugins.map((plugin) => {
164
- if (filterPlugin && !filterPlugin(plugin) || !plugin.emit) return;
165
- return plugin.emit.call(ctx);
166
- })
167
- )) {
168
- if (!li) continue;
169
- for (const item of li) {
170
- if (added.has(item.path)) continue;
171
- out.entries.push(item);
172
- added.add(item.path);
173
- }
174
- }
175
- if (write) {
176
- await Promise.all(
177
- out.entries.map(async (entry) => {
178
- const file = path.join(options.outDir, entry.path);
179
- await fs.mkdir(path.dirname(file), { recursive: true });
180
- await fs.writeFile(file, entry.content);
181
- })
182
- );
183
- console.log(
184
- options.workspace ? `[MDX: ${options.workspace.name}] generated files in ${performance.now() - start}ms` : `[MDX] generated files in ${performance.now() - start}ms`
185
- );
186
- }
187
- for (const [name, workspace] of workspaces) {
188
- if (filterWorkspace && !filterWorkspace(name)) continue;
189
- out.workspaces[name] = (await workspace.emit(emitOptions)).entries;
190
- }
191
- return out;
192
- },
193
- async transformMeta(options2, data) {
194
- const ctx = {
195
- ...this.getPluginContext(),
196
- ...options2
197
- };
198
- data = await transformMetadata(options2, data);
199
- for (const plugin of plugins) {
200
- if (plugin.meta?.transform)
201
- data = await plugin.meta.transform.call(ctx, data) ?? data;
202
- }
203
- return data;
204
- },
205
- async transformFrontmatter(options2, data) {
206
- const ctx = {
207
- ...this.getPluginContext(),
208
- ...options2
209
- };
210
- data = await transformMetadata(options2, data);
211
- for (const plugin of plugins) {
212
- if (plugin.doc?.frontmatter)
213
- data = await plugin.doc.frontmatter.call(ctx, data) ?? data;
214
- }
215
- return data;
216
- },
217
- async transformVFile(options2, file) {
218
- const ctx = {
219
- ...this.getPluginContext(),
220
- ...options2
221
- };
222
- for (const plugin of plugins) {
223
- if (plugin.doc?.vfile)
224
- file = await plugin.doc.vfile.call(ctx, file) ?? file;
225
- }
226
- return file;
227
- }
228
- };
229
- }
230
- function postprocessPlugin() {
231
- const LinkReferenceTypes = `{
232
- /**
233
- * extracted references (e.g. hrefs, paths), useful for analyzing relationships between pages.
234
- */
235
- extractedReferences: import("fumadocs-mdx").ExtractedReference[];
236
- }`;
237
- return {
238
- "index-file": {
239
- generateTypeConfig() {
240
- const lines = [];
241
- lines.push("{");
242
- lines.push(" DocData: {");
243
- for (const collection of this.core.getCollections()) {
244
- let postprocessOptions;
245
- switch (collection.type) {
246
- case "doc":
247
- postprocessOptions = collection.postprocess;
248
- break;
249
- case "docs":
250
- postprocessOptions = collection.docs.postprocess;
251
- break;
252
- }
253
- if (postprocessOptions?.extractLinkReferences) {
254
- lines.push(ident(`${collection.name}: ${LinkReferenceTypes},`, 2));
255
- }
256
- }
257
- lines.push(" }");
258
- lines.push("}");
259
- return lines.join("\n");
260
- },
261
- serverOptions(options) {
262
- options.doc ??= {};
263
- options.doc.passthroughs ??= [];
264
- options.doc.passthroughs.push("extractedReferences");
265
- }
266
- }
267
- };
268
- }
269
-
270
- export {
271
- ValidationError,
272
- _Defaults,
273
- createCore
274
- };
@@ -1,116 +0,0 @@
1
- import {
2
- applyMdxPreset
3
- } from "./chunk-S7KOJHHO.js";
4
-
5
- // src/config/build.ts
6
- import picomatch from "picomatch";
7
- import path from "path";
8
- var SupportedFormats = {
9
- doc: ["mdx", "md"],
10
- meta: ["json", "yaml"]
11
- };
12
- function buildCollection(name, collection, cwd) {
13
- if (collection.type === "docs") {
14
- return {
15
- ...collection,
16
- type: "docs",
17
- get dir() {
18
- return this.docs.dir;
19
- },
20
- name,
21
- meta: buildCollection(name, collection.meta, cwd),
22
- docs: buildCollection(name, collection.docs, cwd),
23
- hasFile(filePath) {
24
- return this.docs.hasFile(filePath) || this.meta.hasFile(filePath);
25
- },
26
- isFileSupported(filePath) {
27
- return this.docs.isFileSupported(filePath) || this.meta.isFileSupported(filePath);
28
- },
29
- cwd
30
- };
31
- }
32
- return {
33
- ...collection,
34
- ...buildPrimitiveCollection(name, collection, cwd)
35
- };
36
- }
37
- function buildPrimitiveCollection(name, config, cwd) {
38
- const supportedFormats = SupportedFormats[config.type];
39
- const patterns = config.files ?? [`**/*.{${supportedFormats.join(",")}}`];
40
- let matcher;
41
- return {
42
- dir: path.resolve(cwd, config.dir),
43
- cwd,
44
- name,
45
- patterns,
46
- isFileSupported(filePath) {
47
- return supportedFormats.some((format) => filePath.endsWith(`.${format}`));
48
- },
49
- hasFile(filePath) {
50
- if (!this.isFileSupported(filePath)) return false;
51
- const relativePath = path.relative(this.dir, filePath);
52
- if (relativePath.startsWith(`..${path.sep}`)) return false;
53
- return (matcher ??= picomatch(patterns))(relativePath);
54
- }
55
- };
56
- }
57
- function buildConfig(config, cwd = process.cwd()) {
58
- const collections = /* @__PURE__ */ new Map();
59
- const loaded = {};
60
- for (const [k, v] of Object.entries(config)) {
61
- if (!v) {
62
- continue;
63
- }
64
- if (typeof v === "object" && "type" in v) {
65
- if (v.type === "docs" || v.type === "doc" || v.type === "meta") {
66
- collections.set(k, buildCollection(k, v, cwd));
67
- continue;
68
- }
69
- }
70
- if (k === "default" && v) {
71
- Object.assign(loaded, v);
72
- continue;
73
- }
74
- throw new Error(
75
- `Unknown export "${k}", you can only export collections from source configuration file.`
76
- );
77
- }
78
- const mdxOptionsCache = /* @__PURE__ */ new Map();
79
- return {
80
- global: loaded,
81
- collections,
82
- workspaces: Object.fromEntries(
83
- Object.entries(loaded.workspaces ?? {}).map(([key, value]) => {
84
- return [
85
- key,
86
- {
87
- dir: value.dir,
88
- config: buildConfig(value.config, path.resolve(cwd, value.dir))
89
- }
90
- ];
91
- })
92
- ),
93
- getMDXOptions(collection, environment = "bundler") {
94
- const key = collection ? `${environment}:${collection.name}` : environment;
95
- const cached = mdxOptionsCache.get(key);
96
- if (cached) return cached;
97
- let result;
98
- if (collection?.mdxOptions) {
99
- const optionsFn = collection.mdxOptions;
100
- result = typeof optionsFn === "function" ? optionsFn(environment) : optionsFn;
101
- } else {
102
- result = (async () => {
103
- const optionsFn = this.global.mdxOptions;
104
- const options = typeof optionsFn === "function" ? await optionsFn() : optionsFn;
105
- return applyMdxPreset(options)(environment);
106
- })();
107
- }
108
- mdxOptionsCache.set(key, result);
109
- return result;
110
- }
111
- };
112
- }
113
-
114
- export {
115
- buildConfig
116
- };
@@ -1,91 +0,0 @@
1
- import {
2
- metaLoaderGlob
3
- } from "./chunk-4JSFLXXT.js";
4
-
5
- // src/loaders/meta.ts
6
- import { load } from "js-yaml";
7
- import { z } from "zod";
8
- var querySchema = z.object({
9
- collection: z.string().optional(),
10
- workspace: z.string().optional()
11
- }).loose();
12
- function createMetaLoader({ getCore }, resolve = {}) {
13
- const { json: resolveJson = "js" } = resolve;
14
- function parse(filePath, source) {
15
- try {
16
- if (filePath.endsWith(".json")) return JSON.parse(source);
17
- if (filePath.endsWith(".yaml")) return load(source);
18
- } catch (e) {
19
- throw new Error(`invalid data in ${filePath}`, { cause: e });
20
- }
21
- throw new Error("Unknown file type " + filePath);
22
- }
23
- function onMeta(source, { filePath, query }) {
24
- const parsed = querySchema.safeParse(query);
25
- if (!parsed.success || !parsed.data.collection) return null;
26
- const { collection: collectionName, workspace } = parsed.data;
27
- return async () => {
28
- let core = await getCore();
29
- if (workspace) {
30
- core = core.getWorkspaces().get(workspace) ?? core;
31
- }
32
- const collection = core.getCollection(collectionName);
33
- let metaCollection;
34
- switch (collection?.type) {
35
- case "meta":
36
- metaCollection = collection;
37
- break;
38
- case "docs":
39
- metaCollection = collection.meta;
40
- break;
41
- }
42
- const data = parse(filePath, source);
43
- if (!metaCollection) return data;
44
- return core.transformMeta(
45
- {
46
- collection: metaCollection,
47
- filePath,
48
- source
49
- },
50
- data
51
- );
52
- };
53
- }
54
- return {
55
- test: metaLoaderGlob,
56
- async load(input) {
57
- const result = onMeta(await input.getSource(), input);
58
- if (result === null) return null;
59
- const data = await result();
60
- if (input.filePath.endsWith(".json")) {
61
- return {
62
- moduleType: resolveJson,
63
- code: resolveJson === "json" ? JSON.stringify(data) : `export default ${JSON.stringify(data)}`
64
- };
65
- } else {
66
- return {
67
- moduleType: "js",
68
- code: `export default ${JSON.stringify(data)}`
69
- };
70
- }
71
- },
72
- bun: {
73
- load(source, input) {
74
- const result = onMeta(source, input);
75
- if (result === null)
76
- return {
77
- loader: "object",
78
- exports: parse(input.filePath, source)
79
- };
80
- return result().then((data) => ({
81
- loader: "object",
82
- exports: { default: data }
83
- }));
84
- }
85
- }
86
- };
87
- }
88
-
89
- export {
90
- createMetaLoader
91
- };
@@ -1,89 +0,0 @@
1
- // src/config/preset.ts
2
- function pluginOption(def, options = []) {
3
- const list = def(Array.isArray(options) ? options : []).filter(
4
- Boolean
5
- );
6
- if (typeof options === "function") {
7
- return options(list);
8
- }
9
- return list;
10
- }
11
- function applyMdxPreset(options = {}) {
12
- return async (environment = "bundler") => {
13
- if (options.preset === "minimal") return options;
14
- const plugins = await import("fumadocs-core/mdx-plugins");
15
- const {
16
- valueToExport = [],
17
- rehypeCodeOptions,
18
- remarkImageOptions,
19
- remarkHeadingOptions,
20
- remarkStructureOptions,
21
- remarkCodeTabOptions,
22
- remarkNpmOptions,
23
- ...mdxOptions
24
- } = options;
25
- const remarkPlugins = pluginOption(
26
- (v) => [
27
- plugins.remarkGfm,
28
- [
29
- plugins.remarkHeading,
30
- {
31
- generateToc: false,
32
- ...remarkHeadingOptions
33
- }
34
- ],
35
- remarkImageOptions !== false && [
36
- plugins.remarkImage,
37
- {
38
- ...remarkImageOptions,
39
- useImport: remarkImageOptions?.useImport ?? environment === "bundler"
40
- }
41
- ],
42
- "remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [
43
- plugins.remarkCodeTab,
44
- remarkCodeTabOptions
45
- ],
46
- "remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
47
- ...v,
48
- remarkStructureOptions !== false && [
49
- plugins.remarkStructure,
50
- {
51
- exportAs: "structuredData",
52
- ...remarkStructureOptions
53
- }
54
- ],
55
- valueToExport.length > 0 && (() => {
56
- return (_, file) => {
57
- file.data["mdx-export"] ??= [];
58
- for (const name of valueToExport) {
59
- if (!(name in file.data)) continue;
60
- file.data["mdx-export"].push({
61
- name,
62
- value: file.data[name]
63
- });
64
- }
65
- };
66
- })
67
- ],
68
- mdxOptions.remarkPlugins
69
- );
70
- const rehypePlugins = pluginOption(
71
- (v) => [
72
- rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
73
- ...v,
74
- plugins.rehypeToc
75
- ],
76
- mdxOptions.rehypePlugins
77
- );
78
- return {
79
- ...mdxOptions,
80
- outputFormat: environment === "runtime" ? "function-body" : mdxOptions.outputFormat,
81
- remarkPlugins,
82
- rehypePlugins
83
- };
84
- };
85
- }
86
-
87
- export {
88
- applyMdxPreset
89
- };