Note格式化按---分段并移除句间空行

This commit is contained in:
2026-07-12 22:41:36 +08:00
parent e01404f18e
commit 195483b3e1
+2 -17
View File
@@ -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)
}