npm i markdown-it-custom-attrs
import mdItCustomAttrs from 'markdown-it-custom-attrs'
import mdItCustomAttrs from 'markdown-it-custom-attrs' export default { markdown:{ config: (md) => { // use more markdown-it plugins! md.use(mdItCustomAttrs, 'image', { 'data-fancybox': "gallery" }) } } }
.vitepress/config.js
head
export default { head:[ [ "link", { rel: "stylesheet", href: "https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" }, ], ["script", { src: "https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js" }], ] }
京公网安备 11010502049817号