Skip to content

Commit

Permalink
Mermaid: update to 11.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
enricoros committed Dec 31, 2024
1 parent 6136656 commit 5d942ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/modules/blocks/code/code-renderers/RenderCodeMermaid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { patchSvgString } from './RenderCodeSVG';
* If you update this file, also make sure the interfaces/type definitions and initialization
* options are updated accordingly.
*/
const MERMAID_CDN_FILE: string = 'https://cdn.jsdelivr.net/npm/mermaid@11.2.1/dist/mermaid.min.js';
const MERMAID_CDN_FILE: string = 'https://cdn.jsdelivr.net/npm/mermaid@11.4.1/dist/mermaid.min.js';
const MERMAID_ERROR_PREFIX: string = '[Mermaid]';

interface MermaidAPI {
Expand Down Expand Up @@ -134,7 +134,7 @@ export function RenderCodeMermaid(props: { mermaidCode: string, fitScreen: boole
try {
const elementId = `mermaid-${Math.random().toString(36).substring(2, 9)}`;
const { svg } = await mermaidAPI!.render(elementId, props.mermaidCode, mermaidContainerRef.current!);
return svg;
return svg ? svg : MERMAID_ERROR_PREFIX + ' no SVG.';
} catch (error: any) {
return MERMAID_ERROR_PREFIX + ' ' + (error?.message || 'invalid.');
}
Expand Down

0 comments on commit 5d942ee

Please sign in to comment.