Milkdown shiki plugin.
Shiki plugin for milkdown.
安装
npm i @s2nc/milkdown-plugin-shiki
使用
import { shiki, shikiConfig } from '@s2nc/milkdown-plugin-shiki'
import { Milkdown, useEditor } from '@milkdown/vue'
import {rootCtx} from '@milkdown/core'
const { loading, get } = useEditor((root) => {
return Editor.make()
.config((ctx) => {
// ...
// 编辑器初始化配置
ctx.set(rootCtx, root)
// 代码高亮设置
ctx.set(shikiConfig.key, {
themes: { light: 'dracula', dark: 'dracula-soft' },
langs: ['bash', 'c', 'css', 'go', 'html', 'java', 'javascript', 'js', 'json', 'markdown', 'php', 'python', 'sql', 'sh', 'rust', 'vue'],
dark: false,
})
})
.use(shiki)// 使用插件
})
示例
协议
MIT 许可证(MIT)。有关更多信息,请参见协议文件。