首页 > 代码库 > 解决在用google-code-prettify高亮博客的代码,但是行号怎么也无法显示

解决在用google-code-prettify高亮博客的代码,但是行号怎么也无法显示

在网上查了一下,有一个不太完美的解决办法,就是加入如下代码:
<style>
li.L0, li.L1, li.L2, li.L3, li.L5, li.L6, li.L7, li.L8 {
 list-style-type: decimal !important
}
</style>

然后再将你需要显示的代码里面的<br/>换成回车即可,这样就可以显示出来行号了。
 <pre class="prettyprint pre-scrollable linenums">
   &lt;div class=&quot;span4&quot;&gt;
        &lt;h2 class=&quot;page-header&quot;&gt;区块1&lt;/h2&gt;
            &lt;/div&gt;
         &lt;div class=&quot;span4&quot;&gt;
     &lt;h2 class=&quot;page-header&quot;&gt;区块2&lt;/h2&gt;
 &lt;/div&gt;</pre>

效果如下:

解决在用google-code-prettify高亮博客的代码,但是行号怎么也无法显示