diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py index 81fb1f3d0..f555e99ec 100644 --- a/doc/sphinx/conf.py +++ b/doc/sphinx/conf.py @@ -41,7 +41,7 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.autosummary', - 'mathjax', + 'sphinx.ext.mathjax', 'sphinxcontrib.doxylink', ] @@ -52,8 +52,6 @@ autodoc_default_flags = ['members','show-inheritance','undoc-members'] autoclass_content = 'both' -mathjax_path = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' - doxylink = { 'ct' : (os.path.abspath('../../build/docs/Cantera.tag'), '../../doxygen/html/') diff --git a/doc/sphinx/mathjax.py b/doc/sphinx/mathjax.py deleted file mode 100644 index 59beff3a4..000000000 --- a/doc/sphinx/mathjax.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- -""" - sphinx.ext.mathjax - ~~~~~~~~~~~~~~~~~~ - - Allow `MathJax `_ to be used to display math - in Sphinx's HTML writer - requires the MathJax JavaScript library - on your webserver/computer. - - Kevin Dunn, kgdunn@gmail.com, 3-clause BSD license. - - - For background, installation details and support: - - https://bitbucket.org/kevindunn/sphinx-extension-mathjax - -""" -from docutils import nodes -from sphinx.application import ExtensionError -from sphinx.ext.mathbase import setup_math as mathbase_setup - -def html_visit_math(self, node): - self.body.append(self.starttag(node, 'span', '', CLASS='math')) - self.body.append(self.builder.config.mathjax_inline[0] + \ - self.encode(node['latex']) +\ - self.builder.config.mathjax_inline[1] + '') - raise nodes.SkipNode - -def html_visit_displaymath(self, node): - self.body.append(self.starttag(node, 'div', CLASS='math')) - if node['nowrap']: - self.body.append(self.builder.config.mathjax_display[0] + \ - node['latex'] +\ - self.builder.config.mathjax_display[1]) - self.body.append('') - raise nodes.SkipNode - - parts = [prt for prt in node['latex'].split('\n\n') if prt.strip() != ''] - for i, part in enumerate(parts): - part = self.encode(part) - if i == 0: - # necessary to e.g. set the id property correctly - if node['number']: - self.body.append('(%s)' % - node['number']) - if '&' in part or '\\\\' in part: - self.body.append(self.builder.config.mathjax_display[0] + \ - '\\begin{split}' + part + '\\end{split}' + \ - self.builder.config.mathjax_display[1]) - else: - self.body.append(self.builder.config.mathjax_display[0] + part + \ - self.builder.config.mathjax_display[1]) - self.body.append('\n') - raise nodes.SkipNode - -def builder_inited(app): - if not app.config.mathjax_path: - raise ExtensionError('mathjax_path config value must be set for the ' - 'mathjax extension to work') - app.add_javascript(app.config.mathjax_path) - -def setup(app): - mathbase_setup(app, (html_visit_math, None), (html_visit_displaymath, None)) - app.add_config_value('mathjax_path', '', False) - app.add_config_value('mathjax_inline', [r'\(', r'\)'], 'html') - app.add_config_value('mathjax_display', [r'\[', r'\]'], 'html') - app.connect('builder-inited', builder_inited) -