Update page.tsx

This commit is contained in:
MacRimi 2025-02-14 17:25:27 +01:00 committed by GitHub
parent 5096be0d81
commit 10a4fdf1ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,26 +2,28 @@ import fs from "fs"
import path from "path" import path from "path"
import { remark } from "remark" import { remark } from "remark"
import html from "remark-html" import html from "remark-html"
import DocsLayout from "../components/docs-layout"
async function getChangelog() { async function getChangelog() {
const changelogPath = path.join(process.cwd(), "..", "CHANGELOG.md") const changelogPath = path.join(process.cwd(), "..", "CHANGELOG.md")
try {
const fileContents = fs.readFileSync(changelogPath, "utf8") const fileContents = fs.readFileSync(changelogPath, "utf8")
const result = await remark()
const result = await remark().use(html).process(fileContents) .use(html) // No usar sanitize: false a menos que sea seguro
.process(fileContents)
return result.toString() return result.toString()
} catch (error) {
console.error("Error reading changelog file:", error)
return "<p>Changelog content not found.</p>"
}
} }
export default async function ChangelogPage() { export default async function ChangelogPage() {
const changelogContent = await getChangelog() const changelogContent = await getChangelog()
return ( return (
<DocsLayout>
<div className="container mx-auto px-4 py-16 max-w-4xl"> <div className="container mx-auto px-4 py-16 max-w-4xl">
<h1 className="text-4xl font-bold mb-8">Changelog</h1> <h1 className="text-4xl font-bold mb-8">Changelog</h1>
<div className="prose prose-lg" dangerouslySetInnerHTML={{ __html: changelogContent }} /> <div className="prose prose-lg dark:prose-invert" dangerouslySetInnerHTML={{ __html: changelogContent }} />
</div> </div>
</DocsLayout>
) )
} }