marked
marked copied to clipboard
Is "footnote" supported in marked.js?
It doesn't work when I input :
hello[^hello]
[^hello]: hi
No, footnotes are a non-standard markdown extension and aren't supported, sorry!
Okay, thanks for answering. Maybe I can implement it myself.
@alston19 I know it's been long but I'm wondering whether you found a solution to this?
@SHxKM sorry but no 😂
@SHxKM check out https://github.com/markedjs/marked/issues/1562#issuecomment-551269829 to find some code that should work to add footnotes.
Github flavored markdown now supports footnotes (https://github.blog/changelog/2021-09-30-footnotes-now-supported-in-markdown-fields/). Does that mean it's now time to implement this feature?
@splch If you want to implement this it would probably be accepted now. It would be better if GitHub would add it to the GFM spec so we could know the edge cases but it looks like they haven't updated the spec in a while. ☹
Looks like there is already an issue for this. https://github.com/github/cmark-gfm/issues/236
I just came across this new feature on GitHub too.
I'll reopen the issue so others coming here can find it 👍
Hopefully GitHub updates the GFM spec soon 🤞
Ya it seems like there are a lot of errors with it since they don't specify what happens in edge cases.
Until this is addressed, I've been working around by using HTML inside my markdown:
<span class="super">1</span>
Where
{
.super {
vertical-align: super;
font-size: 0.8rem;
}
Not the greatest, but it works!
There is markdown-it-footnote: https://github.com/markdown-it/markdown-it-footnote
- almost ten years old.
- 360 lines of code.
- a lot of tests.
- used by 59,616 projects.
You do not have to wait for github to give a spec, to implement a useful support of footnote.
In the mean time, any user who wants this should feel free to make this into a Marked Extension .
@xieyuheng would you like to work on adding it to marked? PRs are always welcome 😁👍
This is open source software so anyone can work on adding footnotes in marked. Once someone who wants them in marked is willing to work on it they will be added.
@UziTech is this issue still open ? I would like to contribute this feature.
Ya go ahead. Thanks!
@UziTech I'll try to cover up these cases for foot note which is given in markdown-it-footnote
Normal Footnote
Here is a footnote reference,[^1] and another.[^longnote]
[^1]: Here is the footnote.
[^longnote]: Here's one with multiple blocks.
Subsequent paragraphs are indented to show that they
belong to the previous footnote.
Inline footnote
Here is an inline note.^[Inlines notes are easier to write, since
you don't have to pick an identifier and move down to type the
note.]
output for above examples are given in there documentation (here)
When considering the use of footnotes in your content, it's important to keep in mind the following accessibility and usability factors:
- Screen Reader Compatibility: Screen readers may not effectively convey footnotes. They tend to read the footnote number without indicating that it's a footnote or using superscript. Additionally, they may not identify the link to the footnote text.
- Accessibility Challenges: Footnotes pose challenges for all users on a web page. To access them, one often needs to scroll to the end of the page, read the footnote, and then click back to the main content. Not everyone is aware that they should click on the footnote at the end, potentially causing them to lose their place. Moreover, if the same footnote is repeated multiple times, clicking on the link could lead to the wrong location.
If you find it necessary to use footnotes, feel free to explore the marked-footnote
extension.
I'm going to close this since there is an extension created