Code Syntax Highlighting in django with Pygments


Syntax Highlighting is a very much useful if you put code on your website. This can be easily achived with django-pygments. over 300 languages are supported.

List of supported Languages: http://pygments.org/languages/

django-pygments is the implementation of the pygments syntax highlighter for django.
usage is quite simple. after setting up everything, you need to put necessary template tags and then place your code in pre tags with a lang attribute specifying the language of the source code in your template.

example: <pre lang="python">YOUR CODE</pre>


1. First, Install the following packages.

pip install pygments
pip install django-pygments

Read more »

Comments

Popular posts from this blog

How to Install Antlr4 in Ubuntu/Linux

How to install python-gst (pygst) in ubuntu 16.04

How to make a gui Calculator in Python using Tkinter