How to Use Prettify Syntax Highlighter in Blogger ? - WAY2IT

Latest Post :

Home Top Ad

How to Use Prettify Syntax Highlighter in Blogger ?





what is Prettify ?

Prettify is a combo of a Javascript module and the CSS that can be used as syntax highlighter for code snippets in any HTML page.


Quick method to load Google’s Prettify on Blogger


Step 1. Login to your Blogger account and go to "Template" And select "Edit HTML" of your blog.


Step 2. Copy the following code, and paste them right before </Head> tag in the template html :

<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>


Step 3. Save your template. 


Step 4. Now go to the blogger post editor and select "HTML" mode.

Step 5. Use <pre> tag with "prettyprint" class as below.

<pre class="prettyprint">
Enter your source code here
</pre>


Step 6. Publish and view your post.