使用方法:第一步,引入prettify.js和prettify.css
<link href="prettify.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="prettify.js"></script>
第二步,在body的onload事件里添加函数”prettyPrint()”
<body onload="prettyPrint()">
第三步,pre标签添加CSS类“prettyprint linenums”
<pre class="prettyprint linenums">代码</pre>
或者
<code class="prettyprint">代码</code>
{dm}pre.prettyprint{padding:4px;background:#1917177a;font-family:"web-font",Menlo,Monaco,monospace;}{/dm}