blogging-platforms Comments 2 min read
Edit: I have left blogger, wordpress for my tech blog and moved to github pages as communicated here. This post was written when I was trying to decide between blogger and wordpress.

#!/usr/bin/perl
use strict;
use warnings;
print "Because you cannot install plugins on wordpress.com blogs";
print "Which means I cannot install this cool plugin which";
print "lets me indent and syntax highlight my Perl code\n";
exit(0);

Wordpress.com has the <code> tag - which for the average programmer means that I can use this tag to copy paste my code on the blog and it will show up all nice and indented. But from the usage, code tag just "encodes" HTML i.e. you don't need to escape < tag in #include <stdio.h>

The code tag doesn't indent. It doesn't highlight. It just converts the text to code font. The forums tell you to post your code in pre tags. Pre tags work but not always. As per Shuvam's comment below - the quirk might be with the specific template I am working with. So I created a test page on wordpress -

Test page to check code layout on wordpress.com

and tried it out with a 10-15 initial templates. None of them did the trick. I am not going to try out the 100+ templates that they offer and neither would I compromise on the rest of the layout just because some theme shows the pre tags cleanly.

If you are thinking blockquote - that converts my text to italics, doesn't indent and I sure wouldn't want my code to be displayed in italics.

And for the ones who are thinking - why don't you search a code snippet plugin and install it? - I can't. Wordpress.com won't let me. You cannot install plugins on wordpress.com blogs because of security reasons. If you want to install plugins and I am sure there are plenty of good ones available - use wordpress.org. For which you need someone to host your site for you. And I don't want to do that.

To know the complete difference between hosting on wordpress.com and wordpress.org - read this

There is a plugin Syntax Highlighter which does the above magic, the only limitation being that it currently does not support Perl.

But there is a fix for that also. This post by Damien made me jump back to blogspot. Goes to show how important it is to share your findings with others.

Blogspot does not give as many themes as wordpress.com but at least I can choose the one I want and use the SyntaxHighlighter plugin with it.

Sad. I was hoping to play more on wordpress. But I am going to paste inline code in my future posts and I can't stand intentionally unindented code.

Share this post

Comments