-
Notifications
You must be signed in to change notification settings - Fork 839
improvement: inline local images (virutal files) in the HTML export #7087
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
| buffer = virtual_file.buffer | ||
| # Skip adding if buffer is empty | ||
| if len(buffer) == 0: | ||
| return |
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.
previous bug that would log an unnecessary error
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| LOGGER = _loggers.marimo_logger() | ||
|
|
||
|
|
||
| class _HTMLAttributeReplacer(HTMLParser): |
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.
Surprised you had to roll your own here
| from nbformat.notebooknode import NotebookNode # type: ignore | ||
|
|
||
| VIRTUAL_FILE_ALLOWED_ATTRIBUTES = {"src"} | ||
| VIRTUAL_FILE_ALLOWED_TAGS = {"img"} |
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.
A previous version of this allowed video / audio tags as well. Is that not worth it too large? Might be worth putting a comment at least
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.
yea i didn't want to shove those in here. i can add a comment
dmadisetti
left a comment
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.
It would be nice if we could delegate some of the sanitization stuff- but this is an OK stop gap otherwise
This traversed
<img srcelements and replaces virtual files./@file/foo.pngwith the file and data-uri, so these HTML files can be more self-contained