By default, Pelican produces HTML (not XHTML) from Markdown. For instance, markup ![A bird](images/bird.jpg)
will produce <img src="images/bird.jpg">
with a non-closed tag, breaking XHTML.
Is there a way to convince Pelican to produce XHTML? Or must I run Tidy on output/*
?
Pelican uses Python-Markdown as its Markdown parser, and Python-Markdown can output XHTML. In fact, that is its default, which copies the reference implementation (markdown.pl). Pelican overrides that default with HTML5
, which, of course, is not valid XHTML.
Any keywords set in Pelican's MARKDOWN
setting get passed directly to the Markdown
class. Therefore, simply define the output_format in your config file:
MARKDOWN = {
'output_format': 'xhtml'
}
Full disclosure: I am a member of the Python-Markdown development team.