0

So I am using the google code prettifier: http://code.google.com/p/google-code-prettify/

It does something similar to what stack overflow does here where when you write a block of code it beautifies it and adds syntax highlighting.

The problem I am haveing is if I write code like this

 <pre class="prettyprint">
   <div class="specialForm">
   ...
 </div>
 </pre>

instead of rendering the text just as stack overflow does, it actually renders the DIV on the page and I have no clue what I am doing wrong

Adim
  • 811
  • 2
  • 10
  • 25
  • 1
    You need to escape the html like `<div class="specialForm">...` You can inspect your very post with Web Inspector and see that. – Esailija Jan 18 '12 at 00:27

1 Answers1

2

If you look at the source here in stackoverflow, your post is actually:

&lt;pre class="prettyprint"&gt;
   &lt;div class="specialForm"&gt;
   ...
 &lt;/div&gt;
 &lt;/pre&gt;

This prevents the browser from treating them as html syntax and it prints literal <,> etc.

Esailija
  • 138,174
  • 23
  • 272
  • 326