Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save markandrus/5559223 to your computer and use it in GitHub Desktop.
Save markandrus/5559223 to your computer and use it in GitHub Desktop.
This edit improves compatibility with Markdown processors that output XHTML.
module Jekyll
class MathJaxBlockTag < Liquid::Tag
def render(context)
"<script type=\"math/tex; mode=display\">\n%<![CDATA["
end
end
class MathJaxInlineTag < Liquid::Tag
def render(context)
"<script type=\"math/tex\">\n%<![CDATA["
end
end
class MathJaxEndTag < Liquid::Tag
def render(context)
"%]]>\n</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)
@markandrus
Copy link
Author

Solution from this email.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment