Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

innerText alternative with more expected spacing #90

Open
tysonzero opened this issue May 17, 2022 · 2 comments
Open

innerText alternative with more expected spacing #90

tysonzero opened this issue May 17, 2022 · 2 comments

Comments

@tysonzero
Copy link

tysonzero commented May 17, 2022

Currently innerText converts <p>foo</p><p>bar</p> to foobar.

It would be nice to have a toText that does something like the following:

toText $ parseTags "<p>foo</p><p>bar</p>"
-- "foo\nbar"
toText $ parseTags "foo<br>bar"
-- "foo\nbar"
toText $ parseTags "foo<br><br><br>bar"
-- "foo\n\n\nbar"
toText $ parseTags "click <a>me</a>"
-- "click me"
toText $ parseTags "foo <em>bar</em> baz"
-- "foo bar baz"
toText $ parseTags "foo <div>bar</div> baz"
-- "foo\nbar\nbaz"
toText $ parseTags "<p>   hello      world    </p>"
-- "hello world"
toText $ parseTags "<div>foo</div><div>  </div><div>\n</div><div>bar</div>"
-- "foo\nbar"
@tysonzero
Copy link
Author

https://github.com/polimorphic/html-to-text

Feel free to merge whichever parts in to tagsoup

@ndmitchell
Copy link
Owner

Thanks for the comment - I'm not really actively maintaining tagsoup, so will try and find a different maintainer who can see if this is worthwhile or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants