Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #280 from jtpio/mathjax
Browse files Browse the repository at this point in the history
Fix handling of the MathJax URL to render Latex
  • Loading branch information
jtpio authored Nov 12, 2021
2 parents 5d5ae1f + ba379d6 commit a77d669
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions retrolab/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
ExtensionHandlerMixin,
ExtensionHandlerJinjaMixin,
)
from jupyter_server.utils import url_path_join as ujoin, url_escape
from jupyter_server.utils import url_path_join as ujoin, url_escape, url_is_absolute
from jupyterlab.commands import get_app_dir, get_user_settings_dir, get_workspaces_dir
from jupyterlab_server import LabServerApp
from jupyterlab_server.config import get_page_config, recursive_update, LabConfig
Expand Down Expand Up @@ -63,6 +63,9 @@ def get_page_config(self):
"mathjax_url",
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js",
)
if not url_is_absolute(mathjax_url) and not mathjax_url.startswith(self.base_url):
mathjax_url = ujoin(self.base_url, mathjax_url)

page_config.setdefault("mathjaxConfig", mathjax_config)
page_config.setdefault("fullMathjaxUrl", mathjax_url)

Expand Down Expand Up @@ -115,7 +118,7 @@ async def get(self, path=None):
if await maybe_future(cm.is_hidden(path)) and not cm.allow_hidden:
self.log.info("Refusing to serve hidden directory, via 404 Error")
raise web.HTTPError(404)

# Set treePath for routing to the directory
page_config = self.get_page_config()
page_config['treePath'] = path
Expand Down

0 comments on commit a77d669

Please sign in to comment.