Skip to content

Commit

Permalink
clean_html: don't strip comments
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Oct 26, 2022
1 parent d83b26b commit 2d38ce9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions nbconvert/filters/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def clean_html(element):
return bleach.clean(
element,
tags=[*bleach.ALLOWED_TAGS, *ALLOWED_SVG_TAGS, "div", "pre", "code", "span"],
strip_comments=False,
attributes={
**bleach.ALLOWED_ATTRIBUTES,
**{svg_tag: ALLOWED_SVG_ATTRIBUTES for svg_tag in ALLOWED_SVG_TAGS},
Expand Down
1 change: 1 addition & 0 deletions nbconvert/tests/test_nbconvertapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ def test_embedded_svg_remains(self):
with open("issue1849_svg.html", encoding="utf8") as f:
text = f.read()
assert '<g id="line2d_2">' in text # Must not be escaped
assert '<!-- 1.6 -->' in text # Must not be stripped

def test_execute_widgets_from_nbconvert(self):
"""Check jupyter widgets render"""
Expand Down

0 comments on commit 2d38ce9

Please # to comment.