From ffd947233e46c78beaa5cd38603838e5a9a93414 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Tue, 20 Jan 2026 10:39:23 +0800 Subject: [PATCH] :art: Clean code Signed-off-by: Daniel <845765@qq.com> --- kernel/util/rune.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/util/rune.go b/kernel/util/rune.go index 6533508f0..1617a3b39 100644 --- a/kernel/util/rune.go +++ b/kernel/util/rune.go @@ -27,8 +27,10 @@ import ( "github.com/siyuan-note/logging" ) +var newlinesRegex = regexp.MustCompile(`[\r\n]+`) + func ReplaceNewline(text, replaceWith string) string { - return regexp.MustCompile(`[\r\n]+`).ReplaceAllString(text, replaceWith) + return newlinesRegex.ReplaceAllString(text, replaceWith) } func ContainsCJK(text string) bool {