Closed johackim closed 1 year ago
Looking into this
I reproduce the same with code ``` like
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
But in my mdx, if I try with
<Mermaid chart={`graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
`} />
const usedComponents = {
Mermaid,
}
const MDXContent = useMDXComponent(post.body.code)
return <MDXContent components={usedComponents} />
It works well.
The lib is next-contentlayer
, but under the hood it use @mdx-js
;)
So @johackim there is this workaround
I'm also trying to use this with @mdx-js/rollup
with Vite but it's crashing out with [plugin:@mdx-js/rollup] Expected usable value, not 'undefined'
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import mdx from "@mdx-js/rollup";
import remarkGfm from 'remark-gfm'
import mdxMermaid from 'mdx-mermaid'
...
export default defineConfig({
plugins: [
react(),
mdx({
remarkPlugins: [remarkGfm, mdxMermaid.default],
}),
# mermaid code block
```mermaid
graph LR
Start --> Stop
...
It works fine if I use it directly in the .mdx
like this but I want to use it with the above backticks in markdown.
import { Mermaid } from 'mdx-mermaid/Mermaid';
# mermaid code block
<Mermaid chart={`graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
`} />
Just released v2.0.0-rc3
does this version work with setting output to svg
?
See example https://github.com/sjwall/mdx-mermaid/blob/main/mdx-example/index.js
Note extra peer dependencies to convert to svg
Just released
v2.0.0-rc3
does this version work with setting output tosvg
?
With the rc3, it works perfectly! ;)
With the param { output: 'svg' }
It's good to me too :D. Thanks !
Hello @sjwall, thanks for your work !
Describe the bug
I want to use mdx-mermaid with @mdx-js/mdx but there is no svg output.
To Reproduce
Actual output :
Expected behavior
I want to get a svg directly :
How to do it ?