Archive for category Tips & Trik
WordPress Posting Source Code with Line Number
Posted by roqeem in Tips & Trik on January 20, 2012
While WordPress.com doesn’t allow you to use potentially dangerous code on your blog, there is a way to post source code for viewing. We have created a shortcode you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages, like so:
html{height:100%;}
body{font-size:11px; margin:0; padding:0; height:100%; }
#container{width:100%; margin:0px auto; height:100%; clear:both}
To accomplish the above, just wrap your code in these tags:
[sourcecode language=”css”]
your code here
[/sourcecode]
The language parameter controls how the code is syntax highlighted. The following languages are supported:
- 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
- xml
Source: http://en.support.wordpress.com