Wednesday, August 15, 2018

Syntax Highlighting with Prism.JS on Blogger.com

To enable syntax highlighting using Prism.JS. Insert the following code at the end of the header of your Blogger theme.



<link href='http://prismjs.com/themes/prism.css' rel='stylesheet'/>

<script src='http://prismjs.com/prism.js' type='text/javascript'/>


To include code in the blog, switch to html and insert the following code:


<pre class="lang-bash"><code>

#This is programming code for shell script
#!/bin/bash

</pre></code>

For other language we replace bash with c,  cpp, csharp, docker, javascript, swift, objectivec or python.

For more language code please refer to the end of the main page of Prism.JS.


***

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.