asides-38

Taking a break from a bug hunting session that seems to be going nowhere, I added a new feature to this mini-blog/tumblelog. Thanks to Markdown CodeHilite Extension and Pygments, all code fragments here are now syntax highlighted. Here’s a sample:

from pygments.styles import get_all_styles
from pygments.formatters import HtmlFormatter
for s in get_all_styles():
    f = open(s + '.css', 'w')
    f.write(HtmlFormatter(style=s).get_style_defs('.codehilite'))
    f.close()

As you can see from the fragment above, highlighting is css stylesheet based so feedreaders will have to visit the site for the pretty colours :-)

Update: After Bala’s prompting and Bloglines’ announcement, I added inline css styles to the atom feed. Feedreaders rejoice ;-)