How to add syntax Highlighting to your website

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

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”>
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.

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

Deepanker Verma is the founder of Techlomedia. He is a tech blogger, developer and gadget freak.

Similar Articles


Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

2020 UseThisTip | Part of Techlomedia Internet Pvt Ltd Developed By Deepanker