bfontaine/clygments

Support options

bfontaine opened this issue · 0 comments

Pygments has multiple lexers/formatters options, we should support them as an optional map. Let’s only implement simple values for now (i.e. not lists).

Lexers

  • :strip-nl (Boolean, default is true): strip leading and trailing newlines from the input
  • :strip-all (Boolean, default is false): strip all leading and trailing whitespace from the input
  • :ensure-nl (Boolean, default is true): make sure that the input ends with a newline. This is required for some lexers that consume input linewise.
  • :tab-size (Integer, default is 0): if given and greater than 0, expand tabs in the input
  • :encoding (String, default is "latin1"): 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). 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.

Some lexers support more options:

  • Lua:
    • :func-name-highlighting (Boolean, default is true): if given and true, highlight builtin function names
  • Python:
    • :python3 (Boolean, default is false): use Python 3 lexer for code.
  • Delphi
  • Modula-2
  • C#
  • Nemerle
  • Literate Agda
  • Literate Haskell
  • raw
  • reStructuredText
  • Lasso
  • PHP

Formatters

  • :encoding and :out-encoding: see :encoding above and Pygments’ docs.

Some formatters support more options:

  • BBcode
  • HTML
  • Image (unsupported for now)
  • LaTeX
  • RTF
  • SVG