Android-FileBrowser-FilePicker icon indicating copy to clipboard operation
Android-FileBrowser-FilePicker copied to clipboard

Footnote ref number in TOC

Open mustafa0x opened this issue 6 years ago • 1 comments

In [13]: t = '''
    ...: # Header with footnote[^1]
    ...: 
    ...: Lorem Ipsum
    ...: 
    ...: [^1]: footnote text
    ...: '''

In [14]: print(markdown.markdown('[TOC]\n\n' + t, extensions=['markdown.extensions.toc', 'markdown.extensions.footnotes']))
<div class="toc">
<ul>
<li><a href="#header-with-footnote1">Header with footnote1</a></li> <!-- Note the '1' in the header id and more importantly the link text -->
</ul>
</div>
<h1 id="header-with-footnote1">Header with footnote<sup id="fnref:1"><a class="footnote-ref" href="#fn:1" rel="footnote">1</a></sup></h1>
<p>Lorem Ipsum</p>
<div class="footnote">
<hr />
<ol>
<li id="fn:1">
<p>footnote text&#160;<a class="footnote-backref" href="#fnref:1" rev="footnote" title="Jump back to footnote 1 in the text">&#8617;</a></p>
</li>
</ol>
</div>

mustafa0x avatar May 10 '18 20:05 mustafa0x

So the code which sanitizes the text for use in the TOC is pretty simple. It simply pulls the text from the HTML elements. It could be significantly more complex to exclude footnote refs. And I find it odd that we would need to only do this for a non-standard add-on syntax. Additionally, the fact that this is only being reported now suggests that this is an unusual edge case that not many users will encounter.

That said, it is clearly not what one would expect and should probably be fixed. Of course, pull requests are welcome.

waylan avatar May 10 '18 23:05 waylan