[ana sayfa] [hakkımda] [arşiv] [iletişim]
Kod Renklendirici etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
Kod Renklendirici etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

11 Blogger Syntax Highlighter Entegresi (Kod Renklendirici)

Bloggerda kodlarınızın kod editörlerdeki gibi renkli bir şekilde görünmesini istiyorsanız Syntax Highlighter'ı blogunuza entegre etmelisiniz...Bunun için blogunuzun Yerleşim > HTML'yi düzenle kısmından <head> tagını bulun hemen ardından şu kodları ekleyin:

<script src='http://shjs.sourceforge.net/sh_main.js' type='text/javascript'/>
<script src='http://shjs.sourceforge.net/lang/sh_cpp.js' type='text/javascript'/>
<script src='http://shjs.sourceforge.net/lang/sh_php.js' type='text/javascript'/>
<script src='http://shjs.sourceforge.net/lang/sh_javascript.js' type='text/javascript'/>
<script src='http://shjs.sourceforge.net/lang/sh_sql.js' type='text/javascript'/>
<script src='http://shjs.sourceforge.net/lang/sh_css.js' type='text/javascript'/>

Ben yukarıdaki dilleri entegre ettim eğer sizin tercihiniz farklıysa burada diğer dil dosyalarına ulaşabilirsiniz: http://shjs.sourceforge.net/lang/

Şimdi sıra css'yi eklemeye geldi bunun için kodlar arasından ]]></b:skin> kodunu bulun ve hemen üstüne şu css kodlarını yapıştırın:


pre.sh_sourceCode {
background-color: #eeeeee;
color: #000000;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_keyword {
color: #bb7977;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_type {
color: #8080c0;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_string {
color: #a68500;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_regexp {
color: #a68500;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_specialchar {
color: #ff00ff;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_comment {
color: #ff8000;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_number {
color: #800080;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_preproc {
color: #0080c0;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_symbol {
color: #ff0080;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_function {
color: #004466;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_cbracket {
color: #ff0080;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_url {
color: #a68500;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_date {
color: #bb7977;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_time {
color: #bb7977;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_file {
color: #bb7977;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_ip {
color: #a68500;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_name {
color: #a68500;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_variable {
color: #0080c0;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_oldfile {
color: #ff00ff;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_newfile {
color: #a68500;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_difflines {
color: #bb7977;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_selector {
color: #0080c0;
font-weight: normal;
font-style: normal;
}

pre.sh_sourceCode .sh_property {
color: #bb7977;
font-weight: bold;
font-style: normal;
}

pre.sh_sourceCode .sh_value {
color: #a68500;
font-weight: normal;
font-style: normal;
}


Son olarak <body> tagını <body onload="sh_highlightDocument();"> ile değiştirin.

Yazınıza örneğin php kodu eklerken şu şekilde ekleyin:

<pre class="sh_php">KODLAR</pre>

Diğer dil etiketleri için aşağıdaki tablodan yararlanabilirsiniz:

Language HTML class
Bison sh_bison
C sh_c
C++ sh_cpp
C# sh_csharp
ChangeLog sh_changelog
CSS sh_css
Desktop files sh_desktop
Diff sh_diff
Flex sh_flex
GLSL sh_glsl
Haxe sh_haxe
HTML sh_html
Java sh_java
Java properties files sh_properties
JavaScript sh_javascript
JavaScript with DOM sh_javascript_dom
LaTeX sh_latex
LDAP files sh_ldap
Log files sh_log
LSM (Linux Software Map) files sh_lsm
M4 sh_m4
Makefile sh_makefile
Objective Caml sh_caml
Oracle SQL sh_oracle
Pascal sh_pascal
Perl sh_perl
PHP sh_php
Prolog sh_prolog
Python sh_python
RPM spec files sh_spec
Ruby sh_ruby
S-Lang sh_slang
Scala sh_scala
Shell sh_sh
SQL sh_sql
Standard ML sh_sml
Tcl sh_tcl
XML sh_xml
Xorg configuration files sh_xorg

Yardımını esirgemediği için BLaSTER kardeşime teşekkürler ;)