diff --git a/web/app/guides/[slug]/page.tsx b/web/app/guides/[slug]/page.tsx index 1ee7454..0061f6d 100644 --- a/web/app/guides/[slug]/page.tsx +++ b/web/app/guides/[slug]/page.tsx @@ -24,7 +24,7 @@ export async function generateStaticParams() { })) } - +// 🔹 Envuelve los bloques de código en function wrapCodeBlocksWithCopyable(content: string) { return parse(content, { 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 +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 {codeContent} + } + } + }) +} + export default async function GuidePage({ params }: { params: { slug: string } }) { 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 (
-
{parsedContent}
+
{finalContent}
)