summaryrefslogtreecommitdiff
path: root/sphinx/ext/mathjax.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2021-05-06 15:10:06 +0200
committerManuel Kaufmann <humitos@gmail.com>2021-05-06 15:21:12 +0200
commitd01e776c814a3f9eaa479ec7eb63fb4fc33a0143 (patch)
tree91537e6414033623575420c52d2a22d983e45269 /sphinx/ext/mathjax.py
parent512743525c64ef880ef02116fe3890ed29339bd4 (diff)
downloadsphinx-git-d01e776c814a3f9eaa479ec7eb63fb4fc33a0143.tar.gz
Add `Sphinx.add_html_assets_in_all_pages`
This new method in the `Sphinx` object allows extensions to communicate to Sphinx that it's preferred to include HTML assets in all the pages. However, it's extensions developers' responsability to follow this config and decide whether or not include the assets required. Extensions developers' can check `Sphinx.html_assets_in_all_pages` together with any other logic they may have to decide if the assets will be included in the rendered page or not. Closes #9115
Diffstat (limited to 'sphinx/ext/mathjax.py')
-rw-r--r--sphinx/ext/mathjax.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/sphinx/ext/mathjax.py b/sphinx/ext/mathjax.py
index 301c0d699..8fc63cb9e 100644
--- a/sphinx/ext/mathjax.py
+++ b/sphinx/ext/mathjax.py
@@ -79,7 +79,7 @@ def install_mathjax(app: Sphinx, pagename: str, templatename: str, context: Dict
'mathjax extension to work')
domain = cast(MathDomain, app.env.get_domain('math'))
- if domain.has_equations(pagename):
+ if app.html_assets_in_all_pages or domain.has_equations(pagename):
# Enable mathjax only if equations exists
options = {'async': 'async'}
if app.config.mathjax_options: