diff --git a/.changeset/forty-steaks-brush.md b/.changeset/forty-steaks-brush.md new file mode 100644 index 000000000..e7b472e7a --- /dev/null +++ b/.changeset/forty-steaks-brush.md @@ -0,0 +1,5 @@ +--- +'@gitbook/integration-mermaid': patch +--- + +Make the mermaid block recover from errors when rendering; to ensure the user can continue editing it diff --git a/integrations/mermaid/src/index.tsx b/integrations/mermaid/src/index.tsx index ab7bdb038..b166d8a28 100644 --- a/integrations/mermaid/src/index.tsx +++ b/integrations/mermaid/src/index.tsx @@ -93,7 +93,11 @@ export default createIntegration({ console.log('mermaid: process queue', queue.length); if (queue.length > 0) { const content = queue[0]; - await renderDiagram(content); + try { + await renderDiagram(content); + } catch (error) { + console.error('mermaid: render error', error); + } queue.shift(); }