I am just trying to add footnotes in my GitHub Gist, but it doesn't work:

Some long sentence. [^footnote]

[^footnote]: Test, [Link](https://google.com).

I am following this guide and I don't think I'm doing anything wrong. Can someone point out my mistake?

share|improve this question
    
fletcher.github.io/peg-multimarkdown Note: Currently, the Github wiki software supports Markdown, but not MultiMarkdown Where is it documented that this is going to work? – ta.speot.is Aug 30 '14 at 7:06
    
@ta.speot.is Ah, damn, so it wouldn't work? Is there any other way to do footnote in regular Markdown? – Enrico Susatyo Aug 30 '14 at 7:07
    
@EnricoSusatyo Not in plain markdown, but for example Pandoc supports it – mb21 Aug 30 '14 at 22:49
    
Interestingly, GitLab's markdown does support the [^footnote] syntax, even before it got officially added to the documentation – hmijail Nov 1 '16 at 11:02
up vote 113 down vote accepted

GitHub Flavored Markdown doesn't support footnotes, but you can manually fake it¹ with Unicode characters or superscript tags, e.g. <sup>1</sup>.

¹Of course this isn't ideal, as you are now responsible for maintaining the numbering of your footnotes. It works reasonably well if you only have one or two, though.

share|improve this answer
    
Thanks, I also like how other sites have clickable footnote links, but I guess this might be the only way to do it in GitHub. – Enrico Susatyo Sep 1 '14 at 6:20
1  
You can also use regular numbers enclosed in square brackets[1], which is a pretty established convention for plaintext footnotes in my experience. (Gosh darnit why can’t I make line breaks in comments.) [1] I.e. like Pandoc Mandoc footnotes minus the caret. – Guildenstern Nov 1 '16 at 20:09
    
up because of the good humor :) – Bruno Brant May 18 '17 at 14:32

Expanding a little bit on the previous answer, you can make the footnote links clickable here as well. First define the footnote at the bottom like this

<a name="myfootnote1">1</a>: Footnote content goes here

Then reference it at some other place in the document like this

<sup>[1](#myfootnote1)</sup>
share|improve this answer
    
This is a nice middle-ground answer. It maintains clarify of intent without, IMO, too much bloat for formatting. – kayleeFrye_onDeck Feb 25 '16 at 19:45
    
Using non-numeric references obviates the above-mentioned issue of maintaining sequential numeric references - Example [[TPL]](#TPL) ... #### Notes ... <a name="TPL">[TPL]</a> footnote template – Randall Whitman Oct 27 '16 at 17:07
1  
Don't miss Part 2 in @Matteo's answer below. I was so chuffed with this answer (thanks) that i almost didn't bother to scroll down . . . – wardw Jan 6 '17 at 12:52

Expanding on the previous answers even further, you can add an id attribute to your footnote's link:

 Bla bla <sup id="a1">[1](#f1)</sup>

Then from within the footnote, link back to it.

<b id="f1">1</b> Footnote content here. [↩](#a1)

This will add a little at the end of your footnote's content, which takes your readers back to the line containing the footnote's link.

share|improve this answer
5  
Adding a minor correction to @Matteo's response above, I had to use name instead of id in the call to the footnote. I.e. <p> Bla bla <sup name="a1">[1](#f1)</sup> – oldfartdeveloper Sep 1 '15 at 10:41
1  
Thanks @oldfartdeveloper. It seems that both name and id work for README files on github.com.. haven't tested gists though. – Matteo Sep 2 '15 at 13:27

I wasn't able to get Surya's and Matteo's solutions to work. For example, "(#f1)" was just displayed as text, and didn't become a link. However, their solutions led me to slightly different solution. (I also formatted the footnote and the link back to the original superscript a bit differently.)

In the body of the text:

Yadda yadda<a href="#note1" id="note1ref"><sup>1</sup></a>

At the end of the document:

<a id="note1" href="#note1ref"><sup>1</sup></a>Here is the footnote text.

Clicking on the superscript in the footnote returns to the superscript in the original text.

share|improve this answer

For short notes, providing an anchor element with a title attribute creates a "tooltip".

<a title="Note text goes here."><sup>n</sup></a>

Otherwise, for more involved notes, it looks like your best bet is maintaining named links manually.

share|improve this answer
    
This did not work in a GitHub Enterprise 2.8 markdown page – yegeniy May 11 '17 at 17:04

Although I am not aware if it's officially documented anywhere, you can do footer notes in Github.

  1. Mark the place where you want to insert footer link with a number enclosed in square brackets, I.E. [1]

  2. On the bottom of the post, make a reference of the numbered marker and followed by a semi-colum and the link, I.E. [1]: http://www.example.com/link1

And once you preview it, it will be rendered as numbered links in the body of the post.

share|improve this answer
3  
This doesn't generate a list of links at the end of your document though. Like on Wikipedia pages. – milosa Sep 29 '16 at 15:59
    
should there be a colon after the square brackets? – sAguinaga Jun 8 '17 at 16:51

I used a variant of Mateo's solution. I'm using this in Rmd files written in github flavored markdown (gfm) for a Jekyll powered website but the same Rmd files are being used to produce pdfs in various contexts. The Rmd files are math heavy and the math is displayed with MathJax on the website. So I needed a solution that works with gfm that is processed via Jekyll, works with pandoc->pdflatex, and is compatible with MathJax.

snippet from Rmd file (which is gfm)

Here is a paragraph with a footnote <span id="a1">[[1]](#f1)</span>.

Footnotes
=========

1. <span id="f1"></span> This is a footnote. [$\hookleftarrow$](#a1)

$\hookleftarrow$ is latex, which works for me since I always have MathJax enabled. I use that to make sure it shows up correctly in my pdfs. I put my footnotes in square brackets because superscript is confusing if I am putting a footnote on some inline math.

Here it is in action: https://eeholmes.github.io/posts/2016-5-19-FI-recursion-2/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.