diff --git a/packages/mermaid/src/diagrams/common/common.ts b/packages/mermaid/src/diagrams/common/common.ts index fd76d0a45d..dc37024b1a 100644 --- a/packages/mermaid/src/diagrams/common/common.ts +++ b/packages/mermaid/src/diagrams/common/common.ts @@ -83,7 +83,7 @@ export const sanitizeText = (text: string, config: MermaidConfig): string => { return text; } if (config.dompurifyConfig) { - text = DOMPurify.sanitize(sanitizeMore(text, config), config.dompurifyConfig).toString(); + text = String(DOMPurify.sanitize(sanitizeMore(text, config), config.dompurifyConfig)); } else { text = DOMPurify.sanitize(sanitizeMore(text, config), { FORBID_TAGS: ['style'],