-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Footnotes: Don't use reference as footnote label #545
Comments
(Just noticed in my example above: MDX doesn't process inline footnotes at all. I don't use those, but would probably be cool if you could support those at some point :) ) |
This isn’t really related to MDX but relates to remark instead. See the
What are the conventions? What are regular markdown parsers? Because markdown-it-footnotes is a non-standard extension, and there is no standard for footnotes in markdown. My opinion on syntax extensions is: don’t do it. It doesn’t work everywhere. And I’m really happy that MDX exists. Because components are much better than syntax extensions. Use JSX! |
Edit: No, sorry, I shouldn't be so passive aggressive. It's a shame that MDX doesn't support footnotes in the way that other parsers do that I'm used to, but hey, I'm just one person. I do wonder why footnotes were added to MDX in they way they were, but that's mostly my curiosity. I'm currently considering throwing MDX out of my project and just using plain TSX for all my content, so this isn't blocking for me. Just thought it'd be useful for others too :) |
I’m not saying that it is the MDX design philosophy. I’m explicitly saying that it is my opinion. MDX is markdown + components. More info can be found on the website.
Good question! Git history, as you probably saw, doesn’t show much. The way they are added can be researched in remark, as I previously linked to you.
Nowadays, the answer is either a) commonmark, b) markdown.pl, or c) there is no standard.
Thanks!
What are you used to, other than markdown-it? I’d also like to add that I am one person as well.
okay |
Hokay, updates: Not throwing MDX out after all. (This was also related to some other issues I was having that have now been solved.)
Some context: I'm migrating a blog from Jekyll to Gatsby, and I want to use gatsby-mdx with that :)
Indeed, and thanks for pointing me in the right direction. I poked around a bit more, and wrote a small remark-plugin to change footnotes a bit. That way I realized that the commit you linked really just changed the option with which the remark parser is invoked, and all "real" handling of footnotes happens outside of the MDX package itself. Unfortunately, the place that turns a I've opened syntax-tree/mdast-util-to-hast#31 to change this, hoping this change makes the HAST output more flexible. For now, there's nothing really to do in MDX, so I'm closing this issue for now :) |
Yay! ✨
Ahh right! Well, footnotes were implemented in remark like five years ago and they were modelled after kramdown, but nothing ever mentioned inline footnotes back then (and kramdown doesn’t either; btw: remark supports inline footnotes like this:
Oh cool! Good idea! When you’re done please add it to the list of plugins! |
Related to mdx-js/mdx#545. Closes GH-31 Reviewed-by: Titus Wormer <tituswormer@gmail.com> Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>
Subject of the issue
While other markdown parsers just number footnotes, MDX uses the reference ID/text of reference-style as label instead of numbers. Additionally, these text labels are only used at the footnote usage (in the body text), while the actual footnotes (at the end of the document) are just numbered using an
<ol>
.It would be great if this could be adjusted to follow the conventions of regular markdown parsers.
NB: I've tried looking into the code to see if i can adjust or override this behavior myself, but honestly I couldn't find the place where footnotes are processed :(
Your environment
Steps to reproduce
Parse markdown with reference-style footnotes, for example:
Expected behaviour
Footnote usages (in body text) and footnote definitions (end of document) should be numbered in order of reference in the text, like markdown-it does in this example.
Screenshot:
Actual behaviour
The reference IDs (
first
andsecond
in the example above) are used as labels in footnote usages, but footnote definitions are numbered.You can try this by pasting the example markdown above into the "Try it!" field on mdxjs.com.
Screenshot:
The text was updated successfully, but these errors were encountered: