Open Pasithea0 opened 1 month ago
I tried your example and it works for me:
import { Carta, type Plugin } from 'carta-md';
import rehypeMermaid from 'rehype-mermaidjs';
const mermaid: Plugin = {
transformers: [{
execution: 'async',
type: 'rehype',
transform({ processor }) {
processor.use(rehypeMermaid);
}
}]
};
const carta = new Carta({
extensions: [mermaid],
sanitizer: false
});
If you are also using plugin-code
, try moving this plugin first when you provide extensions
to carta:
const carta = new Carta({
extensions: [mermaid, code()],
});
https://github.com/user-attachments/assets/d4f82635-2394-4cf3-a714-0872615f8ef5
dompurify
and the text disappears from the boxes. I'm not able to figure out why this happens. You'll have better luck asking for help on the dompurify
repo, providing an example of the generated HTML.
I'm trying to add mermaid charts to my site, but neither remark-mermaidjs or rehype-mermaid works.
Here is my code, but it does not work:
Any help is greatly appreciated!