Posts

Showing posts with the label code highlighting

Syntax highlighting for code in blogger

Introduction: There is no straight forward or simple way to do syntax highlighting to share any code through blogger. But we can easily do that by using some third party service. One such service is highligtjs.org . Use the following steps for code highlighting. Solution: We have to work in html view rather than compose view of blogger. For syntax highlighting we have to first add JS script for importing CSS in the header of the html. To do that add the following line at the starting in the html view. <head> <link rel="stylesheet" href="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.2.0/build/styles/androidstudio.min.css"> <script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.2.0/build/highlight.min.js"></script> <script>hljs.initHighlightingOnLoad();</script> </head> Then start writing inside the body html tag, as...

Colour highlighting GNUPLOT code in gedit.

Gedit by default show colour highlighting for the gnuplot code. But we can easily make it. We just have to download the language definition file and copy to the proper folder. The language definition file is a .lang file. You can download the gnuplot language definition from the following linke. https://wiki.gnome.org/Projects/GtkSourceView/LanguageDefinitions Download the file and copy the file to the folder /usr/share/gtksourceview-2.0/language-specs/ . You can use the following command $ sudo cp /your/download/location/gnuplot.lang /usr/share/gtksourceview-2.0/language-specs/  Now if you open any gnuplot code file with gedit you can see all the colours. But there is a problem, it will show colour highlight only for those file having extension .plt , but gnuplot can have extension .gp also. So to add .gp also in colour highlighting you have to add one line in the .lang file. If you check the file carefully you can see that there is a protion like this. <language id= "gnu...