Skip to content

Commit

Permalink
Escape </script> tags in JSON data
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Nov 24, 2021
1 parent b34f3e4 commit 44829f1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,12 @@ def replace_attachments(text):
'save_attachments': save_attachments,
'replace_attachments': replace_attachments,
'get_output_type': _get_output_type,
'json_dumps': json.dumps,
'json_dumps': lambda s: re.sub(
r'<(/script)',
r'<\\\1',
json.dumps(s),
flags=re.IGNORECASE,
),
'basename': os.path.basename,
'dirname': os.path.dirname,
})
Expand Down

0 comments on commit 44829f1

Please sign in to comment.