css - Wrap markdown code blocks with prettyprint classes in Python -


in python there markdown extension highlights code codehilite. extension wraps snippets in codehilite classes. how can function put class='prettyprint' on every snippet without processing codehilite.

basically convert every <pre></pre> tag markdown makes <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) 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -