Posting Source Code on


Posting source code to is simply a matter of wrapping your code between tags that specify (among other things) the language you are using. For example:


The above code is displayed like this when your post is previewed or published:

your code here

The supported languages are:

actionscript3 bash clojure coldfusion
cpp csharp css delphi
erlang fsharp diff groovy
html javascript java javafx
matlab (keywords only) objc perl php
text powershell python r
ruby scala sql vb

If a language is not specified the default is language is text (i.e. no syntax highlighting).

Some additional optional shortcodes are also supported and should be placed in the opening [code] tag (with a space between each one). Here are some examples of the ones that I have found most useful:

  • firstline (number) — Use this to change what the line numbering starts at. It defaults to 1. For example: firstline="3"
your code here
  • gutter (true/false) — If false, the line numbering on the left side will be hidden. Defaults to true. For example: gutter="false"
your code here
  • highlight (comma-seperated list of numbers) — You can list the line numbers you want to be highlighted. For example: highlight="1".
your code here

The following shortcodes are also supported:

  • autolinks (true/false) — Makes all URLs in your posted code clickable. Defaults to true.
  • collapse (true/false) — If true, the code box will be collapsed when the page loads, requiring the visitor to click to expand it. Good for large code posts. Defaults to false.
  • htmlscript (true/false) — If true, any HTML/XML in your code will be highlighted. This is useful when you are mixing code into HTML, such as PHP inside of HTML. Defaults to false and will only work with certain code languages.
  • light (true/false) — If true, the gutter (line numbering) and toolbar (see below) will be hidden. This is helpful when posting only one or two lines of code. Defaults to false.
  • padlinenumbers (true/false/integer) — Allows you to control the line number padding. true will result in automatic padding, false will result in no padding, and entering a number will force a specific amount of padding.
  • title (string) — Set a label for your code block. Can be useful when combined with the collapse parameter.



Leave a Reply

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

You are commenting using your 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