mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-29 04:36:54 +00:00
Update page.tsx
This commit is contained in:
parent
88aa0933aa
commit
4ef9333a8b
@ -7,9 +7,7 @@ async function getGuideContent(slug: string) {
|
|||||||
const guidePath = path.join(process.cwd(), "..", "guides", `${slug}.md`)
|
const guidePath = path.join(process.cwd(), "..", "guides", `${slug}.md`)
|
||||||
const fileContents = fs.readFileSync(guidePath, "utf8")
|
const fileContents = fs.readFileSync(guidePath, "utf8")
|
||||||
|
|
||||||
const result = await remark()
|
const result = await remark().use(html).process(fileContents)
|
||||||
.use(html, { sanitize: false }) // Permitir HTML sin sanitizar para preservar los estilos
|
|
||||||
.process(fileContents)
|
|
||||||
return result.toString()
|
return result.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,8 +24,8 @@ export default async function GuidePage({ params }: { params: { slug: string } }
|
|||||||
// Función para envolver los bloques de código con CopyableCode
|
// Función para envolver los bloques de código con CopyableCode
|
||||||
const wrapCodeBlocks = (content: string) => {
|
const wrapCodeBlocks = (content: string) => {
|
||||||
return content.replace(
|
return content.replace(
|
||||||
/<pre><code(?:\s+class="language-(\w+)")?>([\s\S]*?)<\/code><\/pre>/g,
|
/<pre><code>([\s\S]*?)<\/code><\/pre>/g,
|
||||||
(_, language, code) => `<CopyableCode code="${encodeURIComponent(code.trim())}" language="${language || ""}" />`,
|
(match, code) => `<CopyableCode code="${encodeURIComponent(code.trim())}" />`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,4 +39,3 @@ export default async function GuidePage({ params }: { params: { slug: string } }
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user