diff --git a/src/components/problem-description.tsx b/src/components/problem-description.tsx index cdc2de6..16069ca 100644 --- a/src/components/problem-description.tsx +++ b/src/components/problem-description.tsx @@ -1,5 +1,6 @@ import { Suspense } from "react"; -import { MDXRemote } from "next-mdx-remote/rsc"; +import remarkGfm from "remark-gfm"; +import { compileMDX } from "next-mdx-remote/rsc"; import { Skeleton } from "@/components/ui/skeleton"; import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area"; @@ -7,15 +8,29 @@ interface ProblemDescriptionProps { mdxSource: string; } -export function ProblemDescription({ mdxSource }: ProblemDescriptionProps) { - return ( - - }> -
- -
-
- -
- ); +export async function ProblemDescription({ mdxSource }: ProblemDescriptionProps) { + try { + const { content } = await compileMDX({ + source: mdxSource, + options: { + mdxOptions: { + remarkPlugins: [remarkGfm], + }, + }, + }); + + return ( + + }> +
+ {content} +
+
+ +
+ ); + } catch (error) { + console.error("Error compiling MDX:", error); + return ; + } }