@@ -51,7 +51,7 @@ def nb2html(
51
51
remove_tag_config : dict = {},
52
52
highlight_extra_classes : str = "" ,
53
53
include_requirejs : bool = False ,
54
- custom_mathjax_url : str = "" ,
54
+ custom_mathjax_url : str = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS_CHTML-full,Safe " ,
55
55
):
56
56
"""
57
57
Convert a notebook to HTML
@@ -125,19 +125,9 @@ def custom_clean_html(element):
125
125
preprocessors = preprocessors_ ,
126
126
filters = filters ,
127
127
theme = theme ,
128
+ mathjax_url = custom_mathjax_url ,
128
129
)
129
130
130
- if custom_mathjax_url != "" :
131
- exporter = HTMLExporter (
132
- config = app .config ,
133
- template_file = template_file ,
134
- extra_template_paths = extra_template_paths ,
135
- preprocessors = preprocessors_ ,
136
- filters = filters ,
137
- theme = theme ,
138
- mathjax_url = custom_mathjax_url ,
139
- )
140
-
141
131
_ , extension = os .path .splitext (nb_path )
142
132
143
133
if extension == ".py" :
@@ -168,11 +158,14 @@ def custom_clean_html(element):
168
158
}
169
159
},
170
160
)
171
- content = content + f"""
161
+ content = (
162
+ content
163
+ + f"""
172
164
<style>
173
165
{ resources ["inlining" ]["css" ]}
174
166
</style>
175
167
"""
168
+ )
176
169
177
170
if highlight_extra_classes :
178
171
content = content .replace (
@@ -327,9 +320,9 @@ def custom_markdown2html(source):
327
320
This is done so it's the same HTML structure that for regular non-language
328
321
sections.
329
322
"""
330
- return MarkdownWithMath (
331
- renderer = CustomMarkdownRendered ( escape = False )
332
- ). render ( source )
323
+ return MarkdownWithMath (renderer = CustomMarkdownRendered ( escape = False )). render (
324
+ source
325
+ )
333
326
334
327
335
328
class CustomMarkdownRendered (IPythonRenderer ):
0 commit comments