Skip to content

Commit 35ae0ea

Browse files
sbrodehlholly1238
andauthored
Replace MathJax with Katex. (#1362)
Co-authored-by: holly1238 <77758406+holly1238@users.noreply.github.com>
1 parent 24946b2 commit 35ae0ea

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

conf.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@
5555
# Add any Sphinx extension module names here, as strings. They can be
5656
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
5757
# ones.
58-
extensions = ['sphinx.ext.mathjax', 'sphinx_copybutton',
59-
'sphinx_gallery.gen_gallery']
58+
extensions = [
59+
'sphinxcontrib.katex',
60+
'sphinx_copybutton',
61+
'sphinx_gallery.gen_gallery',
62+
]
6063

6164

6265
# -- Sphinx-gallery configuration --------------------------------------------
@@ -242,6 +245,18 @@
242245

243246

244247
def setup(app):
248+
# NOTE: in Sphinx 1.8+ `html_css_files` is an official configuration value
249+
# and can be moved outside of this function (and the setup(app) function
250+
# can be deleted).
251+
html_css_files = [
252+
'https://cdn.jsdelivr.net/npm/katex@0.10.0-beta/dist/katex.min.css'
253+
]
254+
# In Sphinx 1.8 it was renamed to `add_css_file`, 1.7 and prior it is
255+
# `add_stylesheet` (deprecated in 1.8).
256+
add_css = getattr(app, 'add_css_file', app.add_stylesheet)
257+
for css_file in html_css_files:
258+
add_css(css_file)
259+
245260
# Custom CSS
246261
# app.add_stylesheet('css/pytorch_theme.css')
247262
# app.add_stylesheet('https://fonts.googleapis.com/css?family=Lato')

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ ray[tune]
2323

2424
ipython
2525

26+
sphinxcontrib.katex
2627
# to run examples
2728
boto3
2829
pandas

0 commit comments

Comments
 (0)