A couple of ways to post code in MoveableType

Thanks to the helpful folks on the MoveableType support forum I now have a couple of ways to post code in my entries.
NOTE: because my new multi-column layout creates issues with form fields in Safari, I’ve also included links to download the code.

1. Install Brad Choates macro plugin, and use it to escape the HTML. Insert this into your templates:

CODE (or download it here)

 

<MTMacroDefine pattern=”m/[code](.+?)[/code]/si”>

<pre><MTMacroMatch position=”1″ encode_html=”1″></pre>

</MTMacroDefine>

2. Or you can do it the way I did it for the example above:
run your code through this page: Accessify Quick Escape” and then surround it with a textarea:

CODE (or download it here)


<textarea cols="40" name="text" rows="7" wrap="virtual"> ... </textarea>

If using this method, select “Text Formatting: None” or you will end up getting line breaks inserted into your escaped code by Moveable Type.