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;
|
||||
wrap?: boolean;
|
||||
fontSize?: number;
|
||||
suppressErrorRendering?: boolean;
|
||||
}
|
||||
|
||||
// TODO: More configs needs to be moved in here
|
||||
|
|
|
@ -152,6 +152,14 @@ const config: Partial<MermaidConfig> = {
|
|||
*/
|
||||
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 */
|
||||
flowchart: {
|
||||
/**
|
||||
|
|
|
@ -511,7 +511,9 @@ const render = async function (
|
|||
try {
|
||||
await diag.renderer.draw(text, id, version, diag);
|
||||
} catch (e) {
|
||||
errorRenderer.draw(text, id, version);
|
||||
if (!config.suppressErrorRendering) {
|
||||
errorRenderer.draw(text, id, version);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
@ -617,6 +619,7 @@ function addA11yInfo(
|
|||
* securityLevel: 'strict',
|
||||
* startOnLoad: true,
|
||||
* arrowMarkerAbsolute: false,
|
||||
* suppressErrorRendering: false,
|
||||
*
|
||||
* er: {
|
||||
* diagramPadding: 20,
|
||||
|
|
Loading…
Reference in New Issue