From 4f01f1a09c84fced276e1a138a59ed1b9679ce15 Mon Sep 17 00:00:00 2001 From: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> Date: Mon, 28 Aug 2023 21:22:33 +0530 Subject: [PATCH] feat: allow overriding mdit-vue/component options --- src/node/markdown/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/node/markdown/index.ts b/src/node/markdown/index.ts index be580265..54c2b3e2 100644 --- a/src/node/markdown/index.ts +++ b/src/node/markdown/index.ts @@ -1,4 +1,7 @@ -import { componentPlugin } from '@mdit-vue/plugin-component' +import { + componentPlugin, + type ComponentPluginOptions +} from '@mdit-vue/plugin-component' import { frontmatterPlugin, type FrontmatterPluginOptions @@ -52,6 +55,7 @@ export interface MarkdownOptions extends MarkdownIt.Options { toc?: TocPluginOptions externalLinks?: Record cache?: boolean + component?: ComponentPluginOptions } export type MarkdownRenderer = MarkdownIt @@ -86,7 +90,7 @@ export const createMarkdownRenderer = async ( } // custom plugins - md.use(componentPlugin) + md.use(componentPlugin, { ...options.component }) .use(highlightLinePlugin) .use(preWrapperPlugin, { hasSingleTheme }) .use(snippetPlugin, srcDir)