blogspot代码框、代码高亮
参考1:https://github.com/google/code-prettify/blob/master/docs/getting_started.md
参考2:https://github.com/google/code-prettify
//编辑网页模板-html,插入以下代码
参考2:https://github.com/google/code-prettify
//编辑网页模板-html,插入以下代码
<script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&skin=sunburst&lang=css" defer="defer"></script>
//如何启用
<pre class="prettyprint linenums">
code
code
</pre>
//显示每一行的行号
<style>
li.L0, li.L1, li.L2, li.L3,
li.L5, li.L6, li.L7, li.L8
{ list-style-type: decimal !important }
</style>
(function(){
var scripttags = document.getElementsByTagName('script')
, i, l
, s, d
for (i = 0, l = scripttags.length; i !== l; i++){
if (scripttags[i].type === 'text/x-markdown') {
s = scripttags[i]
d = document.createElement('div')
d.innerHTML = (new Markdown.Converter()).makeHtml(s.innerHTML)
s.parentNode.insertBefore(d, s)
}
}
})()
评论
发表评论