mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
22 lines
605 B
TypeScript
22 lines
605 B
TypeScript
import type { Plugin } from '@vuepress/core'
|
|
import { highlight } from './highlight.js'
|
|
import type { HighlighterOptions } from './types'
|
|
|
|
/**
|
|
* Options of @vuepress/plugin-shiki
|
|
*/
|
|
export type ShikijiPluginOptions = HighlighterOptions
|
|
|
|
export function shikijiPlugin(options: ShikijiPluginOptions = {}): Plugin {
|
|
return {
|
|
name: '@vuepress-plume/plugin-shikiji',
|
|
|
|
extendsMarkdown: async (md) => {
|
|
const theme = options.theme ?? { light: 'github-light', dark: 'github-dark' }
|
|
const highlighter = await highlight(theme, options)
|
|
|
|
md.options.highlight = highlighter
|
|
},
|
|
}
|
|
}
|