Post ruby or html, css, sql sourcecode in your wordpress.com blog

June 26, 2009 at 6:54 pm 5 comments

To correctly post Ruby (or HTML, CSS, SQL, etc.) source code you should use the following tags, and not the useless <code> tag. This way you don’t need to escape the HTML tags, the code will be highlighted and numbered.

I found out about this just now, so posting it for anyone who might get into the same trouble.

[sourcecode language=’ruby’]
5.times do
something
end
[/sourcecode]

This will show up like this:

5.times do
 something
end

I do not see any way to add a shortcut to this on the “Edit/Create Post”, so it’s not as comfortable as it could be, but still much better than using an external converter.

You can use one of the following params for the language attribute:
bash
cpp
csharp
css
delphi
html
java
jscript
php
python
ruby
shell
sql
vb
xml

More info here

Advertisements

Entry filed under: Uncategorized. Tags: .

Acts_as_versioned tutorial Acts_as_versioned delete a specific version

5 Comments Add your own

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Recent posts

Starting to learn Rails?

Kindle

Get Kindle - the best e-book reader, that I personally use, and the only one that you can read on the beach - very useful: Kindle Wireless Reading Device (6" Display, Global Wireless, Latest Generation)

%d bloggers like this: