UPD: Add Validators & Error Toast for Mermaid & Vega diagrams

### UPD: Feat:  Add Validators & Error Toast for Mermaid & Vega diagrams

Description:
As many time the diagrams generated or entered have syntax errors the diagrams are not rendered due to that errors, but as there isn't any notification is difficult to know what happend.

This PR add validator and toast notification when error on Mermaid and Vega/Vega-Lite diagrams, helping the user to fix its.
This commit is contained in:
_00_ committed 2025-10-04 14:17:04 +02:00
1 parent 039358e049
commit 2e08bda19d
2 files changed
+33 -15

No files matched your search

@@ -326,12 +326,12 @@
const render = async () => {
onUpdate(token);
if (lang === 'mermaid' && (token?.raw ?? '').slice(-4).includes('```')) {
mermaidHtml = await renderMermaidDiagram(code);
mermaidHtml = await renderMermaidDiagram(code, $i18n);
} else if (
(lang === 'vega' || lang === 'vega-lite') &&
(token?.raw ?? '').slice(-4).includes('```')
) {
vegaHtml = await renderVegaVisualization(code);
vegaHtml = await renderVegaVisualization(code, $i18n);
}
};