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

Fix anchors containing block elements #419

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ndpnt
Copy link

@Ndpnt Ndpnt commented Aug 31, 2022

Fixes #409

@aaronmfparr
Copy link

This is a very simple fix and solves my problems, so I am all for a merge here.

What's the hold up?

@domchristie
Copy link
Collaborator

Unfortunately this change doesn't result in the correct markdown. For example, the following HTML:

<a href="http://example.com/heading"><h1>heading</h1></a>

gets converted to:

[heading
=======](http://example.com/heading)

and so when converted back to HTML is:

<p><a href="http://example.com/heading">heading
=======</a></p>

This is quite a complex issue, and becomes trickier when multiple block elements are wrapped in a <a> (see #313 (comment)). Ideally the HTML should be changed so that the <a> only wraps text. So currently your best bet is to mutate the HTML to fix these issues before passing it in to Turndown.

@aaronmfparr
Copy link

thanks for responding to this. hopefully we'll see some movement.

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

Successfully merging this pull request may close these issues.

heading inside anchor renders to invalid markdown
3 participants