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
88aa0933aa
commit
4ef9333a8b
@ -7,9 +7,7 @@ async function getGuideContent(slug: string) {
|
||||
const guidePath = path.join(process.cwd(), "..", "guides", `${slug}.md`)
|
||||
const fileContents = fs.readFileSync(guidePath, "utf8")
|
||||
|
||||
const result = await remark()
|
||||
.use(html, { sanitize: false }) // Permitir HTML sin sanitizar para preservar los estilos
|
||||
.process(fileContents)
|
||||
const result = await remark().use(html).process(fileContents)
|
||||
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
|
||||
const wrapCodeBlocks = (content: string) => {
|
||||
return content.replace(
|
||||
/<pre><code(?:\s+class="language-(\w+)")?>([\s\S]*?)<\/code><\/pre>/g,
|
||||
(_, language, code) => `<CopyableCode code="${encodeURIComponent(code.trim())}" language="${language || ""}" />`,
|
||||
/<pre><code>([\s\S]*?)<\/code><\/pre>/g,
|
||||
(match, code) => `<CopyableCode code="${encodeURIComponent(code.trim())}" />`,
|
||||
)
|
||||
}
|
||||
|
||||
@ -41,4 +39,3 @@ export default async function GuidePage({ params }: { params: { slug: string } }
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user