Cara Menambahkan Syntax Highlighter pada Blogger







Jika kalian seorang programmer atau developer pasti tau kan yang namanya SyntaxHighlighter , yap SyntaxHilighter ini berfungsi untuk menyoroti kode agar dapat membedakan kodingan kita dengan mudah. Kalau kalian membuat blog dengan wordpress sudah banyak sekali plugin yang menyediakan SyntaxHiglighter ini dan penggunaanya pun sangat mudah, tapi kalian pasti bertanya-tanya gimana cara menambahkan SyntaxHighlighter di blogger ? maka dari itu gw disini akan membahas cara memasang syntaxhighlighter pada postingan di blogger / blogspot. Langsung saja nih lagkah-langkahnya

1. Masuk ke blogger > Edit HTML

2. Letakkan kode berikut diatas tag <head></head>

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

3. Cara menggunanakanya kalian harus ubah dulu mode tulisanya dari Compose menjadi HTML, Copy saja code dibawah ini dan paste, lalu ganti tulisan //Your Code dengan script kalian.

<pre class="brush: csharp">
           //Your Code
</pre>

Contoh hasil nya

Komentar

Postingan populer dari blog ini

Menggunakan Library Scanner di Java

Menghilangkan objek di Foto dengan Mudah dengan Inpaint

Cara Mudah dan Asik Menghafal Tabel Periodik Unsur Kimia