[Answer]-Wrap markdown code blocks with prettyprint classes in Python

1👍

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)
👤twil

Leave a comment