diff --git a/mermaid/src/worker.js b/mermaid/src/worker.js
index da264d894..e5ba867bd 100644
--- a/mermaid/src/worker.js
+++ b/mermaid/src/worker.js
@@ -81,7 +81,13 @@ export class Worker {
page.evaluate(async (definition, mermaidConfig) => {
window.mermaid.initialize(mermaidConfig)
try {
- const { svg } = await window.mermaid.render('container', definition)
+ let { svg } = await window.mermaid.render('container', definition)
+ // workaround: https://github.com/yuzutech/kroki/issues/1632
+ // upstream issue: https://github.com/mermaid-js/mermaid/issues/1766
+ // taken from: https://github.com/mermaid-js/mermaid-live-editor/blob/83382901cd7e15414b6f18b48b7dd9c4775f3a21/src/lib/components/Actions.svelte#L23-L26
+ svg = svg
+ .replaceAll('
', '
')
+ .replaceAll(/]*)>/g, (m, g) => ``)
return { svg, error: null }
} catch (err) {
return {