-
|
I am rendering a component that contains GitHub-flavored Markdown (specifically, tables): I added this to my Docusaurus config: But the result is that the GFT doesn't work. Why? What did I do wrong? "@docusaurus/core": "^3.7.0",
"@docusaurus/plugin-client-redirects": "^3.7.0",
"@docusaurus/plugin-vercel-analytics": "^3.7.0",
"@docusaurus/preset-classic": "^3.7.0",
"@docusaurus/theme-classic": "^3.7.0",
"@docusaurus/theme-mermaid": "^3.7.0",
"@mdx-js/react": "~3.0.1",
"remark-gfm": "^4.0.1", |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
|
The fix was to use I think this is one area where the Docusaurus docs could be improved. There's little guidance on how to generate MDX content dynamically. |
Beta Was this translation helpful? Give feedback.
-
|
Providing a component like this would be helpful: import { useMemo } from "react";
import * as runtime from "react/jsx-runtime";
import { evaluateSync } from "@mdx-js/mdx";
import remarkGfm from "remark-gfm";
interface GFMContentProps {
content: string;
}
export default function GFMContent({ content }: GFMContentProps) {
const { default: Content } = useMemo(() => {
return evaluateSync(content, { ...runtime, remarkPlugins: [remarkGfm] });
}, [content]);
return <Content />;
} |
Beta Was this translation helpful? Give feedback.
-
|
You don't need to provide remark-gfm because it's already included by Docusaurus automatically It's difficult to help you because I don't understand what Please provide a runnable docusaurus.new repro with all the code, that shows the problem, and what you want instead. |
Beta Was this translation helpful? Give feedback.
-
|
Hey @slorber thanks for your answer and for offering to help! Here's my full code — I am generating some Markdown tables. You can see the live output here. Details
DeploymentTables.tsx DeploymentTable.tsx |
Beta Was this translation helpful? Give feedback.
The fix was to use
evaluate/evaluateSyncfrom@mdx-jslike this:I think this is one area where the Docusaurus docs could be improved. There's little guidance on how to generate MDX content dynamically.