Markdown filter, how to add HTML attributes? What's a good way to add attributes (classes etc.) to the HTML elements returned from the markdown filter?
This is what I currently do to add a class Bibliography to all generated &lt;ul&gt; tags from my articleBibliography field. Because there's never other content in this field, I'm save to replace them all.

{{ entry.articleBibliography|markdown|replace({'&lt;ul&gt;': '&lt;ul class="Bibliography"&gt;'})|raw }}


--

Update:
You can also use the awesome Retcon plugin for this, it’s using DomDocument internally so the result should be more reliable.

{{ entry.articleBibliography|markdown|retconAttr('ul', {'class': 'Bibliography'}) }}