ohmkara 1.0

a technical blog.

wordpress editor — posting tabs, spaces and code

leave a comment »

Posting Formatted Text

I may be posting lots of code / scripts in this blog. But when I posted a script yesterday, wordpress removed all the indentation tabs. Which is the last thing that I (or anybody who reads it) wants, a flattened script…. After about an hour of searching I found the solution for keeping the indentation tabs and leading white spaces here. (I must confess that prior to finding the solution I was thinking of going back to good old blogger — what is the use of an unintended script) This is how I posted the script (HTML of relevant section)

<pre style=”font:inherit;”>

Intended / Foratted Script



Posting Code

If in particular, you are interested in posting code, there is a better way as mentioned here…. a much better way (but the sad part is bash, perl etc. is not supported by default but you can choose any supported program type, it will display anyways)… this is how a script will look — pretty neat heeh…. but I wonder why others posting scripts are not using this (I tried to see how others are doing it on wordpress when my script was getting ‘de-spaced’).

This is what you do

Wrap your code in these tags:

[sourcecode language=’python’]

your script


And this is how it looks….

# a demo script
        echo "hello, world"     #see the tab / format maintained

Written by deepak

January 13, 2009 at 11:43 am

Posted in my notes

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: