From ea5859b3daeafee4c79fb13d4a17d832360942f0 Mon Sep 17 00:00:00 2001 From: Jacob Kim Date: Tue, 5 Aug 2025 17:46:42 -0700 Subject: [PATCH] fix: bug where newlines aren't escaped properly --- core/util/text.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 {