fumadocs-mdx 8.2.14 → 8.2.15

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/config.d.mts CHANGED
@@ -2,8 +2,8 @@ import * as next_dist_shared_lib_image_config from 'next/dist/shared/lib/image-c
2
2
  import * as next_dist_lib_load_custom_routes from 'next/dist/lib/load-custom-routes';
3
3
  import * as next_dist_server_config_shared from 'next/dist/server/config-shared';
4
4
  import { NextConfig } from 'next';
5
- import { RemarkImageOptions, RehypeCodeOptions } from 'fumadocs-core/mdx-plugins';
6
- import { PluggableList } from 'unified';
5
+ import { RemarkHeadingOptions, RemarkImageOptions, RehypeCodeOptions } from 'fumadocs-core/mdx-plugins';
6
+ import { Pluggable } from 'unified';
7
7
  import { Configuration } from 'webpack';
8
8
  import { Options as Options$1 } from './loader-mdx.mjs';
9
9
  import { O as Options } from './search-index-plugin-rijIlRD4.mjs';
@@ -16,10 +16,11 @@ type MDXOptions = Omit<NonNullable<Options$1>, 'rehypePlugins' | 'remarkPlugins'
16
16
  * Properties to export from `vfile.data`
17
17
  */
18
18
  valueToExport?: string[];
19
+ remarkHeadingOptions?: RemarkHeadingOptions;
19
20
  remarkImageOptions?: RemarkImageOptions | false;
20
21
  rehypeCodeOptions?: RehypeCodeOptions | false;
21
22
  };
22
- type ResolvePlugins = PluggableList | ((v: PluggableList) => PluggableList);
23
+ type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
23
24
  interface CreateMDXOptions {
24
25
  cwd?: string;
25
26
  mdxOptions?: MDXOptions;
package/dist/config.mjs CHANGED
@@ -143,7 +143,9 @@ var SearchIndexPlugin = class _SearchIndexPlugin {
143
143
 
144
144
  // src/config.ts
145
145
  function pluginOption(def, options = []) {
146
- const list = def(Array.isArray(options) ? options : []);
146
+ const list = def(Array.isArray(options) ? options : []).filter(
147
+ Boolean
148
+ );
147
149
  if (typeof options === "function") {
148
150
  return options(list);
149
151
  }
@@ -153,6 +155,7 @@ function getMDXLoaderOptions({
153
155
  valueToExport = [],
154
156
  rehypeCodeOptions,
155
157
  remarkImageOptions,
158
+ remarkHeadingOptions,
156
159
  ...mdxOptions
157
160
  }) {
158
161
  const mdxExports = [
@@ -162,23 +165,24 @@ function getMDXLoaderOptions({
162
165
  "lastModified",
163
166
  ...valueToExport
164
167
  ];
165
- const remarkPlugins = pluginOption((v) => {
166
- const plugins = [remarkGfm, remarkHeading];
167
- if (remarkImageOptions !== false)
168
- plugins.push([remarkImage, remarkImageOptions]);
169
- plugins.push(...v, remarkStructure, [
170
- remarkMdxExport,
171
- { values: mdxExports }
172
- ]);
173
- return plugins;
174
- }, mdxOptions.remarkPlugins);
175
- const rehypePlugins = pluginOption((v) => {
176
- const plugins = [...v];
177
- if (rehypeCodeOptions !== false) {
178
- plugins.unshift([rehypeCode, rehypeCodeOptions]);
179
- }
180
- return plugins;
181
- }, mdxOptions.rehypePlugins);
168
+ const remarkPlugins = pluginOption(
169
+ (v) => [
170
+ remarkGfm,
171
+ [remarkHeading, remarkHeadingOptions],
172
+ remarkImageOptions !== false && [remarkImage, remarkImageOptions],
173
+ ...v,
174
+ remarkStructure,
175
+ [remarkMdxExport, { values: mdxExports }]
176
+ ],
177
+ mdxOptions.remarkPlugins
178
+ );
179
+ const rehypePlugins = pluginOption(
180
+ (v) => [
181
+ rehypeCodeOptions !== false && [rehypeCode, rehypeCodeOptions],
182
+ ...v
183
+ ],
184
+ mdxOptions.rehypePlugins
185
+ );
182
186
  return {
183
187
  providerImportSource: "next-mdx-import-source-file",
184
188
  ...mdxOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "8.2.14",
3
+ "version": "8.2.15",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -43,7 +43,7 @@
43
43
  "fast-glob": "^3.3.1",
44
44
  "gray-matter": "^4.0.3",
45
45
  "zod": "^3.23.4",
46
- "fumadocs-core": "11.0.5"
46
+ "fumadocs-core": "11.0.6"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/cross-spawn": "^6.0.6",