2024-04-15 14:40:10 +08:00
|
|
|
/* eslint-disable compat/compat */
|
|
|
|
/* eslint-disable no-console, no-await-in-loop, import/no-extraneous-dependencies, no-restricted-syntax */
|
2024-06-22 21:59:12 +08:00
|
|
|
import rehypeFigure from '@microflash/rehype-figure';
|
|
|
|
import rehypeStringify from 'rehype-stringify';
|
2024-04-15 14:40:10 +08:00
|
|
|
import { remark } from 'remark';
|
|
|
|
import remarkGfm from 'remark-gfm';
|
|
|
|
import remarkRehype from 'remark-rehype';
|
|
|
|
|
|
|
|
export default function markdown2Html(content: string) {
|
|
|
|
return remark()
|
|
|
|
.use(remarkGfm)
|
|
|
|
.use(remarkRehype)
|
|
|
|
.use(rehypeFigure)
|
|
|
|
.use(rehypeStringify)
|
|
|
|
.processSync(content)
|
|
|
|
.toString();
|
|
|
|
}
|