In python there is a markdown extension which highlights code which is codehilite. This extension wraps the snippets in codehilite classes. How can I get a function like this but to only put class='prettyprint' on every snippet without processing with codehilite.
Basically convert every <pre></pre>
tag that markdown makes into <pre class='prettyprint'></pre>
Why not using str.replace()
or 're.subn()'? E.g.:
replaced = markup.replace('<pre>', '<pre class="prettyprint">')
or
replaced = re.subn('(<pre[^>]*)', '\\1 class="prettyprint"', markup)