Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc2b574a6f | ||
|
|
e530b3e35f | ||
|
|
6334d4ab84 |
+13
-1
@@ -13,7 +13,19 @@ export const render = async (
|
|||||||
|
|
||||||
// Should be able to call this multiple times without any issues.
|
// Should be able to call this multiple times without any issues.
|
||||||
mermaid.initialize(config);
|
mermaid.initialize(config);
|
||||||
return await mermaid.render(id, code);
|
|
||||||
|
try {
|
||||||
|
const result = await mermaid.render(id, code);
|
||||||
|
return result;
|
||||||
|
} catch {
|
||||||
|
const errorDiv = document.querySelector(`#d${id}`);
|
||||||
|
const svg = errorDiv?.innerHTML ?? '';
|
||||||
|
errorDiv?.remove();
|
||||||
|
return {
|
||||||
|
svg,
|
||||||
|
bindFunctions: undefined
|
||||||
|
};
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const parse = async (code: string): Promise<unknown> => {
|
export const parse = async (code: string): Promise<unknown> => {
|
||||||
|
|||||||
Reference in New Issue
Block a user