默认情况下prettyprint会自动会对PRE样式渲染,如本人在网页http://www.pnpon.com/article/detail-272.html中写的代码,会有如下效果:
但如果网页内容动态加载了,只需要一步即可:
$("#RemoteContent").html(json.ArticleDetailContentHtml);
$("pre").addClass("prettyprint linenums");
prettyPrint();