mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-06-28 20:26:53 +00:00
Update page.tsx
This commit is contained in:
parent
f5883d09a0
commit
fbf4f30f74
@ -24,7 +24,7 @@ export async function generateStaticParams() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🔹 Envuelve los bloques de código en <CopyableCode />
|
||||||
function wrapCodeBlocksWithCopyable(content: string) {
|
function wrapCodeBlocksWithCopyable(content: string) {
|
||||||
return parse(content, {
|
return parse(content, {
|
||||||
replace: (domNode: any) => {
|
replace: (domNode: any) => {
|
||||||
@ -39,14 +39,27 @@ function wrapCodeBlocksWithCopyable(content: string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 🔹 Elimina las comillas de los fragmentos de código en línea dentro de <code>
|
||||||
|
function cleanInlineCode(content: string) {
|
||||||
|
return parse(content, {
|
||||||
|
replace: (domNode: any) => {
|
||||||
|
if (domNode.name === "code" && domNode.children.length > 0) {
|
||||||
|
const codeContent = domNode.children[0].data?.trim().replace(/^`|`$/g, "") || "" // Elimina comillas inversas
|
||||||
|
return <code className="bg-gray-200 text-gray-900 px-1 rounded">{codeContent}</code>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default async function GuidePage({ params }: { params: { slug: string } }) {
|
export default async function GuidePage({ params }: { params: { slug: string } }) {
|
||||||
const guideContent = await getGuideContent(params.slug)
|
const guideContent = await getGuideContent(params.slug)
|
||||||
const parsedContent = wrapCodeBlocksWithCopyable(guideContent)
|
const contentWithCodeBlocks = wrapCodeBlocksWithCopyable(guideContent)
|
||||||
|
const finalContent = cleanInlineCode(contentWithCodeBlocks) // 🔹 Limpiamos código en línea
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen bg-white text-gray-900">
|
<div className="min-h-screen bg-white text-gray-900">
|
||||||
<div className="container mx-auto px-4 py-16 max-w-3xl">
|
<div className="container mx-auto px-4 py-16 max-w-3xl">
|
||||||
<div className="prose max-w-none">{parsedContent}</div>
|
<div className="prose max-w-none">{finalContent}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user