Google Syntax Highlighter

Posted on Posted in Stories

For future reference, this how you make the Google Syntax Highlighter work for your blog post.

If you want to include a strip of code into your blog, you can make use of the Google Syntax Highlighter plugin that is already installed in the Ideytech website. All you need to do is:

(1) Put your code between the “pre” tag with the “name” and “class” attributes. The name attribute should always have a value of “code” and the value of the class attribute depends on the language of the code that you are trying to post. List of supported languages for the class attribute can be found here.

Your code should look like this:

(2) Link the CSS & Javascript files needed to render your code properly. Just copy-paste this code at the bottom of your post:

Note: You have to replace the language at the part where it says …Scripts/shBrushJava.js with the appropriate language that you are trying to post. In other words, if you are tying to post an HTML code, you’ll need to use class=”html” at the pre tag which should consequently reflect …Scripts/shBrushHTML.js.

For further information, you can check out this site.

2 thoughts on “Google Syntax Highlighter

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.