Skip to content
Pygments lexer to perform syntax highlighting for N3, Turtle and SPARQL
Latest commit 1333097 Apr 15, 2015 @gniezen Merge pull request #11 from atextor/master
Preserve whitespace after WHERE keyword
Failed to load latest commit information.


This is a Pygments lexer that performs syntax highlighting for:

  • n3, turtle : Turtle/N3/NT (*.ttl, *.n3 and *.NT)
  • sparql : SPARQL (*.sparql)

Make sure you're running Pygments 1.7 or higher and run

sudo python install

to install and e.g.

pygmentize -l turtle filename.ttl

to run Pygments.

This is mostly code from Openvest which seems to be abandoned. The original instructions on that site only works when using pygmentize from the command-line. This implementation registers the package as a proper Pygments plugin which you can use from within Python, e.g.:

from pygments.lexers import (get_lexer_by_name,get_lexer_for_filename)

should return <pygments.lexers.Notation3Lexer>.

n3pygments was created based on this answer on the TeX StackExchange site. So yes, you can use it to perform using syntax highlighting on your code in LaTeX using Minted. I have also used it with success to perform syntax highlighting on an Octopress 2.0 blog.

Thanks go out to Raphaël Pinson and Philip Cooper.

Something went wrong with that request. Please try again.