Prettify代码高亮

Prettify代码高亮所需css(放网站head中)<style type=text/css>.prettyprint,pre.prettyprint{white-space:pre-wrap;word-wrap:break-word;background-color:#444;border:1px solid #272822;overflow:hidden;padding:0;margin:20px 0;font-family:Consolas,"Bitstream Vera Sans Mono","Courier New",Courier,monospace!important;color:#666}.prettyprint.linenums,pre.prettyprint.linenums{-webkit-box-shadow:inset 40px 0 0 #39382e,inset 41px 0 0 #464741;-moz-box-shadow:inset 40px 0 0 #39382e,inset 41px 0 0 #464741;box-shadow:inset 40px 0 0 #39382e,inset 41px 0 0 #464741}.prettyprint.linenums ol,pre.prettyprint.linenums ol{margin:0 0 0 33px;padding:5px 10px}.prettyprint.linenums ol li,pre.prettyprint.linenums ol li{color:#bebec5;line-height:20px;margin-left:0;list-style:decimal}.prettyprint ol.linenums{margin-bottom:0;background-color:#272822}.prettyprint .com{color:#93a1a1}.prettyprint .lit{color:#ae81ff}.prettyprint .clo,.prettyprint .opn,.prettyprint .pun{color:#f8f8f2}.prettyprint .fun{color:#dc322f}.prettyprint .atv,.prettyprint .str{color:#e6db74}.prettyprint .kwd,.prettyprint .tag{color:#f92659}.prettyprint .atn,.prettyprint .dec,.prettyprint .typ,.prettyprint .var{color:#a6e22e}.prettyprint .pln{color:#66d9ef} </style>或单独写在css文件中,本站引用<link rel="stylesheet" type="text/css" href="/zb_users/plugin/FY_Prettify/prettify.css" />上述css本主题下代码上下有20px留白,遂可将上述margin:20px 0改为0px本站引用的js<script src=/zb_users/plugin/FY_Prettify/prettify.js type=text/javascript></script>调用/*初始化prettyPrint 这里我直接置于本站prettify.js末尾的*/$(window).on('load',function(){ jQuery("pre").addClass("prettyprint"); prettyPrint();})jQuery("pre").attr("class","fy-prettyprint linenums");