23 lines
600 B
TypeScript
23 lines
600 B
TypeScript
import { unified } from 'unified';
|
|
import remarkParse from 'remark-parse';
|
|
import remarkGfm from 'remark-gfm';
|
|
import remarkRehype from 'remark-rehype';
|
|
import remarkMath from 'remark-math';
|
|
import rehypeKatex from 'rehype-katex';
|
|
|
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
const remark =
|
|
unified()
|
|
.use(remarkParse)
|
|
.use(remarkGfm)
|
|
.use(remarkMath, { singleDollarTextMath: false })
|
|
.use(remarkRehype, { allowDangerousHtml: true })
|
|
.use(rehypeKatex);
|
|
|
|
return {
|
|
provide: {
|
|
remark,
|
|
}
|
|
}
|
|
})
|