WebIndex/plugins/markdown-it.ts

24 lines
410 B
TypeScript
Raw Normal View History

2024-12-02 17:25:10 +08:00
import md, { type Options } from 'markdown-it'
import mm from 'markdown-it-mathjax3'
2025-01-13 21:51:37 +08:00
2024-12-02 17:25:10 +08:00
const options: Options = {
2025-01-13 21:51:37 +08:00
breaks: true,
2025-01-13 23:12:06 +08:00
html: true,
2025-01-13 21:51:37 +08:00
langPrefix: 'language-',
linkify: true,
quotes: '“”‘’',
2025-01-13 23:12:06 +08:00
typographer: true,
xhtmlOut: true,
2024-12-02 17:25:10 +08:00
}
export default defineNuxtPlugin(() => {
2025-01-13 21:51:37 +08:00
const render = md(options)
.use(mm, {
})
return {
provide: {
mdRender: render,
},
}
})