Giter VIP home page Giter VIP logo

Comments (2)

miyuchina avatar miyuchina commented on May 27, 2024 1

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:

  1. Make mistletoe's footnote-style links compliant to CommonMark, which would enforce a few design choices to facilitate future footnote-related token implementations;
  2. Citation-style footnotes will be implemented in the future, and will be included as an extension, not enabled by default, for performance reasons;
  3. 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.

DenisSalem avatar DenisSalem commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.