fix: type error in mdx defaults
This commit is contained in:
parent
4226b03579
commit
5fce7a2819
2 changed files with 12 additions and 6 deletions
|
@ -66,11 +66,11 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): Integr
|
||||||
});
|
});
|
||||||
|
|
||||||
const extendMarkdownConfig =
|
const extendMarkdownConfig =
|
||||||
partialMdxOptions.extendMarkdownConfig ?? defaultOptions.extendMarkdownConfig;
|
partialMdxOptions.extendMarkdownConfig ?? defaultMdxOptions.extendMarkdownConfig;
|
||||||
|
|
||||||
const mdxOptions = applyDefaultOptions({
|
const mdxOptions = applyDefaultOptions({
|
||||||
options: partialMdxOptions,
|
options: partialMdxOptions,
|
||||||
defaults: extendMarkdownConfig ? config.markdown : defaultOptions,
|
defaults: withDefaultMdxOptions(extendMarkdownConfig ? config.markdown : markdownConfigDefaults),
|
||||||
});
|
});
|
||||||
|
|
||||||
const mdxPluginOpts: MdxRollupPluginOptions = {
|
const mdxPluginOpts: MdxRollupPluginOptions = {
|
||||||
|
@ -185,14 +185,20 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): Integr
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultOptions: MdxOptions = {
|
const defaultMdxOptions = {
|
||||||
...markdownConfigDefaults,
|
|
||||||
extendMarkdownConfig: true,
|
extendMarkdownConfig: true,
|
||||||
recmaPlugins: [],
|
recmaPlugins: [],
|
||||||
remarkPlugins: [],
|
remarkPlugins: [],
|
||||||
rehypePlugins: [],
|
rehypePlugins: [],
|
||||||
remarkRehype: {},
|
remarkRehype: {},
|
||||||
};
|
}
|
||||||
|
|
||||||
|
function withDefaultMdxOptions(markdownConfig: typeof markdownConfigDefaults): MdxOptions {
|
||||||
|
return {
|
||||||
|
...markdownConfig,
|
||||||
|
...defaultMdxOptions,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
function applyDefaultOptions({
|
function applyDefaultOptions({
|
||||||
options,
|
options,
|
||||||
|
|
|
@ -179,7 +179,7 @@ export function getRehypePlugins(mdxOptions: MdxOptions): MdxRollupPluginOptions
|
||||||
return rehypePlugins;
|
return rehypePlugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ignoreStringPlugins(plugins: any[]) {
|
function ignoreStringPlugins(plugins: any[]): PluggableList {
|
||||||
let validPlugins: PluggableList = [];
|
let validPlugins: PluggableList = [];
|
||||||
let hasInvalidPlugin = false;
|
let hasInvalidPlugin = false;
|
||||||
for (const plugin of plugins) {
|
for (const plugin of plugins) {
|
||||||
|
|
Loading…
Reference in a new issue