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.
HTML code in pre and xmp tags renders
-
24-09-2022 - |
Domanda
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
Soluzione 2
Altri suggerimenti
You have to use HTML-Entities.
e.g.
<b>HEllo</b>
gets displayed as <b>HEllo</b>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow