Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated sphinx.ext.mathbase.setup_math #10

Merged
merged 5 commits into from Jun 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions sphinxcontrib/katex.py
Expand Up @@ -20,7 +20,6 @@
from sphinx.locale import _
from sphinx.errors import ExtensionError
from sphinx.util.osutil import copyfile
from sphinx.ext.mathbase import setup_math as mathbase_setup


__version__ = '0.4.1'
Expand Down Expand Up @@ -204,10 +203,16 @@ def setup_static_path(app):

def setup(app):
try:
mathbase_setup(app, (html_visit_math, None),
(html_visit_displaymath, None))
except ExtensionError:
raise ExtensionError('KaTeX: other math package is already loaded')
app.add_html_math_renderer(
'katex',
inline_renderers=(html_visit_math, None),
block_renderers=(html_visit_displaymath, None)
)
except AttributeError:
# Versions of sphinx<1.8 require setup_math instead
from sphinx.ext.mathbase import setup_math
setup_math(app, (html_visit_math, None),
(html_visit_displaymath, None))

# Include KaTex CSS and JS files
katex_url = 'https://cdn.jsdelivr.net/npm/katex@{version}/dist/'.format(
Expand Down