mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-29 20:56:54 +00:00
Update page.tsx
This commit is contained in:
parent
a50af2f493
commit
b43b0ae19b
@ -3,11 +3,29 @@ import path from "path"
|
||||
import { remark } from "remark"
|
||||
import html from "remark-html"
|
||||
|
||||
function markdownToHtml(markdown) {
|
||||
return markdown
|
||||
.replace(/^### (.*$)/gim, "<h3>$1</h3>") // Convertir ### en <h3>
|
||||
.replace(/^## (.*$)/gim, "<h2>$1</h2>") // Convertir ## en <h2>
|
||||
.replace(/^# (.*$)/gim, "<h1>$1</h1>") // Convertir # en <h1>
|
||||
.replace(/\*\*(.*?)\*\*/gim, "<b>$1</b>") // Convertir **negrita** en <b>
|
||||
.replace(/\*(.*?)\*/gim, "<i>$1</i>") // Convertir *cursiva* en <i>
|
||||
.replace(/`(.*?)`/gim, "<code>$1</code>") // Convertir `código` en <code>
|
||||
.replace(/^- (.*$)/gim, "<ul><li>$1</li></ul>") // Convertir listas en <ul>
|
||||
.replace(/\n/g, "<br />") // Mantener los saltos de línea
|
||||
}
|
||||
|
||||
async function getChangelog() {
|
||||
const changelogPath = path.join(process.cwd(), "..", "CHANGELOG.md")
|
||||
try {
|
||||
const fileContents = fs.readFileSync(changelogPath, "utf8")
|
||||
const result = await remark().use(html).process(fileContents)
|
||||
|
||||
// Convertimos Markdown a HTML manualmente
|
||||
const formattedContent = markdownToHtml(fileContents)
|
||||
|
||||
// Usamos remark-html como último paso
|
||||
const result = await remark().use(html).process(formattedContent)
|
||||
|
||||
return result.toString()
|
||||
} catch (error) {
|
||||
console.error("Error reading changelog file:", error)
|
||||
@ -22,7 +40,7 @@ export default async function ChangelogPage() {
|
||||
<div className="bg-white text-gray-900">
|
||||
<div className="container mx-auto px-4 py-16 max-w-4xl">
|
||||
<h1 className="text-4xl font-bold mb-8">Changelog</h1>
|
||||
<div className="prose prose-lg" dangerouslySetInnerHTML={{ __html: changelogContent }} />
|
||||
<div className="prose prose-lg max-w-none" dangerouslySetInnerHTML={{ __html: changelogContent }} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user