diff --git a/Note/FormatNoteViewController.swift b/Note/FormatNoteViewController.swift index ba4d9cb..fd87d46 100644 --- a/Note/FormatNoteViewController.swift +++ b/Note/FormatNoteViewController.swift @@ -228,25 +228,10 @@ class FormatNoteViewController: UIViewController { var content = text content = content.replacingOccurrences(of: "# ", with: "") content = content.replacingOccurrences(of: "#", with: "") - content = content.replacingOccurrences(of: "!", with: "。") - content = content.replacingOccurrences(of: "!", with: "。") - content = content.replacingOccurrences(of: ";", with: "。") - content = content.replacingOccurrences(of: ";", with: "。") - content = content.replacingOccurrences(of: ".", with: "。") - content = content.replacingOccurrences(of: "(", with: "(") - content = content.replacingOccurrences(of: ")", with: ")") - content = content.replacingOccurrences(of: "?", with: "?") - content = content.replacingOccurrences(of: ",", with: ",") - content = content.replacingOccurrences(of: ":", with: ":") - content = content.replacingOccurrences(of: "---", with: "") content = content.replacingOccurrences(of: "日星期", with: "日 星期") - // 按原始空行分割段落,保留段落结构 - let paragraphs = content.components(separatedBy: .newlines) - .split(separator: "", omittingEmptySubsequences: false) - .map { $0.joined(separator: "\n") } - - // 清理每个段落内部的多余空行,段落之间保留两个空行 + // 按 --- 分割段落,移除每个段落内部的空行,段落之间保留两个空行 + let paragraphs = content.components(separatedBy: "---") let formattedParagraphs = paragraphs.map { paragraph -> String in removeEmptyLines(paragraph) }