From e47e671ab082c6c566b1d0d68ec7096f52b9bbad Mon Sep 17 00:00:00 2001 From: sendevia Date: Sat, 8 Nov 2025 17:35:55 +0800 Subject: [PATCH] feat: refactor markdown plugin configuration and improve code formatting --- .vitepress/config.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 63c4f36..2b3bf1a 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -3,11 +3,14 @@ import packageJson from "../package.json"; // https://github.com/valeriangalliat/markdown-it-anchor import anchor from "markdown-it-anchor"; + // https://mdit-plugins.github.io/footnote.html import { footnote } from "@mdit/plugin-footnote"; + // https://mdit-plugins.github.io/tasklist.html import { tasklist } from "@mdit/plugin-tasklist"; -import { sectionWrapper } from "./theme/utils/sectionWrapper"; + +import { wrapHeadingsAsSections } from "./theme/utils/sectionWrapper"; export default defineConfig({ base: "/", @@ -29,16 +32,16 @@ export default defineConfig({ space: false, }), }, -attrs: { + attrs: { allowedAttributes: ["id", "class"], }, cjkFriendly: true, codeCopyButtonTitle: "复制代码", config(md) { -md.use(footnote); -md.use(sectionWrapper); + md.use(footnote); + md.use(wrapHeadingsAsSections); md.use(tasklist, { label: true }); - }, + }, image: { lazyLoading: true, },