marked icon indicating copy to clipboard operation
marked copied to clipboard

Is "footnote" supported in marked.js?

Open alston19 opened this issue 9 years ago • 10 comments

It doesn't work when I input :

hello[^hello]
[^hello]: hi

alston19 avatar Jan 30 '16 12:01 alston19

No, footnotes are a non-standard markdown extension and aren't supported, sorry!

ariabuckles avatar Feb 01 '16 19:02 ariabuckles

Okay, thanks for answering. Maybe I can implement it myself.

alston19 avatar Feb 02 '16 09:02 alston19

@alston19 I know it's been long but I'm wondering whether you found a solution to this?

SHxKM avatar Oct 10 '19 16:10 SHxKM

@SHxKM sorry but no 😂

alston19 avatar Oct 10 '19 17:10 alston19

@SHxKM check out https://github.com/markedjs/marked/issues/1562#issuecomment-551269829 to find some code that should work to add footnotes.

UziTech avatar Nov 07 '19 21:11 UziTech

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 avatar Sep 30 '21 20:09 splch

@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

UziTech avatar Sep 30 '21 21:09 UziTech

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 🤞

styfle avatar Oct 07 '21 18:10 styfle

Ya it seems like there are a lot of errors with it since they don't specify what happens in edge cases.

UziTech avatar Oct 08 '21 00:10 UziTech

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!

dminkovsky avatar Oct 29 '21 18:10 dminkovsky

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.

xieyuheng avatar Apr 06 '23 09:04 xieyuheng

In the mean time, any user who wants this should feel free to make this into a Marked Extension .

calculuschild avatar Apr 06 '23 14:04 calculuschild

@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 avatar Apr 06 '23 14:04 UziTech

@UziTech is this issue still open ? I would like to contribute this feature.

RavenColEvol avatar Oct 02 '23 11:10 RavenColEvol

Ya go ahead. Thanks!

UziTech avatar Oct 02 '23 14:10 UziTech

@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)

RavenColEvol avatar Oct 03 '23 04:10 RavenColEvol

When considering the use of footnotes in your content, it's important to keep in mind the following accessibility and usability factors:

  1. 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.
  2. 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.

bent10 avatar Oct 10 '23 11:10 bent10

I'm going to close this since there is an extension created

UziTech avatar Oct 23 '23 04:10 UziTech