mostly rendered landing page

This commit is contained in:
MapleLeaf
2022-01-03 01:44:55 -06:00
committed by Darius
parent 3b42f25e45
commit 83405a92d7
7 changed files with 36 additions and 7 deletions

View File

@@ -0,0 +1,15 @@
import { readFile } from "node:fs/promises"
import rehypeStringify from "rehype-stringify"
import remarkParse from "remark-parse"
import remarkRehype from "remark-rehype"
import { unified } from "unified"
const processor = unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeStringify)
export async function renderMarkdownFile(filePath: string) {
const result = await processor.process(await readFile(filePath))
return result.toString()
}

View File

@@ -0,0 +1,5 @@
import type { RequestHandler } from "express"
export function serveFile(path: string): RequestHandler {
return (req, res) => res.sendFile(path)
}