Comments (2)
I can see how this feature can be useful, and I definitely have used it in pandoc / multimarkdown implementations before. My only hesitation is that it lacks a formally defined grammar, and at first glance pandoc's definition makes it hard to distinguish between a paragraph in the footnote and a code block, since both are indented with four spaces. Not to say that there aren't way around this, but the implementation requires some careful planning.
I certainly don't want to be the person to say that, simply because CommonMark does not support this kind of footnotes, mistletoe is not going to support it (in fact, I would love to see CommonMark add this to the spec). Nevertheless, neither GitHub nor CommonMark supports it, which means that implementing it should not be mistletoe's first priority as of this moment.
Another reason is that I also have not figured out a formalized way to deal with footnote-style links. Hacking further features onto an already hacky solution is something I'm not very willing to do.
My thoughts on this matter, in short, are as follows:
- Make mistletoe's footnote-style links compliant to CommonMark, which would enforce a few design choices to facilitate future footnote-related token implementations;
- Citation-style footnotes will be implemented in the future, and will be included as an extension, not enabled by default, for performance reasons;
- In case of ambiguities in grammar, CommonMark takes priority.
I'll leave this issue open until I finally get around to implementing this feature, possibly in the next major version release. Let me know if anything is unclear. Thank you!
from mistletoe.
Hello there, any news about this topic ?
There is a side project (but it doesn't look really active now) known as mistletoe-ebp. From this alternative solution I managed to get something that I believe look good :
#! /usr/bin/env python3
from mistletoe import HTMLRenderer
from mistletoe import Document
r = HTMLRenderer()
i = "bla[^1]\nmoo foo bar[^2]\n\n[^1]: something\n[^2]: even more bla bla"
s = r.render(
Document.read(i)
)
print(s)
which in turns render :
<p>bla<sup class="footnote-ref"><a href="#fn1">[1]</a></sup>
moofoobar<sup class="footnote-ref"><a href="#fn2">[2]</a></sup></p>
<p>qsdqsd qds q qsd qds qsdqsd qsd</p>
<hr class="footnotes-sep">
<section class="footnotes">
<ol class="footnotes-list">
<li id="fn1" class="footnote-item">
something
</li>
<li id="fn2" class="footnote-item">
even more bla bla
</li>
</ol>
</section>
Any chance the implemented solution from mistletoe-epb to be imported in the original project ?
Anything I can do for help ?
from mistletoe.
Related Issues (20)
- Support of Smart punctuation / Simple typographic replacements HOT 3
- 0.8.2: pytest is failing in `test/test_contrib/test_github_wiki.py::TestGithubWiki::test_parse` unit and `DeprecationWarning` warnings HOT 5
- Record line numbers on tokens HOT 6
- Unused imports HOT 1
- question: how to render AST back to a markdown string HOT 1
- LaTeX renderer does not handle inline code with vertical bars correctly HOT 2
- pikchr integration? HOT 1
- Question: Inconsistencies in the block tokens HOT 2
- Enable tables which interrupt a paragraph (like GFM does) HOT 5
- IndexError on malformed markdown tables HOT 1
- Emphasis around link ignored when followed by a special punctuation character HOT 1
- Don't convert the quotes HOT 3
- Contrib sub-package is missing in the mistletoe 1.0.0 PyPI version HOT 3
- Question how to modify ast and write back out as markdown HOT 2
- Do not escape double or single quotes by default HOT 1
- Use strict PascalCase for class names HOT 3
- Renderer for Natural Docs HOT 6
- How to add a custom token inside a block token? HOT 1
- How to add a custom token inside a block token? HOT 3
- make output markdown keep original indentation of the 1st line in a list item
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mistletoe.