Skip to content

Commit

Permalink
Add config value nbsphinx_assume_equations
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Apr 25, 2021
1 parent 78a6933 commit 001db3d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1798,13 +1798,18 @@ def apply(self):


class ForceEquations(docutils.transforms.Transform):
"""Unconditionally enable equations on notebooks."""
"""Unconditionally enable equations on notebooks.
Except if ``nbsphinx_assume_equations`` is set to ``False``.
"""

default_priority = 900 # after checking for equations in MathDomain

def apply(self):
env = self.document.settings.env
env.get_domain('math').data['has_equations'][env.docname] = True
if env.config.nbsphinx_assume_equations:
env.get_domain('math').data['has_equations'][env.docname] = True


class GetSizeFromImages(
Expand Down Expand Up @@ -2228,6 +2233,7 @@ def setup(app):
app.add_config_value('nbsphinx_widgets_path', None, rebuild='html')
app.add_config_value('nbsphinx_widgets_options', {}, rebuild='html')
app.add_config_value('nbsphinx_thumbnails', {}, rebuild='html')
app.add_config_value('nbsphinx_assume_equations', True, rebuild='html')

app.add_directive('nbinput', NbInput)
app.add_directive('nboutput', NbOutput)
Expand Down

0 comments on commit 001db3d

Please sign in to comment.