forked from rot1024/astrotion
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: post content has markdown instead of html
- Loading branch information
Showing
5 changed files
with
29 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import rehypeKatex from "rehype-katex"; | ||
import rehypeMermaid from "rehype-mermaid"; | ||
import rehypePrism from "rehype-prism-plus"; | ||
import rehypeStringify from "rehype-stringify"; | ||
import remarkGfm from "remark-gfm"; | ||
import remarkMath from "remark-math"; | ||
import remarkParse from "remark-parse"; | ||
import remarkRehype from "remark-rehype"; | ||
import { unified } from "unified"; | ||
|
||
export const md2html = unified() | ||
.use(remarkParse) | ||
.use(remarkGfm) | ||
.use(remarkMath) | ||
.use(remarkRehype) | ||
.use(rehypeKatex) | ||
.use(rehypeMermaid, { strategy: "pre-mermaid" }) | ||
.use(rehypePrism) | ||
.use(rehypeStringify); | ||
|
||
export async function markdownToHTML(md: string): Promise<string> { | ||
return String(await md2html.process(md)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters