html5parser
html5parser copied to clipboard
Html string to plain text with lines
Hey!
I wonder how can I use this library to get the innerText of my HTML string and also preserve the new lines?
const htmlstring = `<p>hello</p><img src="..." /><p>world</p>`
const result = html5parser(htmlstring) // ??
const result = `hello
world`
It doesn't seem to me that is the purpose of this library. Even though it has a package internal stringify
method it doesn't implement the specifics of innerText
.