replace old docs

This commit is contained in:
MapleLeaf
2022-01-03 04:20:29 -06:00
committed by Darius
parent 557fb4f8dc
commit e46b62f888
63 changed files with 67 additions and 1113 deletions

View File

@@ -0,0 +1,15 @@
import grayMatter from "gray-matter"
import MarkdownIt from "markdown-it"
import prism from "markdown-it-prism"
import { readFile } from "node:fs/promises"
const renderer = new MarkdownIt({
html: true,
linkify: true,
}).use(prism)
export async function renderMarkdownFile(filePath: string) {
const { data, content } = grayMatter(await readFile(filePath, "utf8"))
const html = renderer.render(content)
return { html, data }
}