Blockquoted code blocks, part 2

Written late in the morning in English • Tags: ,

For seven years I’ve maintained a small patch to PHP Markdown Extra. However, the upstream was not happy with it, so I just kept my local copy patched. Now I’ve given in: as Markdown has become very popular, it has been better to just adopt a syntax that works across different implementations (e.g. with GitHub Flavored Markdown).

So I’ve gone back to all old posts to rewrite blockquoted code blocks like this:

> ~~~~
> # apt-get install markdown
> [...]
> # dpkg-reconfigure markdown
> ~~~~

Or for longer code passages, this allows cut-and-paste without reformatting (but I have not tested this with anything but PHP Markdown Extra):

<blockquote markdown="1">
~~~~
code()
{
    goes here;
}
~~~~
</blockquote>

Going through old posts took much less time than I thought. (So I guess I should write more often…)

SELECT `post_title`, `post_modified`, `post_status`
FROM `wp_posts`
WHERE `post_content` LIKE '%> ~~%'
AND `post_status` NOT IN ('inherit')
ORDER BY `post_modified` ASC

Then just search for each post in the WordPress admin interface and edit away.