Forked from jessykate/Jekyll nd Octopress Liquid tag for MathJax.rb
Created
October 11, 2011 14:41
-
-
Save milktrader/1278264 to your computer and use it in GitHub Desktop.
A simple liquid tag for Jekyll that converts {% m %} and {% em %} into inline math, and {% math %} and {% endmath %} into block equations, by replacing with the appropriate MathJax script tags.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
class MathJaxBlockTag < Liquid::Tag | |
def render(context) | |
'<script type="math/tex; mode=display">' | |
end | |
end | |
class MathJaxInlineTag < Liquid::Tag | |
def render(context) | |
'<script type="math/tex">' | |
end | |
end | |
class MathJaxEndTag < Liquid::Tag | |
def render(context) | |
'</script>' | |
end | |
end | |
end | |
Liquid::Template.register_tag('math', Jekyll::MathJaxBlockTag) | |
Liquid::Template.register_tag('m', Jekyll::MathJaxInlineTag) | |
Liquid::Template.register_tag('endmath', Jekyll::MathJaxEndTag) | |
Liquid::Template.register_tag('em', Jekyll::MathJaxEndTag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment