Jumat, 13 Maret 2015

Cara Memasang Syntax Highlighter Di Blogger


Langsung saja saya praktekkan :

  1. Buka Dasboard > Template > Edit HTML
  2. Tekan Ctrl + F dan ketikkan ke kotak pencarian </b:skin>
  3. Lalu tekan Enter
  4. Copy script di bawah ini dan Paste di bawah  </b:skin>

  5. <link href='http://alexgorbatchev.com/pub/sh/2.1.382/styles/shCore.css' rel='stylesheet' type='text/css'/> 
    <link href='http://alexgorbatchev.com/pub/sh/2.1.382/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shCore.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushCpp.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushCSharp.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushCss.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shYouBrushJava.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushJScript.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushPhp.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushPython.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushRuby.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushSql.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushVb.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushXml.js' type='text/javascript'/> 
    <script src='http://alexgorbatchev.com/pub/sh/2.1.382/scripts/shBrushPerl.js' type='text/javascript'/> 
    <script language='javascript'> 
    SyntaxHighlighter.config.bloggerMode = true; 
    SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/2.1.382/scripts/clipboard.swf&#39;; 
    SyntaxHighlighter.all(); 
    </script>
    

  6. Save template.
Cara Penggunaan :

  1. Untuk menampilkan nya, bisa dengan menambahkan tag <pre> atau tag <code>.
    contoh penulisan dengan tag <pre> :

    <pre class="brush:css, brush:html, brush:js, brush:php, brush:sql, brush:python">
    Kode Di Sini
    </pre>
  2. Pada contoh di atas, kita lihat nantinya jenis-jenis kode yang akan di highlight adalah gabungan antara CSS, JS, PHP, SQL, dan Phyton. Jika anda hanya membutuhkan beberapa jenis saja, sekiranya yang diperlukan, maka gunakan brush sesuai jenis script saja. Misalnya, jika saya hanya butuh highlight HTML, JS, dan CSS, maka yang dibutuhkan adalah:
    <pre class="brush:css, brush:html, brush:js">
    Kode Di Sini
    </pre>
  3. Sebelum memposting code parse dulu code disini http://www.blogcrowds.com/resources/parse_html.php
Disqus Comments