Skip to content

Commit 3c376d6

Browse files
committed
fix: rehype/remark plugin in module options
1 parent 691b2e3 commit 3c376d6

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/utils/content/index.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { Nuxt } from '@nuxt/schema'
55
import { defu } from 'defu'
66
import { createOnigurumaEngine } from 'shiki/engine/oniguruma'
77
import type { ResolvedCollection } from '../../types/collection'
8+
import type { ModuleOptions } from '../../types/module'
89
import { transformContent } from './transformers'
910

1011
let parserOptions = {
@@ -66,16 +67,22 @@ async function _getHighlighPlugin(options: HighlighterOptions) {
6667
}
6768

6869
export async function parseContent(key: string, content: string, collection: ResolvedCollection, nuxt?: Nuxt) {
69-
const markdownOptions = (nuxt?.options as unknown as { mdc: MDCModuleOptions })?.mdc || {}
70+
const mdcOptions = (nuxt?.options as unknown as { mdc: MDCModuleOptions })?.mdc || {}
71+
const contentOptions = (nuxt?.options as unknown as { content: ModuleOptions })?.content?.build?.markdown || {}
7072
const parsedContent = await transformContent(key, content, {
7173
markdown: {
7274
compress: true,
73-
...markdownOptions,
75+
...mdcOptions,
7476
rehypePlugins: {
75-
highlight: markdownOptions.highlight === false
77+
highlight: mdcOptions.highlight === false
7678
? undefined
77-
: await getHighlighPluginInstance(markdownOptions.highlight || {}),
78-
...markdownOptions?.rehypePlugins,
79+
: await getHighlighPluginInstance(mdcOptions.highlight || {}),
80+
...mdcOptions?.rehypePlugins,
81+
...contentOptions?.rehypePlugins,
82+
},
83+
remarkPlugins: {
84+
...mdcOptions?.remarkPlugins,
85+
...contentOptions?.remarkPlugins,
7986
},
8087
highlight: undefined,
8188
},

0 commit comments

Comments
 (0)