Code Markup problem with WordPress

Posted by Mike Lopez under Mike's Blog
Feb 2006
10
08:21am


I am a programmer and I know for sure that I will be needing to post some HTML code in this site to show people my ideas and solutions to some coding problems. The big problem though is that WordPress automatically converts < and > tags to their true HTML equivalents so that if I type:

mike

it will be rendered by WordPress as

mike

and that’s not the effect that I want. There are times when I want the HTML to be displayed as-is. Actually, this problem was brought up to me by Benj and so he googled around for plugins and found these:

The latter also provides links for syntax highlighting which I think is cool so I went with it.

Syntax Hilighting Bug Fix

If like me, you installed Scott Yang’s syntax highlighting plugin and you notice that it doesn’t hilight code other than PHP then edit the file syntax_hilight.php and change the line that says:

$argv = "enscript -q -p - --highlight=$lang --language=html --color";

to

$argv = "enscript -q -p - --pretty-print=$lang --language=html --color";

That fixes the bug for me.

Tip for Multiline code

For multiline code snippets, you need to enter a literal <br /> at the end of each line. If you’re using the wysiwyg editor to enter your code, hit Shift+Enter instead of just Enter.



Leave a Reply