Skip to content

Commit

Permalink
html: write image/svg+xml data as base64 and skip clean_html (#2018)
Browse files Browse the repository at this point in the history
Co-authored-by: Steven Silvester <[email protected]>
  • Loading branch information
jstorrs and blink1073 authored Jul 15, 2023
1 parent f17dad8 commit 8e1eae4
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 710 deletions.
6 changes: 1 addition & 5 deletions nbconvert/filters/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
"text_base64",
]

from nbconvert.filters.svg_constants import ALLOWED_SVG_ATTRIBUTES, ALLOWED_SVG_TAGS


def wrap_text(text, width=100):
"""
Expand Down Expand Up @@ -91,11 +89,9 @@ def clean_html(element):
kwargs['css_sanitizer'] = css_sanitizer
return bleach.clean(
element,
tags=[*bleach.ALLOWED_TAGS, *ALLOWED_SVG_TAGS, "div", "pre", "code", "span"],
strip_comments=False,
tags=[*bleach.ALLOWED_TAGS, "div", "pre", "code", "span"],
attributes={
**bleach.ALLOWED_ATTRIBUTES,
**{svg_tag: list(ALLOWED_SVG_ATTRIBUTES) for svg_tag in ALLOWED_SVG_TAGS},
"*": ["class", "id"],
},
**kwargs,
Expand Down
190 changes: 0 additions & 190 deletions nbconvert/filters/svg_constants.py

This file was deleted.

Loading

0 comments on commit 8e1eae4

Please sign in to comment.