Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load external stylesheets #87

Open
tz1112 opened this issue Jun 19, 2024 · 5 comments
Open

Unable to load external stylesheets #87

tz1112 opened this issue Jun 19, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@tz1112
Copy link

tz1112 commented Jun 19, 2024

Applying external css stylesheets does not work, neither the default rise.css nor a custom stylesheet (same name as the notebook file, placed in the same folder) are loaded correctly. While debugging this issue, I noticed that the file path construction might be incorrect (see the additional '/' right before the stylesheet filenames 'rise.css' and 'test.css'; screenshot is taken from developer console of the browser).

Screenshot from 2024-06-19 14-38-23

Relevant code snippet might be at rise.ts:925, where the paths for both elements are built using the same method.

@tz1112 tz1112 added the bug Something isn't working label Jun 19, 2024
@apohllo
Copy link

apohllo commented Oct 9, 2024

I can confirm, that removing the extra slash fixes the problem. I checked that with curl, and the stylesheet is returned then. The info about MIME mismatch is caused by the fact that when an invalid path is accessed not 404 but 403 is returned with a HTML file stating that the path is forbidden (rather than non-existant).

@apohllo
Copy link

apohllo commented Oct 9, 2024

I suppose the error comes from the fact that curdir has a trailing slash.

@apohllo
Copy link

apohllo commented Oct 9, 2024

OK, I think I have nailed down that issue. So the problem appears only when the notebook is in the root folder where jupyter is run. In that case curdir is an empty string and we have // in the path.
If you put the notebook in a subdirectory, then curdir is not empty and the URL is constructed correctly.

This is such a nasty issue, since I struggle with it for so many times, but magically something was resolved. I thought it was the new version of RISE or sth that fixed the error, but the truth was that I was running Jupyter in a different directory...

curdir should be excluded from the URL if it is empty. This will fix the issue.

@lahwaacz
Copy link

lahwaacz commented Oct 9, 2024

@apohllo Can you submit a pull request? 😉

@afeld
Copy link
Contributor

afeld commented Oct 20, 2024

Duplicate of #27. Appears that fix has not yet been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants