How to configure HTML processing in templates
HTML and Markdown options
Anywhere that Markdown or HTML is processed from a content file, the following parameters apply:
- The standard image rendition arguments
absolute: Set to True to force all links to be absolute (rather than relative); for HTML, this applies to allhref,src, and rendition attributes.markup: Whether to include any markup in the title; defaults toTrue, but should be set toFalsewhere HTML markup isn’t valid.For example, markup isn’t allowed in the HTML
<title>tag:<html> <head><title>{{ entry.title(markup=False) }}</title></head> <body><h1>{{ entry.title }}</h1></body> </html>
Nor is it valid in HTML attributes:
<a href="{{category.link}}" title="{{category.description(markup=False)}}">{{category.name}}</a> <a href="{{entry.link}}" title="{{entry.title(markup=False)}}">{{entry.title}}</a>
For the sake of improving readability, this will also remove the contents of
<del>and<s>tags (such as what are rendered by Markdown~~strikethrough~~); for example, an entry title ofThis is ~~not~~ a testwill render asThis is a test. If you would like more control over this behavior, use thestrip_htmlfilter instead.
Markdown-only options
The following options only apply to Markdown content:
smartquotes: Set toTrueto enable automatic smartquote substitution, orFalseto disable it (necessary in e.g. Atom feeds). Defaults toTrue.no_smartquotes: The opposite ofsmartquotes, provided for backwards compatibility; ifsmartquotesis set then this is ignored.markdown_extensions: A list of extensions to configure the Markdown formatter with; defaults to the global configuration.xhtml: Set toTrueto render as XHTML instead of HTML (default:False)
Note that an entry’s title is always treated as Markdown, even if the entry itself is HTML.