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

Add footnote support #40

Closed
wants to merge 2 commits into from
Closed

Conversation

nvanexan
Copy link
Contributor

Hi maintainers πŸ‘‹

I had need for support for footnotes in my own project. Submitting this as a draft to add support for parsing footnotes via the markdown-it-footnote plugin.

I added a test to the parsers but feel free to play with it a bit. If you think this could be useful for all, feel free to comment, edit or add as you see fit. Thx!

Example text

 foo[^1]

[^1]: bar

Example output

    <article>
      <p>
        foo<sup class="footnote-ref"><a id="fnref1" href="#fn1">1</a></sup>
      </p>
      <section class="footnotes">
        <ol class="footnotes-list">
          <li class="footnote-item" id="fn1">
            <p>bar<a class="footnote-anchor" href="#fnref1">↩</a></p>
          </li>
        </ol>
      </section>
    </article>

@CLAassistant
Copy link

CLAassistant commented May 18, 2022

CLA assistant check
All committers have signed the CLA.

@nvanexan
Copy link
Contributor Author

Updated to remove the commits in a previous PR and to get the build check to pass. Cheers! 🍻

@rpaul-stripe
Copy link
Contributor

I appreciate that you took the time to put this PR together, but I think we're going to pass on this one. We'd prefer not to introduce additional syntax or dependencies on additional markdown-it plugins, especially in cases where it would be practical to implement the feature with Markdoc tags.

@mfix-stripe mfix-stripe mentioned this pull request Jun 1, 2022
@matildepark
Copy link

especially in cases where it would be practical to implement the feature with Markdoc tags

So are we to advise writers to use {% footnote %} format instead of just [^1]?

@mfix-stripe
Copy link
Contributor

especially in cases where it would be practical to implement the feature with Markdoc tags

So are we to advise writers to use {% footnote %} format instead of just [^1]?

For now, yes. We will keep an eye on requests like these and see if they prevail. We prefer that users re-mix existing APIs than continually extending the syntax of Markdoc itself.

@matildepark
Copy link

For future readers, I ended up porting the work in nvanexan/nve2022#7 for my situation (double kudos to OP here).

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.

None yet

5 participants