Sha256: 2c9d52fe9818b5da5e53b42651ceb37df352f92691f51f500d3f17852460987e

Contents?: true

Size: 1.99 KB

Versions: 37

Compression:

Stored size: 1.99 KB

Contents

.. -*- mode: rst -*-

================
Available lexers
================

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``).

`ensurenl`
    Make sure that the input ends with a newline (default: ``True``).  This
    is required for some lexers that consume input linewise.
    *New in Pygments 1.3.*

`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 <http://chardet.feedparser.org/>`__ 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`:

[builtin_lexer_docs]

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:

.. sourcecode:: pycon

    >>> 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)``.

Version data entries

37 entries across 37 versions & 4 rubygems

Version Path
mortar-pygments.rb-0.5.7 vendor/pygments-main/docs/src/lexers.txt
mortar-pygments.rb-0.5.6 vendor/pygments-main/docs/src/lexers.txt
mortar-pygments.rb-0.5.5 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-jruby-0.5.4.2 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-jruby-0.5.4.1 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-jruby-0.5.4 vendor/pygments-main/docs/src/lexers.txt
gitlab-pygments.rb-0.5.4 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.5.4 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.5.2 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.5.1 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.5.0 vendor/pygments-main/docs/src/lexers.txt
gitlab-pygments.rb-0.3.2 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.4.2 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.4.1 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.3.7 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.3.6 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.3.5 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.3.4 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.3.3 vendor/pygments-main/docs/src/lexers.txt
pygments.rb-0.3.2 vendor/pygments-main/docs/src/lexers.txt