Home > Tutorial > Adding Syntaxhighlighter to Blogger
Adding Syntaxhighlighter to Blogger
Posted on Tuesday, December 14, 2010 by android apps market for tablests
Sorry for the lack of updates for the past few days. I have been really tied up with some stuffs, and it will remain like this for the next few days. I'll try to make this one quick and simple. This is a request from a blog reader (RainDropSoup). In this tutorial, I will share with you guys how I added my Syntaxhighlighter. Syntaxhighlighter is an add-on that can be added to Blogger (and other websites). It makes your code snippet looks pretty. Here's an example:
Pretty, ain't it?Usually, Bloggers that post programming codes would want to add this one to their blogs, as it makes everything easier and tidy. You can still use this add-on to post normal texts, if you want your text to stand out from the rest of your contents. There are lots and lots of tutorials out there that teach you how to add it to Blogger. When I first added it, I tried some of these tutorials myself, and not all of them work. So, here's how I added it.
Step 1:
You can skip this step if you're not gonna use SyntaxHighlighter that often.
If you're using the old Blogger interface: Go to Dashboard - Settings - Formatting - Post Template -
If you're using the new Blogger interface: Go to Dashboard - Settings - Posts and comments - Post Template -
Paste the following code - Save Settings:
You can skip this step if you're not gonna use SyntaxHighlighter that often.
If you're using the old Blogger interface: Go to Dashboard - Settings - Formatting - Post Template -
If you're using the new Blogger interface: Go to Dashboard - Settings - Posts and comments - Post Template -
Paste the following code - Save Settings:
<pre class="brush:xml;">
Your code/content goes here.
</pre>
Step 2:
If you're using the old Blogger interface: Go to Dashboard - Design - Edit HTML - Back Up (Download Full Template) -
If you're using the new Blogger interface: Go to Dashboard - Template - Backup/Restore - Download Full Template - Close - Edit HTML - Proceed -
Find for </body> - paste the following code directly above </body>:
If you're using the old Blogger interface: Go to Dashboard - Design - Edit HTML - Back Up (Download Full Template) -
If you're using the new Blogger interface: Go to Dashboard - Template - Backup/Restore - Download Full Template - Close - Edit HTML - Proceed -
Find for </body> - paste the following code directly above </body>:
<!-- SH starts -->Click on Save Template once you're done. As you can see here, I have used the files that are being hosted at the official website. Though at first it might seem like hosting these files at an external site is a good idea, I had to learn the hard way that it is not. I hosted my files at Google Sites previously, back when I was still using the Blogspot domain. It worked fine, until I switched to this custom domain. Things went crazy, and it was hard to find one place that could host all files and still be able to work with blogs with custom domains. So take it from me, use these hosted files instead.
<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/shCoreMDUltra.css' rel='stylesheet' type='text/css'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shLegacy.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushAS3.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushColdFusion.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCss.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushDiff.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushErlang.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushGroovy.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJava.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJavaFX.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPerl.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPlain.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPowerShell.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPython.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushRuby.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushScala.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushVb.js' type='text/javascript'/>
<script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js' type='text/javascript'/>
<script language='javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.defaults['auto-links'] = false;
SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>
<!-- SH ends -->
Step 3
Now go to New Post, and when you click on Edit HTML, you'll be able to post into SyntaxHighlighter directly. You can remove this HTML portion if you don't want to use it. If you've skipped Step 1, paste the following code in Edit HTML mode and start adding your highlighted contents.:
Now go to New Post, and when you click on Edit HTML, you'll be able to post into SyntaxHighlighter directly. You can remove this HTML portion if you don't want to use it. If you've skipped Step 1, paste the following code in Edit HTML mode and start adding your highlighted contents.:
<pre class="brush:xml;">
Your code/content goes here.
</pre>
Customization:
You can customize the current theme and the brush. Changing the theme will change the default text color, background and other things. Changing the brush (I have used XML brush in the steps above) will highlight different set of codes. There are additional customizations that you might want to check out at Alex Gorbatchev's website. Alex is the creator of this useful gadget.
You can customize the current theme and the brush. Changing the theme will change the default text color, background and other things. Changing the brush (I have used XML brush in the steps above) will highlight different set of codes. There are additional customizations that you might want to check out at Alex Gorbatchev's website. Alex is the creator of this useful gadget.
| Themes | shThemeRDark, shThemeMidnight, shThemeMDUltra, shThemeFadeToGrey, shThemeEmacs, shThemeEclipse, shThemeDjango, shThemeDefault, shCoreRDark, shCoreMidnight, shCoreMDUltra, shCoreFadeToGrey, shCoreEmacs, shCoreEclipse, shCoreDjango, shCoreDefault Note: I have used shCoreMDUltra in the tutorial above. To change your theme, simply locate the line that contains the word 'shCoreMDUltra', and replace it with one of the theme names above. Retain the .css extension and whatever filepath before it. |
| Brushes | as3, bash, csharp, coldfusion, cpp, css, diff, erlang, groovy, jscript, java, javafx, perl, php, plain, powershell, phython, ruby, scala, sql, vb, xml Note: to change your brush, while creating a new post, use one of the brushes listed above. In the tutorial above, I have used the xml brush. |
Category Article Tutorial
Powered by Blogger.
Blog Archive
-
▼
2010
(1682)
-
▼
December
(306)
- Print Pictures from Web Pages
- How to speed up your slow internet connection?
- How to Customize Your Browser Toolbar?
- How to display the hidden settings of LG handsets?
- How to display the hidden settings of Nokia mobiles?
- How to display the hidden settings of Samsung mobi...
- How to use Bluetooth technology to connect laptop ...
- Cara Hack Game Ninja Saga
- Cara Daftar Gamescool Point Blank PB Indonesia Online
- Cheat Point Blank PB 01012011Neutron Update Terbar...
- Cheat Point Blank 1 Januari 2011 Scarletze.V.1
- Happy New Year To All iphoneland.de.lv Readers !
- iPhone Apps May be Spying on You [Warning]
- Cheat Point Blank 01012011 5Nutzer A.1.2 1 Januari...
- Cheat Point Blank 01012011 NEW aJiE Underground 2 ...
- Cheat Point Blank 31122010 PigyBinz TimNas Garuda ...
- Cheat Point Blank SNUTZTRILOGY
- Cheat Point Blank Neutron V.1 Fix
- Cheat Point Blank 27122010 Viper + Hide + headgear...
- Redsn0w 0.9.7b4 to Untethered Jailbreak Without th...
- myTouch Slide and myTouch 4G Store
- This iPod nano 6th-Gen Hack Can Lead To A Possible...
- How To Remove Apps and Add Spaces To iPod Nano 6G ...
- iPod nano 6G DFU Mode Discovered ! Possibilities O...
- Rubyra1n Jailbreak ?
- iPad 2 with Wi-Fi, UMTS and CDMA Models
- iPad not charging when connected to computer
- How to change iTunes credit card info on iPad
- Utilising Unused Space in Blogger Header
- Redsn0w 0.9.7b4 will Include USBMuxd and Beta 5 wi...
- 1 Million Apple TVs Sold in Three Months
- The Monster at the End of This Book for iPad
- iPad backup session failed
- iPad 2 will feature a dual-core processor
- iFixit - Repair Manual app for iPad
- How to disable iPad's Picture Frame
- BackBoard Makes Switching Between Themes A Breeze!
- Download i-Funbox V1.1.407.389
- The 10 Best Jailbreak Apps of 2010
- Recovery Mode Helper Tool RecBoot 2.0 Now Availabl...
- Download Icon Renamer 1.0 [Video]
- Redsn0w 0.9.7b3 is Out ! Fixes TaskSwitcher and Ap...
- Sn0wbreeze 2.2 to Offer Baseband Preservation Mode
- Bluetooth, Music and iTunes Stuck After Jailbreaki...
- Blogger New Year Banner
- [Update]HOW TO: Jailbreak iOS 4.2.1 Untethered wit...
- Download Redsn0w 0.9.7b1 to Untether iOS 4.2.1 Jai...
- Merry Christmas
- What Happens When You Steal a Hacker's Computer [V...
- Happy Holidays from the Hotpot Team
- Awesome Note for iPad (+Todo)
- iPad Sleep/Wake button not working
- Pictureka! for iPad
- Avast!.Antivirus.5.0.584.Pre-Release FREE DOWNLOAD
- Download BitDefender Total Security 2011
- Download Bitdefender Internet Security 2011
- Review Kaspersky Internet Security 2011
- iPhone App Piracy Tool IPA God is Now Open Source[...
- Last-Minute Shopping in Portland, Powered by Hotpot
- Redsn0w Untethered Jailbreak (Backup Plan) for iOS...
- The untethered jailbreak firmware 4.2.1 developed ...
- Everything About Apple's 2010 Year in a Video !
- The lights of a Christmas tree controlled by an iP...
- Merged Places Pages to Unmerge "Facebook Allows It...
- Angry Birds is updated "the Mighty Eagle finally" ...
- Earphone jack problems with iPad
- Backup session cannot be started with iPad
- AirPlay no sound from iPad to Airport Express
- �Pull To Refresh Safari� Makes it Fresh to Reload ...
- Highlight Blogger Author Comments
- Dashing through the snow... with NORAD and Google
- Dashing through the snow... with NORAD and Google
- Apple's Remote App Supports AirPlay
- AirPlay icon missing on iPad How to Fix
- AirPrint not working on my iPad
- Camera+ Gets Back 4 Free Here with a Major Update !
- Comex Untethered Jailbreak is Not Ready for Christ...
- SHAtter Bootrom Jailbreak Exploit Has Been Leaked
- CopyTrans TuneSwift Simplifies iTunes Migration !
- Skyfire for iPad Hits the App Store
- Play Flash video on iPad with Skyfire Web Browser
- Christmas Gifts for iPad Lovers
- iPad no message selected when saved mail
- Info Complete Specification "Motorola Citrus WX445...
- Got Android? Start Rating Even Faster!
- Android In Spaaaace!
- Android In Spaaaace!
- �SB 2 Cloud� Jailbreak Tweak cracked and Free at C...
- Apple iPhoto 9.1.1 [Download]
- How to rename calendars on iPad
- info Specification and View "HTC 7 Pro CDMA" New ...
- WeBe++ Transforms your iPhone into a Bluetooth Key...
- Meet Your (Hotpot) Neighbors: James and Sara Ebenger
- How An iPhone App Can See Your Location Without As...
- Downgrade 6.15.00 Baseband Task Will Start After R...
- Apple Pulled WikiLeaks App Out the App Store[We st...
- Untethered Jailbreak 4.2.1 with Redn0w will not On...
- Info Specification GSM Candybar Phone "Samsung C35...
- 360 Web Browser: A powerful browser with advanced ...
- Navigon's MobileNavigator Updates with iPad Support
-
▼
December
(306)