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 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:
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! 🙂