Posting source code in WordPress

OK, well I’m sure this is documented hundreds of other places, but I am mainly putting it here for my reference.  If you want to post source code on a WordPress blog, surround your code with the following tags (making sure to replace lang with the supported language code:

It will give you syntax highlighting and a few quick shortcuts so you can copy and paste code.  The languages supported in the language attribute are:
  • cpp
  • csharp
  • css
  • delphi
  • html
  • java
  • jscript
  • php
  • python
  • ruby
  • sql
  • vb
  • xml
  • 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

    %d bloggers like this: