mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-21 06:53:17 +08:00
Add suppressErrorRendering
option to avoid inserting 'Syntax error' message in diagram
This commit is contained in:
parent
33c81d557e
commit
2c5d83fab3
@ -34,6 +34,7 @@ export interface MermaidConfig {
|
|||||||
dompurifyConfig?: DOMPurify.Config;
|
dompurifyConfig?: DOMPurify.Config;
|
||||||
wrap?: boolean;
|
wrap?: boolean;
|
||||||
fontSize?: number;
|
fontSize?: number;
|
||||||
|
suppressErrorRendering?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: More configs needs to be moved in here
|
// TODO: More configs needs to be moved in here
|
||||||
|
@ -152,6 +152,14 @@ const config: Partial<MermaidConfig> = {
|
|||||||
*/
|
*/
|
||||||
deterministicIDSeed: undefined,
|
deterministicIDSeed: undefined,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This option suppresses inserting 'Syntax error' message in diagram. This option is useful when
|
||||||
|
* you want to control how to handle syntax error in your application.
|
||||||
|
*
|
||||||
|
* Default value: false
|
||||||
|
*/
|
||||||
|
suppressErrorRendering: false,
|
||||||
|
|
||||||
/** The object containing configurations specific for flowcharts */
|
/** The object containing configurations specific for flowcharts */
|
||||||
flowchart: {
|
flowchart: {
|
||||||
/**
|
/**
|
||||||
|
@ -511,7 +511,9 @@ const render = async function (
|
|||||||
try {
|
try {
|
||||||
await diag.renderer.draw(text, id, version, diag);
|
await diag.renderer.draw(text, id, version, diag);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
if (!config.suppressErrorRendering) {
|
||||||
errorRenderer.draw(text, id, version);
|
errorRenderer.draw(text, id, version);
|
||||||
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,6 +619,7 @@ function addA11yInfo(
|
|||||||
* securityLevel: 'strict',
|
* securityLevel: 'strict',
|
||||||
* startOnLoad: true,
|
* startOnLoad: true,
|
||||||
* arrowMarkerAbsolute: false,
|
* arrowMarkerAbsolute: false,
|
||||||
|
* suppressErrorRendering: false,
|
||||||
*
|
*
|
||||||
* er: {
|
* er: {
|
||||||
* diagramPadding: 20,
|
* diagramPadding: 20,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user