mjdj55 / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

prettify doesn't work with angle brackets #302

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi everyone.
I'm trying to use prettify on my Blogger blog.
It works with normal code, but it doesn't work when I paste html code (or code 
with angle brackets in it).
What I do in my post html is:

<pre class="prettyprint lang-scm"><security:access-denied-handler 
error-page="/accessdenied></pre>

It simply doesn't print anything, except the prettify border.
If I want to print those html tags, I have to write this instead:

<pre class="prettyprint lang-scm">&lt;security:access-denied-handler 
error-page="/accessdenied"&gt;</pre>

And this is really annoying.

I'm using this script in my template <head>:
<script defer='defer' 
src='https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?auto
load=true&amp;skin=default&amp;lang=css'/>

My browser is Firefox (22.0).

What should I do?

Original issue reported on code.google.com by 24alsecondo on 1 Aug 2013 at 8:03

GoogleCodeExporter commented 8 years ago
That is because the code is getting seen as HTML elements it's not displayed 
because the browser will render it as part of the DOM. The only way to get 
around this is to HTML encode the content before showing it.

Original comment by lankym...@gmail.com on 11 Mar 2015 at 2:57