Skip to content
Permalink
Browse files

Merge pull request #2045 from getnikola/katex

Add a USE_KATEX option
  • Loading branch information
ralsina committed Sep 10, 2015
2 parents 9450426 + b737378 commit acf5fb731c42e5d27dd87424dcd70017e49b3129
@@ -4,6 +4,7 @@ New in master
Features
--------

* New option USE_KATEX to switch from MathJax to KaTeX (Experimental).
* Support SVG in galleries (Issue #1605)
* Allow inheriting templates with theme name (Issue #1814)
* Made TAG_PATH translatable (Issue #1914)
@@ -829,6 +829,13 @@ PRETTY_URLS = ${PRETTY_URLS}
# </script>
# """

# Want to use KaTeX instead of MathJax? While KaTeX is less featureful,
# it's faster and the output looks better.
# If you set USE_KATEX to True, you also need to add an extra CSS file
# like this:
# EXTRA_HEAD_DATA = """<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min.css">"""
# USE_KATEX = False

# Do you want to customize the nbconversion of your IPython notebook?
# IPYNB_CONFIG = {}
# With the following example configuration you can use a custom jinja template
@@ -20,11 +20,17 @@

<%def name="mathjax_script(posts)">
%if any(post.is_mathjax for post in posts):
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
%if use_katex:
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script>
<script>
renderMathInElement(document.body);
</script>
%else:
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
%endif
%endif
</%def>
@@ -86,11 +86,17 @@

<%def name="mathjax_script(post)">
%if post.is_mathjax:
<script type="text/javascript"
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
%if use_katex:
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/contrib/auto-render.min.js"></script>
<script>
renderMathInElement(document.body);
</script>
%else:
<script type="text/javascript" src="//cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
%endif
%endif
</%def>
@@ -491,6 +491,7 @@ def __init__(self, **config):
'USE_CDN': False,
'USE_CDN_WARNING': True,
'USE_FILENAME_AS_TITLE': True,
'USE_KATEX': False,
'USE_OPEN_GRAPH': True,
'USE_SLUGIFY': True,
'TIMEZONE': 'UTC',
@@ -915,6 +916,7 @@ def _set_global_context(self):
self._GLOBAL_CONTEXT['site_has_comments'] = bool(self.config.get('COMMENT_SYSTEM'))
self._GLOBAL_CONTEXT['mathjax_config'] = self.config.get(
'MATHJAX_CONFIG')
self._GLOBAL_CONTEXT['use_katex'] = self.config.get('USE_KATEX')
self._GLOBAL_CONTEXT['subtheme'] = self.config.get('THEME_REVEAL_CONFIG_SUBTHEME')
self._GLOBAL_CONTEXT['transition'] = self.config.get('THEME_REVEAL_CONFIG_TRANSITION')
self._GLOBAL_CONTEXT['content_footer'] = self.config.get(

0 comments on commit acf5fb7

Please sign in to comment.