Sitecore Stuff and Such

- by Christian Kay Linkhusen

NAVIGATION - SEARCH

Syntax highlighting with highlight.js

Highlight.js supplies a javascript library for syntax highlighting your code snippets on the web. The solution is hosted and is setup with inserting 3 lines of code. 

Include the Javascript, stylesheet and initialize the highlighting, by inserting the following 3 lines to the head section of your page:

<link rel="stylesheet" href="http://yandex.st/highlightjs/8.0/styles/vs.min.css">
<script src="http://yandex.st/highlightjs/8.0/highlight.min.js"></script>
<script type="text/javascript">hljs.initHighlightingOnLoad();</script>


All you have to do now, is to mark up your code snippet in the content with <pre><code>[content]</code</pre> and you are up and running.



Be the first to rate this post

  • Currently .0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5