How do I post source code by wordpress.com?


We have a shortcode you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages, like so:

Wrap your code in these tags: [sourcecode language='css']..[/sourcecode]

Do not copy and paste this code – write it out. You can replace the language with one of the following language codes:

  • cpp
  • csharp
  • css
  • delphi
  • html
  • java
  • jscript
  • php
  • python
  • ruby
  • sql
  • vb
  • xml

The language attribute is required! If we don’t have what you need pick the closest.
Code in between the [sourcecode] tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

We used the syntaxhighlighter Google Code project by Alex Gorbatchev to implement this feature.

source here

About these ads

5 responses to this post.

  1. thanks for God : )

    Reply

  2. Posted by yogalifestyle on August 29, 2008 at 10:34 pm

    this doesn’t help. Where do I post it? What is that first window, I’ve never seen it before?

    Reply

  3. I will try that.

    Reply

  4. I ok I understand some of the verbage, such as jscript, where is the meta and beginning and ending? I also don’t know where you paste this. Do you paste it on line #1. Our lines aren’t numbered that I can see when we are doing a post! Maybe some description on these words would be helpful for newbies like myself. I appreciate all you are doing. Thanks so much. I know that it is a start. Your awesome. Thanks.
    Mona

    Reply

  5. Posted by sumitasok on December 5, 2009 at 7:55 am

    Thanks buddy…i was working without this until today, wondering how to do this…now i got my answer…

    Reply

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 108 other followers

%d bloggers like this: