调整目录

This commit is contained in:
mlogclub
2026-04-24 12:01:30 +08:00
parent 7889ecb0d2
commit a9275c2d4a
209 changed files with 0 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import MarkdownIt from "markdown-it"
import TurndownService from "turndown"
const markdownIt = new MarkdownIt({
html: true,
linkify: true,
breaks: true,
})
const turndownService = new TurndownService({
headingStyle: "atx",
codeBlockStyle: "fenced",
bulletListMarker: "-",
emDelimiter: "*",
strongDelimiter: "**",
})
turndownService.keep(["table", "thead", "tbody", "tr", "th", "td"])
export function markdownToHtml(markdown: string) {
return markdownIt.render(markdown ?? "")
}
export function htmlToMarkdown(html: string) {
return turndownService.turndown(html ?? "")
}