feat: allow overriding mdit-vue/component options

pull/2876/head
Divyansh Singh 1 year ago
parent 21b4f8caad
commit 4f01f1a09c

@ -1,4 +1,7 @@
import { componentPlugin } from '@mdit-vue/plugin-component' import {
componentPlugin,
type ComponentPluginOptions
} from '@mdit-vue/plugin-component'
import { import {
frontmatterPlugin, frontmatterPlugin,
type FrontmatterPluginOptions type FrontmatterPluginOptions
@ -52,6 +55,7 @@ export interface MarkdownOptions extends MarkdownIt.Options {
toc?: TocPluginOptions toc?: TocPluginOptions
externalLinks?: Record<string, string> externalLinks?: Record<string, string>
cache?: boolean cache?: boolean
component?: ComponentPluginOptions
} }
export type MarkdownRenderer = MarkdownIt export type MarkdownRenderer = MarkdownIt
@ -86,7 +90,7 @@ export const createMarkdownRenderer = async (
} }
// custom plugins // custom plugins
md.use(componentPlugin) md.use(componentPlugin, { ...options.component })
.use(highlightLinePlugin) .use(highlightLinePlugin)
.use(preWrapperPlugin, { hasSingleTheme }) .use(preWrapperPlugin, { hasSingleTheme })
.use(snippetPlugin, srcDir) .use(snippetPlugin, srcDir)

Loading…
Cancel
Save