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

Line breaks in links even when setting protect_links = true #425

Open
seanthegeek opened this issue Aug 15, 2024 · 0 comments
Open

Line breaks in links even when setting protect_links = true #425

seanthegeek opened this issue Aug 15, 2024 · 0 comments

Comments

@seanthegeek
Copy link

Html2text version: 2024.2.26
Python version: 3.11.12

import html2text

h2t = html2text.HTML2Text()
h2t.protect_links = True
markdown = h2t.handle(html)

According to the documentation, this should protect URLs from line breaks, but it does not. It only places angle brackets around the URLs, which is not helpful. Currently the only way to truly avoid line breaks in links is to either use reference-style links, or set body_width to 0, both of which make ugly markdown documents. It would be better if protect_links would allow links to extend beyond the body width, as the documentation implies.

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

1 participant