diff --git a/web/app/guides/[slug]/page.tsx b/web/app/guides/[slug]/page.tsx index d2c2714..8436ceb 100644 --- a/web/app/guides/[slug]/page.tsx +++ b/web/app/guides/[slug]/page.tsx @@ -3,8 +3,6 @@ import path from "path" import { remark } from "remark" import html from "remark-html" import dynamic from "next/dynamic" -import React from "react" - const CopyableCode = dynamic(() => import("@/components/CopyableCode"), { ssr: false }) @@ -25,24 +23,23 @@ export async function generateStaticParams() { function wrapCodeBlocksWithCopyable(content: string) { - return content.split(/(
[\s\S]*?<\/code><\/pre>)/g).map((segment, index) => {
-    const match = segment.match(/
([\s\S]*?)<\/code><\/pre>/)
-    if (match) {
-      const codeContent = match[1].trim()
-      return React.createElement(CopyableCode, { code: codeContent, key: index })
-    }
-    return segment
-  })
+  return content.replace(
+    /
([\s\S]*?)<\/code><\/pre>/g,
+    (match, lang, code) =>
+      `
` + ) } export default async function GuidePage({ params }: { params: { slug: string } }) { - const guideContent = await getGuideContent(params.slug) - const wrappedContent = wrapCodeBlocksWithCopyable(guideContent) + let guideContent = await getGuideContent(params.slug) + guideContent = wrapCodeBlocksWithCopyable(guideContent) return (
-
{wrappedContent}
+
)