ali

How do I post source code to my blog?

In Uncategorized on October 23, 2009 at 2:14 pm

I found the “code” support page to be quite unhelpful. Nowhere on the page does it actually list the shortcode for posting source code!

Here’s what I do:

  1. Write the source code in Notepad++
  2. Switch from Visual Editor to HTML.
  3. Enter opening and closing …
  4. Make sure there is a newline afterward, otherwise the rest of the post will switch to Preformatted style.
  5. Copy and paste into WordPress.
  6. Switch back to Visual Editor.
/* Ampersand test: & &*/
/* The first should be a literal ampersand, and second the HTML entity. */
#button {
        font-weight: bold;
        border: 2px solid #fff;
}

Tada! HTML escapes seem to work!

Advertisements
%d bloggers like this: