Home » » Cara Paling Mudah Membuat Syntax Highlighter di Blog

Cara Paling Mudah Membuat Syntax Highlighter di Blog

Syntax Highlighter merupakan fitur dari text editor, khususnya editor untuk kode, html, php atau bahasa program lainnya sehingga berbeda dengan tulisan lain di sekitarnya. Fungsinya untuk memudahkan programmer dalam membaca dan menganalisa source code tersebut. Oke Mungkin sebagian sudah tau Apa manfaat dari syntax highlighter namun sedikit saya jelaskan cara kerja dari syntax highlighter . Syntax highlighter berkerja akan melakukan Konvert tag kedalam bentuk entitas hingga dapat ditampilkan ke browser tanpa dieksekusi sebagai bahasa pemograman .Harap maaf bila pernyataan dari kesimpulan saya ngawur,,,maklum saya bukan ahlinya he he.... Jika sobat ingin memasang pada blog sobat, silahkan ikuti tutorialnya dibawah ini
  • Masuk ke akun Blogger Anda.
  • Klik Rancangan.=>Edit HTML.
  • Beri tanda centang pada Expand Template Widget.
  • Klik Download Template Lengkap, untuk berjaga-jaga kalau nanti terjadi kesalahan dalam mengedit template.
  • Cari kode </head> dan copy kode dibawah ini di atasnya.
<!-- Add-in CSS for syntax highlighting -->
<link href='http://alexgorbatchev.com/pub/sh/2.1.364/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/2.1.364/styles/shThemeRDark.css' rel='stylesheet' type='text/css'/>
<!-- Add-in Script for syntax highlighting -->
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shCore.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushAS3.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushBash.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushCSharp.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushColdFusion.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushCpp.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushCss.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushDiff.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushErlang.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushGroovy.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushJScript.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushJava.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushJavaFX.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushPerl.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushPhp.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushPlain.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushPowerShell.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushPython.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushRuby.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushScala.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushSql.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushVb.js' type='text/javascript'></script>
<script src='http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushXml.js' type='text/javascript'></script>
<script language='javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>
<!-- End code hilight -->
  • Lalu Save template.

Tiap kamu mau nulis script, kamu harus masukin kode di post kamu, klik tab "Edit HTML" dari editor posting kamu dan tulis kode berikut:

Untuk kode CSS:
<pre class="brush: css">
Letakkan Kode CSS Disini
</pre>

Untuk kode HTML:
<pre class="brush: html">
Letakkan Kode HTML Disini
</pre>

Untuk Kode JS:
<pre class="brush: Java">
Letakkan Kode Javascript Disini
</pre>


Semoga bermanfaat
Bagikan ke:

+ komentar + 2 komentar

31 Juli 2012 pukul 10.19

rada kurang ngerti.... tapi kl belajar pasti bisa......

17 November 2012 pukul 09.59

klo terus belajar insya Alloh...bisa

Posting Komentar

 
Copyright © 2011 - 2012. Agoengsang - All Rights Reserved Sitemap · Privacy Policy · Pasang Iklan Proudly Powered by Blogger