Pygments

Available lexers

« Back To Index

Contents

This page lists all available builtin lexers and the options they take.

Currently, all lexers support these options:

stripnl
Strip leading and trailing newlines from the input (default: True)
stripall
Strip all leading and trailing whitespace from the input (default: False).
tabsize
If given and greater than 0, expand tabs in the input (default: 0).
encoding

New in Pygments 0.6.

If given, must be an encoding name (such as "utf-8"). This encoding will be used to convert the input string to Unicode (if it is not already a Unicode string). The default is "latin1".

If this option is set to "guess", a simple UTF-8 vs. Latin-1 detection is used, if it is set to "chardet", the chardet library is used to guess the encoding of the input.

The "Short Names" field lists the identifiers that can be used with the get_lexer_by_name() function.

These lexers are builtin and can be imported from pygments.lexers:

Lexers for agile languages

IoLexer

For Io (a small, prototype-based programming language) source.

New in Pygments 0.10.

Short names:io
Filename patterns:*.io
Mimetypes:text/x-iosrc

LuaLexer

For Lua source code.

Additional options accepted:

func_name_highlighting
If given and True, highlight builtin function names (default: True).
disabled_modules

If given, must be a list of module names whose function names should not be highlighted. By default all modules are highlighted.

To get a list of allowed modules have a look into the _luabuiltins module:

>>> from pygments.lexers._luabuiltins import MODULES
>>> MODULES.keys()
['string', 'coroutine', 'modules', 'io', 'basic', ...]
Short names:lua
Filename patterns:*.lua
Mimetypes:text/x-lua, application/x-lua

MiniDLexer

For MiniD (a D-like scripting language) source.

Short names:minid
Filename patterns:*.md
Mimetypes:text/x-minidsrc

PerlLexer

For Perl source code.

Short names:perl, pl
Filename patterns:*.pl, *.pm
Mimetypes:text/x-perl, application/x-perl

Python3Lexer

For Python source code (version 3.0).

New in Pygments 0.10.

Short names:python3, py3
Filename patterns:None
Mimetypes:text/x-python3, application/x-python3

PythonConsoleLexer

For Python console output or doctests, such as:

>>> a = 'foo'
>>> print a
foo
>>> 1 / 0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
Short names:pycon
Filename patterns:None
Mimetypes:text/x-python-doctest

PythonLexer

For Python source code.

Short names:python, py
Filename patterns:*.py, *.pyw, *.sc, SConstruct, SConscript
Mimetypes:text/x-python, application/x-python

PythonTracebackLexer

For Python tracebacks.

New in Pygments 0.7.

Short names:pytb
Filename patterns:*.pytb
Mimetypes:text/x-python-traceback

RubyConsoleLexer

For Ruby interactive console (irb) output like:

irb(main):001:0> a = 1
=> 1
irb(main):002:0> puts a
1
=> nil
Short names:rbcon, irb
Filename patterns:None
Mimetypes:text/x-ruby-shellsession

RubyLexer

For Ruby source code.

Short names:rb, ruby
Filename patterns:*.rb, *.rbw, Rakefile, *.rake, *.gemspec, *.rbx
Mimetypes:text/x-ruby, application/x-ruby

TclLexer

For Tcl source code.

New in Pygments 0.10.

Short names:tcl
Filename patterns:*.tcl
Mimetypes:text/x-tcl, text/x-script.tcl, application/x-tcl

Lexers for assembly languages

CObjdumpLexer

For the output of 'objdump -Sr on compiled C files'

Short names:c-objdump
Filename patterns:*.c-objdump
Mimetypes:text/x-c-objdump

CppObjdumpLexer

For the output of 'objdump -Sr on compiled C++ files'

Short names:cpp-objdump, c++-objdumb, cxx-objdump
Filename patterns:*.cpp-objdump, *.c++-objdump, *.cxx-objdump
Mimetypes:text/x-cpp-objdump

DObjdumpLexer

For the output of 'objdump -Sr on compiled D files'

Short names:d-objdump
Filename patterns:*.d-objdump
Mimetypes:text/x-d-objdump

GasLexer

For Gas (AT&T) assembly code.

Short names:gas
Filename patterns:*.s, *.S
Mimetypes:text/x-gas

LlvmLexer

For LLVM assembly code.

Short names:llvm
Filename patterns:*.ll
Mimetypes:text/x-llvm

ObjdumpLexer

For the output of 'objdump -dr'

Short names:objdump
Filename patterns:*.objdump
Mimetypes:text/x-objdump

Lexers for compiled languages

CLexer

For C source code with preprocessor directives.

Short names:c
Filename patterns:*.c, *.h
Mimetypes:text/x-chdr, text/x-csrc

CppLexer

For C++ source code with preprocessor directives.

Short names:cpp, c++
Filename patterns:*.cpp, *.hpp, *.c++, *.h++, *.cc, *.hh, *.cxx, *.hxx
Mimetypes:text/x-c++hdr, text/x-c++src

DLexer

For D source.

Short names:d
Filename patterns:*.d, *.di
Mimetypes:text/x-dsrc

DelphiLexer

For Delphi (Borland Object Pascal), Turbo Pascal and Free Pascal source code.

Additional options accepted:

turbopascal
Highlight Turbo Pascal specific keywords (default: True).
delphi
Highlight Borland Delphi specific keywords (default: True).
freepascal
Highlight Free Pascal specific keywords (default: True).
units
A list of units that should be considered builtin, supported are System, SysUtils, Classes and Math. Default is to consider all of them builtin.
Short names:delphi, pas, pascal, objectpascal
Filename patterns:*.pas
Mimetypes:text/x-pascal

DylanLexer

For the Dylan language.

New in Pygments 0.7.

Short names:dylan
Filename patterns:*.dylan
Mimetypes:text/x-dylan

FortranLexer

Lexer for FORTRAN 90 code.

New in Pygments 0.10.

Short names:fortran
Filename patterns:*.f, *.f90
Mimetypes:text/x-fortran

JavaLexer

For Java source code.

Short names:java
Filename patterns:*.java
Mimetypes:text/x-java

ObjectiveCLexer

For Objective-C source code with preprocessor directives.

Short names:objective-c, objectivec, obj-c, objc
Filename patterns:*.m
Mimetypes:text/x-objective-c

Lexers for .net languages

BooLexer

For Boo source code.

Short names:boo
Filename patterns:*.boo
Mimetypes:text/x-boo

CSharpLexer

For C# source code.

Additional options accepted:

unicodelevel

Determines which Unicode characters this lexer allows for identifiers. The possible values are:

  • none -- only the ASCII letters and numbers are allowed. This is the fastest selection.
  • basic -- all Unicode characters from the specification except category Lo are allowed.
  • full -- all Unicode characters as specified in the C# specs are allowed. Note that this means a considerable slowdown since the Lo category has more than 40,000 characters in it!

The default value is basic.

New in Pygments 0.8.

Short names:csharp, c#
Filename patterns:*.cs
Mimetypes:text/x-csharp

VbNetLexer

For Visual Basic.NET source code.

Short names:vb.net, vbnet
Filename patterns:*.vb, *.bas
Mimetypes:text/x-vbnet, text/x-vba

Lexers for functional languages

CommonLispLexer

A Common Lisp lexer.

New in Pygments 0.9.

Short names:common-lisp, cl
Filename patterns:*.cl, *.lisp, *.el
Mimetypes:text/x-common-lisp

ErlangLexer

For the Erlang functional programming language.

Blame Jeremy Thurgood (http://jerith.za.net/).

New in Pygments 0.9.

Short names:erlang
Filename patterns:*.erl, *.hrl
Mimetypes:text/x-erlang

HaskellLexer

A Haskell lexer based on the lexemes defined in the Haskell 98 Report.

New in Pygments 0.8.

Short names:haskell, hs
Filename patterns:*.hs
Mimetypes:text/x-haskell

LiterateHaskellLexer

For Literate Haskell (Bird-style or LaTeX) source.

Additional options accepted:

litstyle
If given, must be "bird" or "latex". If not given, the style is autodetected: if the first non-whitespace character in the source is a backslash or percent character, LaTeX is assumed, else Bird.

New in Pygments 0.9.

Short names:lhs, literate-haskell
Filename patterns:*.lhs
Mimetypes:text/x-literate-haskell

OcamlLexer

For the OCaml language.

New in Pygments 0.7.

Short names:ocaml
Filename patterns:*.ml, *.mli, *.mll, *.mly
Mimetypes:text/x-ocaml

SchemeLexer

A Scheme lexer, parsing a stream and outputting the tokens needed to highlight scheme code. This lexer could be most probably easily subclassed to parse other LISP-Dialects like Common Lisp, Emacs Lisp or AutoLisp.

This parser is checked with pastes from the LISP pastebin at http://paste.lisp.org/ to cover as much syntax as possible.

It supports the full Scheme syntax as defined in R5RS.

New in Pygments 0.6.

Short names:scheme, scm
Filename patterns:*.scm
Mimetypes:text/x-scheme, application/x-scheme

Lexers for math languages

MatlabLexer

For Matlab (or GNU Octave) source code. Contributed by Ken Schutte <kschutte@csail.mit.edu>.

New in Pygments 0.10.

Short names:matlab, octave
Filename patterns:*.m
Mimetypes:text/matlab

MatlabSessionLexer

For Matlab (or GNU Octave) sessions. Modeled after PythonConsoleLexer. Contributed by Ken Schutte <kschutte@csail.mit.edu>.

New in Pygments 0.10.

Short names:matlabsession
Filename patterns:None
Mimetypes:None

MuPADLexer

A MuPAD lexer. Contributed by Christopher Creutzig <christopher@creutzig.de>.

New in Pygments 0.8.

Short names:mupad
Filename patterns:*.mu
Mimetypes:None

NumPyLexer

A Python lexer recognizing Numerical Python builtins.

New in Pygments 0.10.

Short names:numpy
Filename patterns:*.py, *.pyw, *.sc, SConstruct, SConscript
Mimetypes:text/x-python, application/x-python

SLexer

For S, S-plus, and R source code.

New in Pygments 0.10.

Short names:splus, s, r
Filename patterns:*.S, *.R
Mimetypes:text/S-plus, text/S, text/R

Lexers for other languages

BashLexer

Lexer for (ba)sh shell scripts.

New in Pygments 0.6.

Short names:bash, sh
Filename patterns:*.sh
Mimetypes:application/x-sh, application/x-shellscript

BatchLexer

Lexer for the DOS/Windows Batch file format.

New in Pygments 0.7.

Short names:bat
Filename patterns:*.bat, *.cmd
Mimetypes:application/x-dos-batch

BefungeLexer

Lexer for the esoteric Befunge language.

New in Pygments 0.7.

Short names:befunge
Filename patterns:*.befunge
Mimetypes:application/x-befunge

BrainfuckLexer

Lexer for the esoteric BrainFuck language.

Short names:brainfuck, bf
Filename patterns:*.bf, *.b
Mimetypes:application/x-brainfuck

LogtalkLexer

For Logtalk source code.

New in Pygments 0.10.

Short names:logtalk
Filename patterns:*.lgt
Mimetypes:text/x-logtalk

MOOCodeLexer

For MOOCode (the MOO scripting language).

New in Pygments 0.9.

Short names:moocode
Filename patterns:*.moo
Mimetypes:text/x-moocode

MySqlLexer

Special lexer for MySQL.

Short names:mysql
Filename patterns:None
Mimetypes:text/x-mysql

RedcodeLexer

A simple Redcode lexer based on ICWS'94. Contributed by Adam Blinkinsop <blinks@acm.org>.

New in Pygments 0.8.

Short names:redcode
Filename patterns:*.cw
Mimetypes:None

SmalltalkLexer

For Smalltalk syntax. Contributed by Stefan Matthias Aust.

New in Pygments 0.10.

Short names:smalltalk, squeak
Filename patterns:*.st
Mimetypes:text/x-smalltalk

SqlLexer

Lexer for Structured Query Language. Currently, this lexer does not recognize any special syntax except ANSI SQL.

Short names:sql
Filename patterns:*.sql
Mimetypes:text/x-sql

TcshLexer

Lexer for tcsh scripts.

New in Pygments 0.10.

Short names:tcsh, csh
Filename patterns:*.tcsh, *.csh
Mimetypes:application/x-csh

Special lexers

RawTokenLexer

Recreate a token stream formatted with the RawTokenFormatter.

Additional options accepted:

compress
If set to "gz" or "bz2", decompress the token stream with the given compression algorithm before lexing (default: "").
Short names:raw
Filename patterns:*.raw
Mimetypes:application/x-pygments-tokens

TextLexer

"Null" lexer, doesn't highlight anything.

Short names:text
Filename patterns:*.txt
Mimetypes:text/plain

Lexers for various template engines' markup

CssDjangoLexer

Subclass of the DjangoLexer that highlights unlexed data with the CssLexer.

Short names:css+django, css+jinja
Filename patterns:None
Mimetypes:text/css+django, text/css+jinja

CssErbLexer

Subclass of ErbLexer which highlights unlexed data with the CssLexer.

Short names:css+erb, css+ruby
Filename patterns:None
Mimetypes:text/css+ruby

CssGenshiLexer

A lexer that highlights CSS definitions in genshi text templates.

Short names:css+genshitext, css+genshi
Filename patterns:None
Mimetypes:text/css+genshi

CssPhpLexer

Subclass of PhpLexer which highlights unmatched data with the CssLexer.

Short names:css+php
Filename patterns:None
Mimetypes:text/css+php

CssSmartyLexer

Subclass of the SmartyLexer that highlights unlexed data with the CssLexer.

Short names:css+smarty
Filename patterns:None
Mimetypes:text/css+smarty

DjangoLexer

Generic django and jinja template lexer.

It just highlights django/jinja code between the preprocessor directives, other data is left untouched by the lexer.

Short names:django, jinja
Filename patterns:None
Mimetypes:application/x-django-templating, application/x-jinja

ErbLexer

Generic ERB (Ruby Templating) lexer.

Just highlights ruby code between the preprocessor directives, other data is left untouched by the lexer.

All options are also forwarded to the RubyLexer.

Short names:erb
Filename patterns:None
Mimetypes:application/x-ruby-templating

GenshiLexer

A lexer that highlights genshi and kid kid XML templates.

Short names:genshi, kid, xml+genshi, xml+kid
Filename patterns:*.kid
Mimetypes:application/x-genshi, application/x-kid

GenshiTextLexer

A lexer that highlights genshi text templates.

Short names:genshitext
Filename patterns:None
Mimetypes:application/x-genshi-text, text/x-genshi

HtmlDjangoLexer

Subclass of the DjangoLexer that highighlights unlexed data with the HtmlLexer.

Nested Javascript and CSS is highlighted too.

Short names:html+django, html+jinja
Filename patterns:None
Mimetypes:text/html+django, text/html+jinja

HtmlGenshiLexer

A lexer that highlights genshi and kid kid HTML templates.

Short names:html+genshi, html+kid
Filename patterns:None
Mimetypes:text/html+genshi

HtmlPhpLexer

Subclass of PhpLexer that highlights unhandled data with the HtmlLexer.

Nested Javascript and CSS is highlighted too.

Short names:html+php
Filename patterns:*.phtml
Mimetypes:application/x-php, application/x-httpd-php, application/x-httpd-php3, application/x-httpd-php4, application/x-httpd-php5

HtmlSmartyLexer

Subclass of the SmartyLexer that highighlights unlexed data with the HtmlLexer.

Nested Javascript and CSS is highlighted too.

Short names:html+smarty
Filename patterns:None
Mimetypes:text/html+smarty

JavascriptDjangoLexer

Subclass of the DjangoLexer that highlights unlexed data with the JavascriptLexer.

Short names:js+django, javascript+django, js+jinja, javascript+jinja
Filename patterns:None
Mimetypes:application/x-javascript+django, application/x-javascript+jinja, text/x-javascript+django, text/x-javascript+jinja, text/javascript+django, text/javascript+jinja

JavascriptErbLexer

Subclass of ErbLexer which highlights unlexed data with the JavascriptLexer.

Short names:js+erb, javascript+erb, js+ruby, javascript+ruby
Filename patterns:None
Mimetypes:application/x-javascript+ruby, text/x-javascript+ruby, text/javascript+ruby

JavascriptGenshiLexer

A lexer that highlights javascript code in genshi text templates.

Short names:js+genshitext, js+genshi, javascript+genshitext, javascript+genshi
Filename patterns:None
Mimetypes:application/x-javascript+genshi, text/x-javascript+genshi, text/javascript+genshi

JavascriptPhpLexer

Subclass of PhpLexer which highlights unmatched data with the JavascriptLexer.

Short names:js+php, javascript+php
Filename patterns:None
Mimetypes:application/x-javascript+php, text/x-javascript+php, text/javascript+php

JavascriptSmartyLexer

Subclass of the SmartyLexer that highlights unlexed data with the JavascriptLexer.

Short names:js+smarty, javascript+smarty
Filename patterns:None
Mimetypes:application/x-javascript+smarty, text/x-javascript+smarty, text/javascript+smarty

JspLexer

Lexer for Java Server Pages.

New in Pygments 0.7.

Short names:jsp
Filename patterns:*.jsp
Mimetypes:application/x-jsp

MakoCssLexer

Subclass of the MakoLexer that highlights unlexer data with the CssLexer.

New in Pygments 0.7.

Short names:css+mako
Filename patterns:None
Mimetypes:text/css+mako

MakoHtmlLexer

Subclass of the MakoLexer that highlights unlexed data with the HtmlLexer.

New in Pygments 0.7.

Short names:html+mako
Filename patterns:None
Mimetypes:text/html+mako

MakoJavascriptLexer

Subclass of the MakoLexer that highlights unlexer data with the JavascriptLexer.

New in Pygments 0.7.

Short names:js+mako, javascript+mako
Filename patterns:None
Mimetypes:application/x-javascript+mako, text/x-javascript+mako, text/javascript+mako

MakoLexer

Generic mako templates lexer. Code that isn't Mako markup is yielded as Token.Other.

New in Pygments 0.7.

Short names:mako
Filename patterns:*.mao
Mimetypes:application/x-mako

MakoXmlLexer

Subclass of the MakoLexer that highlights unlexer data with the XmlLexer.

New in Pygments 0.7.

Short names:xml+mako
Filename patterns:None
Mimetypes:application/xml+mako

MyghtyCssLexer

Subclass of the MyghtyLexer that highlights unlexer data with the CssLexer.

New in Pygments 0.6.

Short names:css+myghty
Filename patterns:None
Mimetypes:text/css+myghty

MyghtyHtmlLexer

Subclass of the MyghtyLexer that highlights unlexer data with the HtmlLexer.

New in Pygments 0.6.

Short names:html+myghty
Filename patterns:None
Mimetypes:text/html+myghty

MyghtyJavascriptLexer

Subclass of the MyghtyLexer that highlights unlexer data with the JavascriptLexer.

New in Pygments 0.6.

Short names:js+myghty, javascript+myghty
Filename patterns:None
Mimetypes:application/x-javascript+myghty, text/x-javascript+myghty, text/javascript+mygthy

MyghtyLexer

Generic myghty templates lexer. Code that isn't Myghty markup is yielded as Token.Other.

New in Pygments 0.6.

Short names:myghty
Filename patterns:*.myt, autodelegate
Mimetypes:application/x-myghty

MyghtyXmlLexer

Subclass of the MyghtyLexer that highlights unlexer data with the XmlLexer.

New in Pygments 0.6.

Short names:xml+myghty
Filename patterns:None
Mimetypes:application/xml+myghty

RhtmlLexer

Subclass of the ERB lexer that highlights the unlexed data with the html lexer.

Nested Javascript and CSS is highlighted too.

Short names:rhtml, html+erb, html+ruby
Filename patterns:*.rhtml
Mimetypes:text/html+ruby

SmartyLexer

Generic Smarty template lexer.

Just highlights smarty code between the preprocessor directives, other data is left untouched by the lexer.

Short names:smarty
Filename patterns:*.tpl
Mimetypes:application/x-smarty

XmlDjangoLexer

Subclass of the DjangoLexer that highlights unlexed data with the XmlLexer.

Short names:xml+django, xml+jinja
Filename patterns:None
Mimetypes:application/xml+django, application/xml+jinja

XmlErbLexer

Subclass of ErbLexer which highlights data outside preprocessor directives with the XmlLexer.

Short names:xml+erb, xml+ruby
Filename patterns:None
Mimetypes:application/xml+ruby

XmlPhpLexer

Subclass of PhpLexer that higlights unhandled data with the XmlLexer.

Short names:xml+php
Filename patterns:None
Mimetypes:application/xml+php

XmlSmartyLexer

Subclass of the SmartyLexer that highlights unlexed data with the XmlLexer.

Short names:xml+smarty
Filename patterns:None
Mimetypes:application/xml+smarty

Lexers for non-source code file types

ApacheConfLexer

Lexer for configuration files following the Apache config file format.

New in Pygments 0.6.

Short names:apacheconf, aconf, apache
Filename patterns:.htaccess, apache.conf, apache2.conf
Mimetypes:text/x-apacheconf

BBCodeLexer

A lexer that highlights BBCode(-like) syntax.

New in Pygments 0.6.

Short names:bbcode
Filename patterns:None
Mimetypes:text/x-bbcode

BaseMakefileLexer

Lexer for simple Makefiles (no preprocessing).

New in Pygments 0.10.

Short names:basemake
Filename patterns:None
Mimetypes:None

DarcsPatchLexer

DarcsPatchLexer is a lexer for the various versions of the darcs patch format. Examples of this format are derived by commands such as darcs annotate --patch and darcs send.

New in Pygments 0.10.

Short names:dpatch
Filename patterns:*.dpatch, *.darcspatch
Mimetypes:None

DebianControlLexer

Lexer for Debian control files and apt-cache show <pkg> outputs.

New in Pygments 0.9.

Short names:control
Filename patterns:control
Mimetypes:None

DiffLexer

Lexer for unified or context-style diffs or patches.

Short names:diff
Filename patterns:*.diff, *.patch
Mimetypes:text/x-diff, text/x-patch

GettextLexer

Lexer for Gettext catalog files.

New in Pygments 0.9.

Short names:pot, po
Filename patterns:*.pot, *.po
Mimetypes:application/x-gettext, text/x-gettext, text/gettext

GroffLexer

Lexer for the (g)roff typesetting language, supporting groff extensions. Mainly useful for highlighting manpage sources.

New in Pygments 0.6.

Short names:groff, nroff, man
Filename patterns:*.[1234567], *.man
Mimetypes:application/x-troff, text/troff

IniLexer

Lexer for configuration files in INI style.

Short names:ini, cfg
Filename patterns:*.ini, *.cfg, *.properties
Mimetypes:text/x-ini

IrcLogsLexer

Lexer for IRC logs in irssi, xchat or weechat style.

Short names:irc
Filename patterns:*.weechatlog
Mimetypes:text/x-irclog

MakefileLexer

Lexer for BSD and GNU make extensions (lenient enough to handle both in the same file even).

Rewritten in Pygments 0.10.

Short names:make, makefile, mf, bsdmake
Filename patterns:*.mak, Makefile, makefile, Makefile.*
Mimetypes:text/x-makefile

MoinWikiLexer

For MoinMoin (and Trac) Wiki markup.

New in Pygments 0.7.

Short names:trac-wiki, moin
Filename patterns:None
Mimetypes:text/x-trac-wiki

RstLexer

For reStructuredText markup.

New in Pygments 0.7.

Additional options accepted:

handlecodeblocks
Highlight the contents of .. sourcecode:: langauge and .. code:: language directives with a lexer for the given language (default: True). New in Pygments 0.8.
Short names:rst, rest, restructuredtext
Filename patterns:*.rst, *.rest
Mimetypes:text/x-rst

SourcesListLexer

Lexer that highlights debian sources.list files.

New in Pygments 0.7.

Short names:sourceslist, sources.list
Filename patterns:sources.list
Mimetypes:None

SquidConfLexer

Lexer for squid configuration files.

New in Pygments 0.9.

Short names:squidconf, squid.conf, squid
Filename patterns:squid.conf
Mimetypes:text/x-squidconf

TexLexer

Lexer for the TeX and LaTeX typesetting languages.

Short names:tex, latex
Filename patterns:*.tex, *.aux, *.toc
Mimetypes:text/x-tex, text/x-latex

VimLexer

Lexer for VimL script files.

New in Pygments 0.8.

Short names:vim
Filename patterns:*.vim, .vimrc
Mimetypes:text/x-vim

Lexers for web-related languages and markup

ActionScriptLexer

For ActionScript source code.

New in Pygments 0.9.

Short names:as, actionscript
Filename patterns:*.as
Mimetypes:application/x-actionscript, text/x-actionscript, text/actionscript

CssLexer

For CSS (Cascading Style Sheets).

Short names:css
Filename patterns:*.css
Mimetypes:text/css

HtmlLexer

For HTML 4 and XHTML 1 markup. Nested JavaScript and CSS is highlighted by the appropriate lexer.

Short names:html
Filename patterns:*.html, *.htm, *.xhtml, *.xslt
Mimetypes:text/html, application/xhtml+xml

JavascriptLexer

For JavaScript source code.

Short names:js, javascript
Filename patterns:*.js
Mimetypes:application/x-javascript, text/x-javascript, text/javascript

PhpLexer

For PHP source code. For PHP embedded in HTML, use the HtmlPhpLexer.

Additional options accepted:

startinline
If given and True the lexer starts highlighting with php code (i.e.: no starting <?php required). The default is False.
funcnamehighlighting
If given and True, highlight builtin function names (default: True).
disabledmodules

If given, must be a list of module names whose function names should not be highlighted. By default all modules are highlighted except the special 'unknown' module that includes functions that are known to php but are undocumented.

To get a list of allowed modules have a look into the _phpbuiltins module:

>>> from pygments.lexers._phpbuiltins import MODULES
>>> MODULES.keys()
['PHP Options/Info', 'Zip', 'dba', ...]

In fact the names of those modules match the module names from the php documentation.

Short names:php, php3, php4, php5
Filename patterns:*.php, *.php[345]
Mimetypes:text/x-php

XmlLexer

Generic lexer for XML (eXtensible Markup Language).

Short names:xml
Filename patterns:*.xml, *.xsl, *.rss, *.xslt, *.xsd, *.wsdl
Mimetypes:text/xml, application/xml, image/svg+xml, application/rss+xml, application/atom+xml, application/xsl+xml, application/xslt+xml

XsltLexer

A lexer for XSLT.

New in Pygments 0.10.

Short names:xslt
Filename patterns:*.xsl, *.xslt
Mimetypes:text/xml, application/xml, image/svg+xml, application/rss+xml, application/atom+xml, application/xsl+xml, application/xslt+xml

Iterating over all lexers

New in Pygments 0.6.

To get all lexers (both the builtin and the plugin ones), you can use the get_all_lexers() function from the pygments.lexers module:

>>> from pygments.lexers import get_all_lexers
>>> i = get_all_lexers()
>>> i.next()
('Diff', ('diff',), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch'))
>>> i.next()
('Delphi', ('delphi', 'objectpascal', 'pas', 'pascal'), ('*.pas',), ('text/x-pascal',))
>>> i.next()
('XML+Ruby', ('xml+erb', 'xml+ruby'), (), ())

As you can see, the return value is an iterator which yields tuples in the form (name, aliases, filetypes, mimetypes).