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 28, 2021
1 parent 65e5474 commit 5780328
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/nbsphinx.py
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 @@ -2229,6 +2234,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='env')

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

0 comments on commit 5780328

Please sign in to comment.