Posting Source Code to WordPress.com

The other day I tried to blog about the vte.terminal, and I had huge problems posting the source code. My problem was that despite how much I searched, and everything I tried, I could not keep the formatting and post the source code. The formatting was wrong when I used the <code> tags (The spaces where removed and in python that’s important).

It turns out that this was the most correct with the exception that befor you make your post you must go to Users then Your Profile and make sure “Use the visual rich editor when writing”
is unselected instead of


you are going to want to have

#This
#is an example
#of what your source code will look like
x = True
if x:
    print 'hello world'

The source for this post can be found here.

9 Responses to Posting Source Code to WordPress.com

  1. H3g3m0n says:

    WordPress still causes massive headaches for me when posting sourcecode, for instance:

    No matter what I do it converts < to <, its doesn’t do it for #include though. code tags do the same thing.

    Also it tends to convert quote marks from ASCII to UNICODE which most compilers/interpreters have problems with. I posted about here: http://en.forums.wordpress.com/topic.php?id=15761&amp; although now it doesn’t seem to be a problem anymore.

    I’m going to look at using vim’s :TOhtml function and converting the result into something I can paste in.

  2. earobinson says:

    hey sorry to here it did not work for you :(

  3. farz says:

    doesnt work well at all
    plugins resort :(

  4. earobinson says:

    Thats to bad :( works great for me :)

  5. […] Cleaning out some cruft October 6th, 2007 — jronnholm Yay, I finally found out how to display code properly in wordpress https://earobinson.wordpress.com/2007/09/12/posting-source-code-to-wordpresscom/ […]

  6. afteflyclew says:

    Good day!,

    I’m a noob here. And it feels like an awesome forum.

    I just wanted to give a nice hello to all of you here.

    :)

    -Felix

  7. xztheericzx says:

    i’m eric. joining a couple boards and looking
    forward to participating. hehe unless i get
    too distracted!

    eric

  8. DaphapporsDig says:

    Hello
    I’ve just registered at the forum. This is my first message.
    Please don’t become angry about me.
    Thank you.

%d bloggers like this: