blogspot代码框、代码高亮

参考1:https://github.com/google/code-prettify/blob/master/docs/getting_started.md
参考2:https://github.com/google/code-prettify

//编辑网页模板-html,插入以下代码
  1. <script src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js?autoload=true&amp;skin=sunburst&amp;lang=css" defer="defer"></script>
  2.  
  3. //如何启用
  4. <pre class="prettyprint linenums">
  5. code
  6. code
  7. </pre>
  8.  
  9. //显示每一行的行号
  10. <style>
  11. li.L0, li.L1, li.L2, li.L3,
  12. li.L5, li.L6, li.L7, li.L8
  13. { list-style-type: decimal !important }
  14. </style>
  1. (function(){
  2. var scripttags = document.getElementsByTagName('script')
  3. , i, l
  4. , s, d
  5. for (i = 0, l = scripttags.length; i !== l; i++){
  6. if (scripttags[i].type === 'text/x-markdown') {
  7. s = scripttags[i]
  8. d = document.createElement('div')
  9. d.innerHTML = (new Markdown.Converter()).makeHtml(s.innerHTML)
  10. s.parentNode.insertBefore(d, s)
  11. }
  12. }
  13. })()

评论

此博客中的热门博文

Mingw64添加regex库

python3 gdb使用教程