Typo Filters make posting code easy

Posted by Ric Wed, 28 May 2008 14:45:00 GMT

One of the reasons I decided to move away from Blogger as a blogging platform was the difficulty with posting code on Blogger. You had to enter special characters as html ascii codes in order for it to render properly. (Note: this caused a few problems when I migrated over to Typo, as these sequences of html codes rendered explicitly on Typo, causing me to manually have to update several posts to make them intelligible again. Sorry if you see lots of updates in your feed-reader).

Anyway, Typo makes it easy to post code by using Typo Filters. This post by Scott Laird offers a good explanation of how these filters work. Basically, on Typo, you just wrap your code in

<typo:code>
tags and everything just works. You can optionally specify a language for your code block and you get syntax highlighting e.g.

  <typo:code lang="ruby">
    # some ruby here
  </ typo:code> 
  <!-- note that you should NOT leave a space between the slash and the "typo".  
  I've just done it here so that the nested typo:code element renders properly -->

By the way, the above block was styled with:

<typo:code lang="xml">

Trackbacks

Use the following link to trackback from your own site:
http://www.ricroberts.com/trackbacks?article_id=typo-filters-make-posting-code-easy&day=28&month=05&year=2008

Comments

Leave a comment

Comments