From 125def8b2e5489dae63d29c4bda5245c9a807730 Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Sun, 10 Nov 2019 14:19:39 +0100 Subject: [PATCH 1/2] MNT add support for mathjax --- doc/conf.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index d0db2a953..8992d574d 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -46,13 +46,16 @@ # see https://github.com/numpy/numpydoc/issues/69 numpydoc_show_class_members = False -# pngmath / imgmath compatibility layer for different sphinx versions -import sphinx -from distutils.version import LooseVersion -if LooseVersion(sphinx.__version__) < LooseVersion('1.4'): - extensions.append('sphinx.ext.pngmath') -else: +# For maths, use mathjax by default and svg if NO_MATHJAX env variable is set +# (useful for viewing the doc offline) +if os.environ.get('NO_MATHJAX'): + mathjax_path = '' extensions.append('sphinx.ext.imgmath') + imgmath_image_format = 'svg' +else: + extensions.append('sphinx.ext.mathjax') + mathjax_path = ('https://cdn.jsdelivr.net/npm/mathjax@3/es5/' + 'tex-chtml.js') autodoc_default_flags = ['members', 'inherited-members'] @@ -138,7 +141,7 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -# html_theme_options = {'prev_next_buttons_location': None} +html_theme_options = {'mathjax_path': mathjax_path} # Add any paths that contain custom themes here, relative to this directory. html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] From a64ed569fd30a94ff6f4ffc2e26d140127807f6a Mon Sep 17 00:00:00 2001 From: Guillaume Lemaitre Date: Sun, 10 Nov 2019 14:30:58 +0100 Subject: [PATCH 2/2] iter --- doc/conf.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 8992d574d..be577e8b0 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -46,16 +46,8 @@ # see https://github.com/numpy/numpydoc/issues/69 numpydoc_show_class_members = False -# For maths, use mathjax by default and svg if NO_MATHJAX env variable is set -# (useful for viewing the doc offline) -if os.environ.get('NO_MATHJAX'): - mathjax_path = '' - extensions.append('sphinx.ext.imgmath') - imgmath_image_format = 'svg' -else: - extensions.append('sphinx.ext.mathjax') - mathjax_path = ('https://cdn.jsdelivr.net/npm/mathjax@3/es5/' - 'tex-chtml.js') +extensions.append('sphinx.ext.imgmath') +imgmath_image_format = 'svg' autodoc_default_flags = ['members', 'inherited-members'] @@ -141,7 +133,7 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -html_theme_options = {'mathjax_path': mathjax_path} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]