+3  A: 

You still need to take special characters into account &lt ; and &gt ;

<pre><code class="html">&gt;a href=......... &lt;
Robert Greiner
Thanks for the tip!
JAG2007
+1  A: 

For the code within the <pre> tags, do a global search and replace of "<" with "&lt;".

Paul Tomblin
+1  A: 

That's because the code and pre tags don't work that way. Change your '<' to '&lt;' and the '>' to '&gt;' and it will work as you want it too.

Malfist
+2  A: 

The <pre></pre> tag pair doesn't change how the contents in them are parsed by the browser (ie, as HTML with tags the browser needs to parse). Rather, it just tells the browser that the contents inside the pair as unformatted and should be presented to the user as such.

What you need to do is escape the HTML (ie, "<" to "&lt;", etc), so the browser knows it should display the raw characters.

RHSeeger
+5  A: 

"Code" means "This is marked up code"

"Pre" means "This data has been preformatted" (as far as whitespace is concerned)

Neither of them mean "This data shouldn't be treated as HTML"

Represent & as &amp;, < as &lt; and > as &gt;.

David Dorward
Awesome - thanks, great answer!!
JAG2007