Posted in JavaScript Tutorial

How to add syntax Highlighting to your website

How to add syntax Highlighting to your website Posted on November 10, 20111 Comment

Deepanker Verma is the CEO of Techlomedia and a full time blogger. On this blog, he shares web design resources, SEO tips blog monetization tips.

Best WordPress Hosting
How to add syntax Highlighting to your website

Many times in some web project, you need to highlight codes and syntax as you can see in dream weaver or other code generator software. If you do not know how to do that, this simple Javascript API can help you. Follow the given step to integrate.

Download the API code from the link
http://code.google.com/p/google-code-prettify/

Add the folder to your project and then import prettify.css and prettify.js files to your webpage where you want to highlight syntax.

Now you need to place the code which you want to highlight in the pre tag with class attribute prettyprint

<pre class=”prettyprint”>
</pre>
Use the code inside the tags given above.

At last you need to call prettyPrint() function. We can place code at any part of page.
<script>prettyPrint();</script>

If you still have problem, then read the readme given with the API or comment here.

advertisement

Advertisement

Deepanker Verma is the CEO of Techlomedia and a full time blogger. On this blog, he shares web design resources, SEO tips blog monetization tips.

1 thought on “How to add syntax Highlighting to your website

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!