Jekyll with Footnotes
06 May 2013
Jonathon Kram has informed me that Kramdown does, indeed, support Footnotes. Using it is likely easier than the method I describe in this post. Thanks, Jonathon!
None of Jekyll’s Markdown renderers support footnotes out of the box1, but a RedCarpet fork has the feature. Here’s how I got footnotes working in two easy steps:
1) Use the fork
The RedCarpet gem we want to use is not available on RubyGems.org, but Bundler can install it directly from GitHub. Add a Gemfile
to your Jekyll site’s root directory that looks like this:
source "https://rubygems.org"
gem "jekyll"
gem "redcarpet", github: "triplecanopy/redcarpet"
Run bundle install
and then you should be all ready to go.2
2) Configure RedCarpet
You have to configure Jekyll to use RedCarpet for Markdown rendering, but you also have to configure RedCarpet to use the footnotes
extension. Add these lines to your _config.yml
:
markdown: redcarpet
redcarpet:
extensions: [footnotes]
That’s it! You now have footnotes with Jekyll.
Enjoy.
-
Footnotes is not an official Markdown feature, but was added by PHP-Markdown and a few derivative projects. The feature hasn’t made it in to RedCarpet proper (by way of Sundown) because of the concerted effort by GitHub, Reddit, etc. to develop and support a Markdown standard which will replace Sundown. See this issue if you’re interested in learning more. ↩
-
You will now have to use
bundle exec jekyll
to invoke Bundler and pick up the correct RedCarpet gem. If that’s a pain, there are workarounds forbundle exec
. ↩