Greetings anyone and everyone.
I’ve also posted about the following problem on GH to no avail.
I want to convert notebooks to reveal.js slides. I need to use a custom reveal.js theme. This means a local reveal.js
directory until I setup my own CDN. This is done with nbconvert option --reveal-prefix
Unfortunately, Chrome and MS Edge cease being able to display the resulting files via JupyterLab as soon as slides are generated with option --reveal-prefix
. When loading, these browsers report CORS-related errors. Firefox is ok. Of course loading the same file outside of JLab, with any browser, works.
Errors look like this (multiple instances):
Cross-Origin Read Blocking (CORB) blocked cross-origin response http://localhost:8888/login?next=%2Ffiles%2Fwork%2Fme%2Freveal.js%2Fdist%2Freveal.css with MIME type text/html. See https://www.chromestatus.com/feature/5629709824032768 for more details.
The offending line that corresponds to the above error is generated like this:
grep dist/reveal.css /opt/conda/share/jupyter/nbconvert/templates/reveal/index.html.j2
<link rel="stylesheet" href="{{ reveal_url_prefix }}/dist/reveal.css">
- The output file is unusable under JupyterLab (http://localhost:8888/), except if using Firefox, where everything is fine.
- Removing option
--reveal-prefix
allows viewing the files normally under Chrome or MS Edge. - Adding option
--post serve
allows allows viewing the files normally under Chrome or MS Edge using the dedicated URL (http://localhost:8000) - Funnily, hacking the HTML page and adding the identification token fixes the issue with Chrome or MS Edge:
$ grep -A1 -B1 token slides-test-hack.slides.html
<!-- General and theme style sheets -->
<link rel="stylesheet" href="reveal.js/dist/reveal.css?token=b28ca9b1b7c3ad0cdb61622b682b47ffd74518cb47796314">
--
<!-- End of mathjax configuration --><!-- Reveal Theme -->
<link rel="stylesheet" href="reveal.js/dist/theme/mytheme.css?token=b28ca9b1b7c3ad0cdb61622b682b47ffd74518cb47796314" id="theme">
--
[
"reveal.js/dist/reveal.js?token=b28ca9b1b7c3ad0cdb61622b682b47ffd74518cb47796314",
"reveal.js/plugin/notes/notes.js?token=b28ca9b1b7c3ad0cdb61622b682b47ffd74518cb47796314"
],
I’ve nothing against Firefox, but does anyone know how to make themed slides generated in JupyterLab viewable in JupyterLab?