How to highlight code syntax in a blog content

Jquery

Posted on 01 Oct 15 by Vickey
  378



If you are a blog  writer and you write computer code or computer languages in your blog and you want to make your code highlighted then you can use 'highlight.js'. Which code you want to make highlight put in pre tag. Here is an example below

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.8.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<pre>
	<code>
		function __construct() 
		{
			parent::__construct();
			
		}
		function __destruct() 
		{
	       parent::__destruct() ;
	   	}
	</code>
</pre>

 


If this post help you reduce time to develop, you can help me to maintain this website :)
www.000webhost.com