Skip to content

Commit d97c011

Browse files
authored
Add support for mathjax4_config (#854)
1 parent 4882668 commit d97c011

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
@@ -1595,19 +1595,24 @@ def config_inited(app, config):
15951595
# this only works if mathjax_config or mathjax2_config is specified.
15961596
if config.mathjax3_config is None:
15971597
config.mathjax3_config = {}
1598-
mathjax3_config = config.mathjax3_config
1598+
mathjax_config = config.mathjax3_config
1599+
if not mathjax_config and hasattr(config, 'mathjax4_config'):
1600+
# mathjax4_config was added in Sphinx 9
1601+
if config.mathjax4_config is None:
1602+
config.mathjax4_config = {}
1603+
mathjax_config = config.mathjax4_config
15991604
tex = {
16001605
'inlineMath': mathjax_inline_math,
16011606
'processEscapes': True,
16021607
}
1603-
tex.update(mathjax3_config.get('tex', {}))
1604-
mathjax3_config['tex'] = tex
1608+
tex.update(mathjax_config.get('tex', {}))
1609+
mathjax_config['tex'] = tex
16051610
options = {
16061611
'ignoreHtmlClass': mathjax_ignore_class,
16071612
'processHtmlClass': mathjax_process_class,
16081613
}
1609-
options.update(mathjax3_config.get('options', {}))
1610-
mathjax3_config['options'] = options
1614+
options.update(mathjax_config.get('options', {}))
1615+
mathjax_config['options'] = options
16111616
else:
16121617
if hasattr(config, 'mathjax2_config'):
16131618
# Sphinx >= 4.0

0 commit comments

Comments
 (0)