From 5780328fbb9e8c0969c0bc59d1064bf099cac777 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Sun, 25 Apr 2021 20:52:12 +0200 Subject: [PATCH] Add config value nbsphinx_assume_equations --- src/nbsphinx.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/nbsphinx.py b/src/nbsphinx.py index 18f36740..81f954a7 100644 --- a/src/nbsphinx.py +++ b/src/nbsphinx.py @@ -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( @@ -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)