Search code examples
jqueryhtmlgoogle-code-prettify

HTML code in pre and xmp tags renders


I'm trying to display some HTML code in <pre> and <xmp> tags, but instead of just showing the code, this HTML code actually renders. Also I'm using Google Prettify to highlight the syntax.

<pre class="prettyprint code"></pre>

javascript

$(".code").html("<xmp>"+data+"</xmp>");
$('.prettyprinted').removeClass('prettyprinted');

prettyPrint();

So when I try to display <b>HEllo</b> I get Hello


Solution

  • I solved this problem. I made class="tag" somewhere in my css, and apperently google prettify use same class name (.tag) to mark the html tags, so after I changed the name of my class to another name, everything was ok.