Jump to >

djblets.markdown.extensions.escape_html

Markdown extension to safely escape HTML content.

This is built as a replacement for the safe_mode='escape' Markdown render mode, which is deprecated in Python-Markdown 2.5.

class EscapeHTMLExtension(**kwargs)[source]

Extension to safely escape HTML content.

This will remove any HTML preprocessors and patterns from the renderer, preventing HTML from being interpreted in any form. This results in the HTML being escaped instead, directly mimicking the behavior of the old safe_mode='escape'.

extendMarkdown(md)[source]

Extend the list of Markdown processors.

Rather than extending, this will actually remove all HTML-based processors from the renderer, ensuring that the HTML is instead escaped.

Parameters

md (markdown.Markdown) – The Markdown renderer.

makeExtension(*args, **kwargs)[source]

Create and return an instance of this extension.

Parameters
  • *args (tuple) – Positional arguments for the extension.

  • **kwargs (dict) – Keyword arguments for the extension.

Returns

The extension instance.

Return type

EscapeHTMLExtension