Highlight your code here on WordPress.com

I’ve seen people posting code here on WordPress.com, yet without the code being highlighted. It’s incredibly helpful to have the code higlighted though, it distinguishes it from other content.

Fortunately, WordPress.com has made it very easy to highlight code, just surround the code with Wordpress.com - code shortcode shortcodes. Here’s a quick walkthrough:

A quick example

As an example, if you have some Visual Basic code to post, you could add it like so:

Wordpress.com - code highlighting

And WordPress will render it like this:

Function getColor(ByVal number As Integer) As String
   Dim result As String
   If (number = 1) Then
       result = "red";
   Else
       result = "green";
   End If
   return result
End Function

The shortcode supports all the popular programming languages too. Here are the official details about it: https://en.support.wordpress.com/code/posting-source-code/

I hope more people will use it, makes it much easier for readers to see what’s going on, plus it looks real pertty! 🙂

Advertisements
Highlight your code here on WordPress.com

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