prettyprint换行、添加行号、预处理需要高亮显示的代码

需要的文件有:jquery,prettify 需要编写wordpress插件,其主要的代码如下: function prettyCode($text){ // pretty codea // 1 2 3 4 5 // (<(pre|code)[\W]?class="prettyprint(.*?)>)(.*?)(<\/(pre|code)>) $pattern = '/(<(pre|code)[\W]?class="prettyprint(.*?)>)(.*?)(<\/(pre|code)>)/s'; if(preg_match_all($pattern,$text,$out,PREG_PATTERN_ORDER)){ for($i=0; $i<count($out[0]); $i++){ $match_old=$out[4][$i]; $match_content=str_replace("<","<",$match_old); $text=str_replace($match_old, $match_content, $text); } $text.=' <...  more