I'm trying to get a paragraph with SwiftSoup, the html has the
codes. When I parse it, it's just getting text without line break. How can I change
tags with line breaks?
do {
let html = "<html><head><title>First parse</title></head>"
+ "<body><p>Parsed HTML <br> into a doc.</p></body></html>"
let doc: Document = try SwiftSoup.parse(html)
return try doc.text()
} catch Exception.Error(let type, let message) {
print(message)
} catch {
print("error")
}
Above code just print "Parsed HTML into a doc." without linebreaking.