-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix html repr in untrusted notebooks (plain text fallback) #4053
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
Conversation
The PRE element is not displayed when CSS is injected. When CSS is not injected (untrusted notebook), the PRE element is shown but not the DIV container used for the HTML repr.
Prevent showing those when fallback to plain text repr. A title tag is already present in the HTML label elements.
I tested this out exporting a notebook to Github: Somehow we get both text and malformed HTML? :( It's definitely still an improvement over what we had before, though. |
Mmm it looks like Github's notebook renderer removes the I tested this workaround in jupyterlab, classic notebook and nbviewer. It works as expected. I haven't tested other front-ends (Colab, vscode, etc.). |
I sent a support request to GitHub asking for supporting the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hopefully GitHub will fix their rendering issue, but this is a step in the right direction!
Thanks @benbovy |
just confirmed that the fallback works perfectly. Thanks @benbovy ! |
isort -rc . && black . && mypy . && flake8
whats-new.rst
for all changes andapi.rst
for new APIThis is not very elegant (actually plain text repr is already included in the notebook as
text/plain
mime type but it is ignored whentext/html
mime type is present), but it seems to work. I haven't found a better workaround.I don't really know if this can be properly tested (I only added a basic test).
Steps to test this fix: