2015-03-02 88 views
0

我想使用google-code-prettify來突出顯示某些代碼的語法,但瀏覽器正在渲染包含在標記中的HTML。我遵循了入門指南谷歌代碼美化與HTML衝突

例如,

<pre class="prettyprint"> 
     <head> 
      <link href="stylesheet.css" rel="stylesheet"> 
     </head> 
     <body> 
      <div id="divId"> 
     <h1 class="h1Class">Hello world</h1> 
      </div> 
     </body> 
    </pre> 

    <script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script> 

在這裏,我得到的只是Hello world。我試過在class="prettyprint之後加lang-html,沒有工作。

我錯過了什麼?

+0

@mason固定和編輯,但仍無法正常工作與&lt;

>更換

<。是的,這是代碼 – propster 2015-03-02 19:50:05

回答