Press "Enter" to skip to content

Highlighting source code in posts

In an earlier post I had mentioned that I didn't know how to highlight source code in blog posts (syntax highlighting) or even offset code with a monospace font/typeface. Apparently, this is a feature of WordPress.com that I didn't know about, and is available as a plugin called SyntaxHighlighter Evolved for WordPress.org. I installed it, and it seems to do what I want. It supports a variety of languages, but not all that I use (for instance R is supported but not SAS). I'll keep my eyes open for a different plugin, but this works for now.

Of course, if one doesn't want or care about the syntax highlighting, then <pre> and <code> tags should suffice. A useful post from StackOverflow concerning some subtleties of the tags is here.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *