Skip to content

Commit 6fbed87

Browse files
committed
Wait for mathjax rendering to complete before printing
1 parent b1fd732 commit 6fbed87

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/theme/index.hbs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,6 @@
212212
</script>
213213
{{/if}}
214214

215-
{{#if is_print}}
216-
<script type="text/javascript">
217-
document.addEventListener('DOMContentLoaded', function() {
218-
window.print();
219-
})
220-
</script>
221-
{{/if}}
222-
223215
{{#if playpen_js}}
224216
<script src="ace.js" type="text/javascript" charset="utf-8"></script>
225217
<script src="editor.js" type="text/javascript" charset="utf-8"></script>
@@ -246,5 +238,21 @@
246238
<script type="text/javascript" src="{{this}}"></script>
247239
{{/each}}
248240

241+
{{#if is_print}}
242+
{{#if mathjax_support}}
243+
<script type="text/x-mathjax-config">
244+
MathJax.Hub.Register.StartupHook("End", function() {
245+
window.print();
246+
});
247+
</script>
248+
{{else}}
249+
<script type="text/javascript">
250+
document.addEventListener('DOMContentLoaded', function() {
251+
window.print();
252+
});
253+
</script>
254+
{{/if}}
255+
{{/if}}
256+
249257
</body>
250258
</html>

0 commit comments

Comments
 (0)