diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 62c88e1a..8ac4937c 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -15,9 +15,7 @@ export default defineConfig({ head: [['meta', { name: 'theme-color', content: '#3c8772' }]], markdown: { - headers: { - level: [0, 0] - } + headers: false }, themeConfig: { diff --git a/src/node/markdown/markdown.ts b/src/node/markdown/markdown.ts index 747a2483..54b8edc1 100644 --- a/src/node/markdown/markdown.ts +++ b/src/node/markdown/markdown.ts @@ -44,7 +44,7 @@ export interface MarkdownOptions extends MarkdownIt.Options { } defaultHighlightLang?: string frontmatter?: FrontmatterPluginOptions - headers?: HeadersPluginOptions + headers?: HeadersPluginOptions | false sfc?: SfcPluginOptions theme?: ThemeOptions languages?: ILanguageRegistration[] @@ -101,17 +101,21 @@ export const createMarkdownRenderer = async ( slugify, permalink: anchorPlugin.permalink.ariaHidden({}), ...options.anchor - } as anchorPlugin.AnchorOptions) - .use(frontmatterPlugin, { - ...options.frontmatter - } as FrontmatterPluginOptions) - .use(headersPlugin, { + } as anchorPlugin.AnchorOptions).use(frontmatterPlugin, { + ...options.frontmatter + } as FrontmatterPluginOptions) + + if (options.headers !== false) { + md.use(headersPlugin, { level: [2, 3, 4, 5, 6], + slugify, ...options.headers } as HeadersPluginOptions) - .use(sfcPlugin, { - ...options.sfc - } as SfcPluginOptions) + } + + md.use(sfcPlugin, { + ...options.sfc + } as SfcPluginOptions) .use(titlePlugin) .use(tocPlugin, { ...options.toc