• Tryolabs
Read time: 1 minute

Syntax Highlighting

You know, I’ve always loved those tiny editor-like widgets in blogs/sites when you are looking for some code inspiration on the web.

I’ve realized that we had to bring this funny stuff is want to have a fancy tech Blog, so I was doing some homework…

…and voila!

Now, how it’s done. After little research I’ve found Alex Gorbatchev’s SyntaxHighlighter. It’s very straight forward to install and very easy to use. You can find it here.

You just have to add the js scripts to your page as stated in the instructions, and will instantly have 30 different types of highlighters, including Python, Javascript and HTML.

A little thing that is not covered under instructions is that you have add support for XRegExp, you can download it here and after that simply load it in your section:

<script type="text/javascript" src="<path to javascript's>
/js/xregexp-min.js"></script>

Out of the box, the highlighter renders code on plain white background. We’ve made a little tunning to use a light grey on even code lines. You just have to edit shThemeDefault.css and modify line 24 like this:

Congrats Alex for your highlighter, it’s awesome!


Comments powered by Disqus

Code Tips, Tricks, and Freebies. Delivered Monthly.

Signup to our newsletter.

No spam, ever. We'll never share your email address and you can opt out at any time.

Hire us

Subscribe to receive news and blog updates.