mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-07-04 22:46:54 +00:00
Update page.tsx
This commit is contained in:
parent
dc1ceea77d
commit
f7affa3987
@ -7,7 +7,16 @@ 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().use(html).process(fileContents)
|
const result = await remark()
|
||||||
|
.use(html, {
|
||||||
|
sanitize: false,
|
||||||
|
handlers: {
|
||||||
|
inlineCode(h, node) {
|
||||||
|
return h(node, "code", { className: "inline-code" }, [h(node.position, "text", node.value)])
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.process(fileContents)
|
||||||
return result.toString()
|
return result.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +30,7 @@ export async function generateStaticParams() {
|
|||||||
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)
|
||||||
|
|
||||||
// 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\S]*?)<\/code><\/pre>/g,
|
/<pre><code>([\s\S]*?)<\/code><\/pre>/g,
|
||||||
@ -39,3 +48,4 @@ export default async function GuidePage({ params }: { params: { slug: string } }
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user