Home > .Of Interest > Including formatted sourcecode in WordPress

Including formatted sourcecode in WordPress

The Wiert Corner - irregular stream of stuff

Since I’m quite new to WordPress it is a learn as-I-go process (sounds familiar huh?) and a major goal of this blog is to keep track of things so that I don’t forget them:

Including formatted code in your blog is easy, WordPress has a FAQ about it!
Basically it comes down to adding the sourcecode shortcode and then make sure the language attribute has the right value.

But there are some gotcha’s that are not in the FAQ:

  1. paste the sourcecode shortcode as “plain text” (or in the HTML editor) otherwise it will get span tags around it and not render as code
  2. C# has language code csharp (if you use a non-existing language code, it will not render as code either)

The language codes I will probably use most are csharp and delphi, followed by xml and sql and maybe some css and html.

In your editor…

View original post 61 more words

Categories: .Of Interest
  1. No comments yet.
  1. No trackbacks yet.

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 )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: