tag:blogger.com,1999:blog-34547564235305751512024-03-13T03:54:51.973-07:00World of PossibilitiesIshtiaque Ahmedhttp://www.blogger.com/profile/11391135571433385847noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-3454756423530575151.post-49510535910454648162009-09-29T02:51:00.000-07:002009-09-29T08:23:40.958-07:00syntax highlighting in blogspot blogEver wanted to highlight the code syntax of your code snippet on blogspot? I guess you always do. What to use? Of course its going to be Alex Gorbatchev's Syntax Highlighter. But its a bit tricky to use it on blogger. To make it work properly, you will have to add the css links and js codes to the lauout file of your blogspot blog.<br /><br />I always use the hosted code at alxgorbatchev.com.<br /><br />Step 1. Log in to your blog dashboard<br /><br />Step 2. then go to LAYOUT >> EDIT HTML<br /><br />Step 3. Right before the closing head tag, add this css files<br /><br />http://alexgorbatchev.com/pub/sh/current/styles/shCore.css<br /><br />http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css<br /><br />Step 4. Then add these js files at the bottom of the page, right before the closing body tag.<br />http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js<br /><br />http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js<br /><br />http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js<br /><br />http://alexgorbatchev.com/pub/sh/current/scripts/shBrushSql.js<br /><br />http://alexgorbatchev.com/pub/sh/current/scripts/shBrushXml.js<br /><br />http://alexgorbatchev.com/pub/sh/current/scripts/shBrushPhp.js<br /><br />then add this few lines of javascript<br /><pre class="brush: js"><br /><script type='text/javascript'><br /> SyntaxHighlighter.config.bloggerMode = true;<br /> SyntaxHighlighter.all();<br /></script><br /></pre><br /><br />Step 5. All you have to do now is to write the real sourcecode to be shown with the highlighter. For example,<br /><br /><pre class="brush: php"><br /><pre class="brush: php"><br /><br />function test()<br />{<br /> return 10;<br />}<br /></pre><br /></pre><br /><br />That will do it. You will have a prefectly running syntax highlighter now. Enjoy!Ishtiaque Ahmedhttp://www.blogger.com/profile/11391135571433385847noreply@blogger.com0