The following is an example of how-to use highlight.js, a syntax highlighter for the web.

HTML

<div class="container">
<pre><code class="javascript">
$(document).ready(function() {
  $('pre code').each(function(i, block) {
    hljs.highlightBlock(block);
  });
});
</code></pre>
</div>

Use the following code snippet to add highlight.js to your website.

<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

CSS

pre {
  background: #eee;
  padding-bottom: 2em;
}