Footnote plugin for Octopress (Jekyll).
This plugin requires parser which has an extension of PHP Markdown Extra, such Kramdown or RDiscount (>=2.0.7).
This plugin can live with footnote-octopress. JavaScript was forked from this plugin.
Although you can't use footnote-octopress and footnote-extra in the same post, you can use each plugin in different posts in the same blog.
-
Copy
plugins/footnote_extra.rb
to yourplugins
directory. -
Install JavaScript. If you have already installed footnote-octopress, you may already have
source/javascripts/footnote.js
.Otherwise, copy
source/javascripts/footnote.js
to yoursource/javascripts/
directory, and add a line:<script src="{{root_url}}/javascripts/footnote.js"></script>
to
source/_includes/custom/head.html
. -
Install SCSS. As same as JavaScript, you may already have
sass/plugins/_footnote.scss
, orsource/custom/footnote.js
.Otherwise, copy
sass/plugins/_footnote.scss
to yoursass/plugins/
directory.If you have old octopress (if your
sass/screen.scss
doesn't have@import "plugins/**/*";
), you may need to add@import "footnote"
to
sass/plugins/_plugins.scss
.
Done!
You can use footnote-extra like Latex's footnote
.
Write {%fnex%}
-{%endfnex%}
or {%footnote_extra%}
-{%endfootnote_extra%}
at where you want to add a footnote.
e.g.)
This is a footnote test{%fnex%}This is footnote.{%endfnex%}.
You can also use code syntax with indent:
This is a footnote test with code
{%fnex%}Code test:
This is a code.
This is a normal line.
And `inline code`.
{%endfnex%}.
Reference numbers for each footnote are assigned automatically, so that you don't need to fix numbers by yourself when you want to insert new footnote before other footnotes.
In the post for which you want to use footnote-extra, do not use any footnote-octopress tags or PHP Markdown Extra's footnote syntax itself.
Finally, add a following line in the end of the post:
{%footnotes_extra%}
or
{%footnotes_list_extra%}
It is useful to add
post.puts "{%footnotes_extra%}"
to the end of new_post
task in Rake file.
{%footnotes_extra%}
does nothing if there is no
{%fnex%}
({%footnote_extra%}
)
in the post.
In this case, it is no probrem even if there is footnote-octopress tag
or PHP Markdown Exra footnote syntax in the post.
Change footnote styles in sass/plugins/_footnote.scss
as you like.
footnote-extra's _footnote.scss
may be useful
even if you already have _footnote.scss
from footnote-octopress.