Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions docs/release-2.6.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ raw HTML, then that can be accomplished through an extension which removes HTML

class EscapeHtml(Extension):
def extendMarkdown(self, md, md_globals):
del md.preprocessors['html_block']
del md.inlinePatterns['html']
del md.preprocessors['html_block']
del md.inlinePatterns['html']

html = markdown.markdown(text, extensions=[EscapeHtml()])

As the HTML would not be parsed with the above Extension, then the serializer will
escape the raw HTML, which is exactly what happens now when `safe_mode="escape"`.

Please note that above ``EscapeHtml`` extension does not work with the ``extra``
extension as it depends on the ``html_block`` preprocessor.

[Bleach]: https://bleach.readthedocs.io/

### Positional Arguments Deprecated
Expand Down