matthewwithanm/python-markdownify

Fragment links using id are removed

ngtw-j opened this issue · 1 comments

ngtw-j commented

Issue

Given a html file with a fragment:

// article.html
<a href="#pookie"></a>

/* 
 * more html
*/
<h2 id="pookie"></h2>

The equivalent md generated will be

// article.md
[pookie](#pookie)

// more md

// fragment is removed

when it should look like

// article.md
[pookie](#pookie)

// more md

# pookie

Possible Solution

Store a dictionary of id and when id is encountered again, replace with corresponding #id

Thanks for reporting this. I am afraid this is a bit out of scope for this project. In your proposed solution, we would need to guess what text to put in the headline and then print a headline that was not there before. You could preprocess the file and replace all empty headlines with &nbsp, for example.