mostly rendered landing page
This commit is contained in:
15
packages/docs-new/src/helpers/markdown.ts
Normal file
15
packages/docs-new/src/helpers/markdown.ts
Normal 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()
|
||||
}
|
||||
5
packages/docs-new/src/helpers/serve-file.ts
Normal file
5
packages/docs-new/src/helpers/serve-file.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import type { RequestHandler } from "express"
|
||||
|
||||
export function serveFile(path: string): RequestHandler {
|
||||
return (req, res) => res.sendFile(path)
|
||||
}
|
||||
Reference in New Issue
Block a user