♻️ Refactored the post item
This commit is contained in:
22
app/composables/useMarkdownProcessor.ts
Normal file
22
app/composables/useMarkdownProcessor.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { createMarkdownExit } from "markdown-exit"
|
||||
// @ts-ignore
|
||||
import texmath from "markdown-it-texmath"
|
||||
import katex from "katex"
|
||||
|
||||
export function useMarkdownProcessor() {
|
||||
const processor = createMarkdownExit({
|
||||
breaks: true,
|
||||
html: true,
|
||||
linkify: true,
|
||||
typographer: true
|
||||
// @ts-ignore
|
||||
}).use(texmath, {
|
||||
engine: katex,
|
||||
delimiters: 'dollars',
|
||||
katexOptions: { macros: { "\\RR": "\\mathbb{R}" } }
|
||||
})
|
||||
|
||||
return {
|
||||
render: (content: string) => processor.render(content)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user