Module | Pygments |
In: |
lib/rb-pygments.rb
|
A wrapper for the [Pygments](pygments.org) command-line interface.
Returns the source code, highlighted using the given lexer and formatter. For example, returns HTML markup surrounding the source code for the `:html` formatter, or LaTeX markup for the `:latex` formatter.
@param source [String] The source code to be highlighted @param lexer [to_s] The name of the lexer (that is, language) to use, e.g. `:ruby` or `:python`.
The full list of lexers can be found by running `pygmentize -L lexers`, or [online](http://pygments.org/docs/lexers/).
@param formatter [to_s] The name of the formatter to use, e.g. `:html` or `:latex`.
The full list of formatters can be found by running `pygmentize -L formatters`, or [online](http://pygments.org/docs/formatters/).
@param options [{String => String}] Options passed to the formatter and lexer.
These are specific to the formatter and lexer being used; available options can be found by running `pygmentize -H formatter #{formatter}` or `pygmentize -H lexer #{lexer}`.
@return [String]
Returns a list of all langauges supported by Pygments. This list contains the short names of the languages as documented [on the Pygments site](pygments.org/docs/lexers/).
@return [Array<String>]
Returns the style definitions for a given style and formatter. For example, returns the CSS definitions for the HTML formatter and the LaTeX style definitions for the LaTeX formatter.
@param style [to_s] The name of the color theme to use, e.g. `:default` or `:colorful`.
The full list of color themes can be found by running `pygmentize -L styles`.
@param formatter [to_s] The name of the formatter to use, e.g. `:html` or `:latex`.
The full list of formatters can be found by running `pygmentize -L formatters`, or [online](http://pygments.org/docs/formatters/). At time of writing only `:html` and `:latex` support styles.
@param options [{String => String}] Options passed to the formatter.
These are formatter-specific; available options for a formatter can be found by running `pygmentize -H formatter #{formatter}`.
@return [String]