jaytaylor / html2text

Golang HTML to plaintext conversion library
https://jaytaylor.com/html2text
MIT License
541 stars 138 forks source link

Properly trim white space of text nodes #29

Closed Kleissner closed 5 years ago

Kleissner commented 6 years ago

Line https://github.com/jaytaylor/html2text/blob/master/html2text.go#L340 should use the strings.TrimSpace function instead of strings.Trim to properly trim white spaces (especially unicode ones).

data = strings.TrimSpace(spacingRe.ReplaceAllString(node.Data, " "))
jaytaylor commented 5 years ago

Thanks, and sorry about only seeing this now.

I'll gladly accept a PR for this one!

mikemccrary commented 5 years ago

@jaytaylor - I've created PR https://github.com/jaytaylor/html2text/pull/34 for this. Let me know how it looks, thanks!

mikemccrary commented 5 years ago

@jaytaylor going to bump this incase it got missed

jaytaylor commented 5 years ago

Hi Mike, thanks for the reminder! Merged it.