【问题标题】:Prettyprint Highlighter doesnt workPrettyprint荧光笔不起作用
【发布时间】:2013-04-03 10:58:45
【问题描述】:

我想在我的网页上使用 prettyprint,但它不起作用...

我有一个 html sn-p,但浏览器将其解释为真正的 html 代码。

在html头中,我已经实现了

    <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
<link rel="stylesheet" href="${cs.qualify("/css/prettify.css")}" type="text/css" media="screen" />

我的 html 代码插入到这样的 pre 标记中

<pre class="prettyprint"><div id="test"><h2>Hello</h2></div></pre>

我不知道,有什么问题......

有人可以帮帮我吗?!!

谢谢

【问题讨论】:

    标签: html syntax-highlighting pretty-print codehighlighter


    【解决方案1】:

    您需要确保将尖括号转换为 pre 标记中的 HTML 字符实体。例如:

    // This is <div>
    &lt;div&gt;
    
    // This is </div>
    &lt;/div&gt;
    

    【讨论】:

      猜你喜欢
      • 2014-07-09
      • 2020-09-25
      • 1970-01-01
      • 2011-12-04
      • 1970-01-01
      • 2018-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多