mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-11 00:25:35 +00:00
Remove extra line break from spoiler text
This commit is contained in:
parent
4c40adc195
commit
508b180a1d
1 changed files with 6 additions and 0 deletions
|
@ -29,6 +29,7 @@ public struct HTMLString: Codable, Equatable, Hashable {
|
|||
|
||||
let document: Document = try SwiftSoup.parse(htmlValue)
|
||||
handleNode(node: document)
|
||||
|
||||
document.outputSettings(OutputSettings().prettyPrint(pretty: false))
|
||||
try document.select("br").after("\n")
|
||||
try document.select("p").after("\n\n")
|
||||
|
@ -40,6 +41,11 @@ public struct HTMLString: Codable, Equatable, Hashable {
|
|||
_ = text.removeLast()
|
||||
}
|
||||
asRawText = text
|
||||
|
||||
if asMarkdown.hasPrefix("\n") {
|
||||
_ = asMarkdown.removeFirst()
|
||||
}
|
||||
|
||||
} catch {
|
||||
asRawText = htmlValue
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue