Sanitize rendered web content (#77)

This commit is contained in:
phucnguyen1707 2026-06-15 15:34:44 +07:00 • committed by GitHub
parent cb192906bd
commit 59013cf0af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 167 additions and 133 deletions

View file

@ -5,6 +5,7 @@ import type { Metadata } from "next";
import { marked } from "marked";
import { DOC_SLUGS, docExcerpt, docTitle, readDoc } from "@/lib/docs";
import { SiteShell } from "@/components/site-shell";
import { sanitizeRenderedHtml } from "@/lib/html";
// Statically generate one page per curated doc at build time.
export function generateStaticParams(): Array<{ slug: string }> {
@ -37,7 +38,8 @@ export default async function DocPage({
const md = readDoc(slug);
if (!md) notFound();
const html = await marked.parse(md);
const rawHtml = await marked.parse(md);
const html = sanitizeRenderedHtml(rawHtml);
return (
<SiteShell active="Docs">