[筆記] 用 Google Code Prettify 顯示程式碼

丹麥首都-哥本哈根的街景。

為了方便記錄, 今天來研究如何在Blogger上顯示程式碼區塊。

使用「新增小工具」的功能,是不錯的方法,盡量比面跟範本的程式碼混雜在一起,事後修改更方便,參考使用方法--> https://pjchender.blogspot.tw/2015/03/blogger.html

這裡詳細介紹使用法--> https://github.com/google/code-prettify/blob/master/docs/getting_started.md

懶人模式-直接套用喜歡的樣板--> https://cdn.rawgit.com/google/code-prettify/master/styles/index.html

單行有行數寫法:
<pre class="prettyprint lang-scm">(friends 'of '(parentheses))</pre>
多行有行數寫法:
  1. <pre class="prettyprint linenums">
  2. Many
  3. lines
  4. of
  5. code
  6. Test1
  7. Test2
  8. Test3
  9. </pre>
指定行數寫法
  1. <pre class="prettyprint linenums:40">lots of code</pre>