Skip to content

Commit

Permalink
Fix mermaid not recovering from errors during rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
SamyPesse committed Nov 26, 2024
1 parent 16e774b commit 97786d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/forty-steaks-brush.md
Original file line number Diff line number Diff line change
@@ -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
6 changes: 5 additions & 1 deletion integrations/mermaid/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 97786d8

Please sign in to comment.