diff --git a/core/util/text.ts b/core/util/text.ts index 9e948f415..434436c40 100644 --- a/core/util/text.ts +++ b/core/util/text.ts @@ -32,7 +32,10 @@ export function escapeForSVG(text: string): string { .replace(//g, ">") .replace(/"/g, """) - .replace(/'/g, "'"); + .replace(/'/g, "'") + .replace(/\n/g, "\\n") // newlines + .replace(/\t/g, "\\t") // tabs + .replace(/\r/g, "\\r"); // carriage returns } export function kebabOfStr(str: string): string {