Skip to content

Commit 1501e03

Browse files
authored
Handle mathjax_url properly (#150)
1 parent 192c753 commit 1501e03

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

jupyterlab_server/handlers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@ def get(self, mode = None, workspace = None, tree = None):
9292
mathjax_config = self.settings.get('mathjax_config',
9393
'TeX-AMS_HTML-full,Safe')
9494
# TODO Remove CDN usage.
95-
mathjax_url = self.settings.get('mathjax_url',
96-
'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js')
95+
mathjax_url = self.settings.get('mathjax_url', '')
96+
if not mathjax_url:
97+
mathjax_url = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js'
98+
elif not urlparse(mathjax_url).scheme:
99+
mathjax_url = ujoin(self.base_url, mathjax_url)
100+
97101
page_config.setdefault('mathjaxConfig', mathjax_config)
98102
page_config.setdefault('fullMathjaxUrl', mathjax_url)
99103

0 commit comments

Comments
 (0)