initial commit

This commit is contained in:
Hunter
2026-11-01 13:23:44 -05:00
commit e03ea4f770
53 changed files with 10802 additions and 0 deletions

20
lib/markdown.ts Normal file
View File

@@ -0,0 +1,20 @@
import { remark } from "remark";
import remarkParse from "remark-parse";
import rehypeRaw from "rehype-raw";
import rehypeStringify from "rehype-stringify";
import remarkRehype from "remark-rehype";
/**
* Identical to renderMarkdown() in portfolio/data/content.ts, so the preview
* renders exactly what the live post page will. allowDangerousHtml is
* intentional: posts embed raw HTML blocks (e.g. <blockquote>).
*/
export async function renderMarkdown(source: string): Promise<string> {
const re = await remark()
.use(remarkParse)
.use(remarkRehype, { allowDangerousHtml: true })
.use(rehypeRaw)
.use(rehypeStringify)
.process(source);
return re?.toString() ?? "";
}