#Issue with rehype-mermaidjs

4 messages · Page 1 of 1 (latest)

sharp turret
#

I needed to support mermaid in my documentation site but could not get rehype-mermaidjs to work correctly. The maintainer of the plugin helped with troubleshooting and found that the way Astro preprocesses the hast seems to be incompatible with the plugin, because mermaidjs searches for pre and code elements but Astro turns them into raw nodes. He mentioned this is a bug in Astro and suggested I ask here instead.

https://github.com/remcohaszing/remark-mermaidjs/issues/23#issuecomment-1704861113

GitHub

This feels like an edge-case issue but I'm not sure how else to fix it so I'm asking here. I'm trying to add Mermaid support to sites that run on Astro using the Starlight theme. One of...

hoary jolt
#

You can try turning off Astro's syntax highlighting in the config: ```mjs
import { defineConfig } from 'astro/config'

export default defineConfig({
markdown: {
syntaxHighlight: false
}
})

sharp turret
#

i do need syntax highlighting in my docs though

hoary jolt
#

Does it work using prism instead of the default shiki? ```mjs
import { defineConfig } from 'astro/config'

export default defineConfig({
markdown: {
syntaxHighlight: 'prism'
}
})