Skip to content

Commit fbc05e4

Browse files
committed
Add support for mathjax4_config
1 parent 394b9ee commit fbc05e4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/nbsphinx/__init__.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,19 +1592,24 @@ def config_inited(app, config):
15921592
# this only works if mathjax_config or mathjax2_config is specified.
15931593
if config.mathjax3_config is None:
15941594
config.mathjax3_config = {}
1595-
mathjax3_config = config.mathjax3_config
1595+
mathjax_config = config.mathjax3_config
1596+
if not mathjax_config and hasattr(config, 'mathjax4_config'):
1597+
# mathjax4_config was added in Sphinx 8.?
1598+
if config.mathjax4_config is None:
1599+
config.mathjax4_config = {}
1600+
mathjax_config = config.mathjax4_config
15961601
tex = {
15971602
'inlineMath': mathjax_inline_math,
15981603
'processEscapes': True,
15991604
}
1600-
tex.update(mathjax3_config.get('tex', {}))
1601-
mathjax3_config['tex'] = tex
1605+
tex.update(mathjax_config.get('tex', {}))
1606+
mathjax_config['tex'] = tex
16021607
options = {
16031608
'ignoreHtmlClass': mathjax_ignore_class,
16041609
'processHtmlClass': mathjax_process_class,
16051610
}
1606-
options.update(mathjax3_config.get('options', {}))
1607-
mathjax3_config['options'] = options
1611+
options.update(mathjax_config.get('options', {}))
1612+
mathjax_config['options'] = options
16081613
else:
16091614
if hasattr(config, 'mathjax2_config'):
16101615
# Sphinx >= 4.0

0 commit comments

Comments
 (0)