djblets.markdown.extensions.wysiwyg_email¶
Markdown extension to render content similar to the source in e-mails.
This will render Markdown such that the spacing and alignment in the source text and the rendered content looks roughly the same. It’s meant to help ensure that what’s typed is very close to what’s viewed when rendered.
- class InlineStyleProcessor(md=None)[source]¶
Injects CSS styles directly into the tags, for use in e-mails.
This will process each element and, depending on the element type, create inline styles. These styles are meant to match the stylesheets in the
markdown-wysiwyg.less
file.- process_element(context, el)[source]¶
Process an element in the tree.
This adds a handful of inline styles to the resulting document which mimic the .rich-text rules in markdown-wysiwyg.less.
This does not do quite everything that the markdown-wysiwyg.less rules do, due to the complexity in implementing CSS selectors in Python, and the CSS compatibility logic in most e-mail clients.
The end result is that the e-mail will look similar but not identical to the page.
- class WysiwygEMailExtension(**kwargs)[source]¶
A Markdown extension to inject CSS into elements for HTML output.
This is meant as a counterpart to the Wysiwyg Markdown extension. It aims to provide HTML output that looks as similar as possible to the input, preserving the spacing, font sizes, alignment, and other styles from the raw text.
This is meant to be used with the following Markdown configuration and extensions:
{ 'extensions': [ 'codehilite(noclasss=True)', 'tables', 'djblets.markdown.extentions.wysiwyg', ], }