# How do you highlight code in a <pre> block?

Is there a way to highlight code syntax in a <pre> block?

In this post, I had originally inserted my code using a <pre> block, but the code was not highlighted. After indenting every line by four characters the highlighting worked. I would include an example here, but I couldn't get highlighting to work on Code Review Meta.

The highlighting will work if you use <pre><code> instead of just <pre>.

However it is preferred that you use the regular markdown syntax for code samples (i.e. indent by four spaces). There's a button in the formatting toolbar (the one with the {}) as well as a keyboard shortcut (ctrl+k) to do this for you, so you don't need to indent every line by hand.