diff --git a/packages/mermaid/src/utils.ts b/packages/mermaid/src/utils.ts index 386c107389..631b6dd851 100644 --- a/packages/mermaid/src/utils.ts +++ b/packages/mermaid/src/utils.ts @@ -567,7 +567,7 @@ export const wrapLabel: (label: string, maxWidth: number, config: WrapLabelConfi if (common.lineBreakRegex.test(label)) { return label; } - const words = label.split(' '); + const words = label.split(' ').filter(Boolean); const completedLines: string[] = []; let nextLine = ''; words.forEach((word, index) => {