Skip to main content

Google Code-Prettify in your blog

Here we show how to add code snippets to your blog with the script of Google code-prettity that makes your blog prittier.

  Add Google Code Prettify to your blog.
Open your blogger dashboard and go to Theme > Customize > Edit HTML
Add following script anywhere in the header, maybe just above </header> tag.

<script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script>
Put your code between <pre class="prettyprint">...</pre> tags in the HTML view.

The backbround color of <pre> can be set in the header as editting Customize > Edit HTML, and if needed  a scroll bar can be added.
<style type='text/css'> pre.prettyprint { overflow: auto; word-wrap: normal; background-color: black; } </style>


Comments