# man > pygmentize(1)

> **TLDR:** Python-based syntax highlighter.
>
- Highlight file syntax and print to `stdout` (language is inferred from the file extension):
  `pygmentize {{file.py}}`
- Explicitly set the language for syntax highlighting:
  `pygmentize -l {{javascript}} {{input_file}}`
- List available lexers (processors for input languages):
  `pygmentize -L lexers`
- Save output to a file in HTML format:
  `pygmentize -f html -o {{output_file.html}} {{input_file.py}}`
- List available output formats:
  `pygmentize -L formatters`
- Output an HTML file, with additional formatter options (full page, with line numbers):
  `pygmentize -f html -O "full,linenos=True" -o {{output_file.html}} {{input_file}}`

*Source: tldr-pages*

---

[_PYGMENTIZE_(1)](https://www.chedong.com/phpMan.php/man/PYGMENTIZE/1/markdown)                          General Commands Manual                         [_PYGMENTIZE_(1)](https://www.chedong.com/phpMan.php/man/PYGMENTIZE/1/markdown)

## NAME
       pygmentize - highlights the input file


## SYNOPSIS
       **pygmentize        **[-l _<lexer>_ | -g] [-F _<filter>_[:_<options>_]] [-f _<formatter>_]       [-O _<op‐_
       _tions>_] [-P _<option=value>_] [-o _<outfile>_] [_<infile>_]
       **pygmentize **-S _<style>_ -f _<formatter>_ [-a _<arg>_] [-O _<options>_] [-P _<option=value>_]
       **pygmentize **-L [_<which>_ ...]
       **pygmentize **-N _<filename>_
       **pygmentize **-C
       **pygmentize **-H _<type>_ _<name>_
       **pygmentize **-h | -V


## DESCRIPTION
       Pygments is a generic syntax highlighter for general use in all kinds of software such as fo‐
       rum systems, wikis or other applications that need to prettify source code.

       Its highlights are:
         * a wide range of common languages and markup formats is supported
         * special attention is paid to details, increasing quality by a fair amount
         * support for new languages and formats are added easily
         * a number of output formats, presently HTML, LaTeX and ANSI sequences
         * it is usable as a command-line tool and as a library
         * ... and it highlights even Brainfuck!

       **pygmentize **is a command that uses Pygments to highlight the input file and write  the  result
       to _<outfile>_. If no _<infile>_ is given, stdin is used.

## OPTIONS
       A summary of options is included below.

### -l _
              Set the lexer name. If not given, the lexer is guessed from the extension of the input
              file name (this obviously doesn't work if the input is stdin).

### -g     
              this fails (this option works for highlighting standard input).

### -F _
              Add a filter to the token stream. You can give options in the same way as for -O after
              a colon (note: there must not be spaces around the colon).  This option can  be  given
              multiple times.

### -f _
              Set  the  formatter  name.  If not given, it will be guessed from the extension of the
              output file name. If no output file is given, the terminal formatter will be  used  by
              default.

### -o _
              Set output file. If not given, stdout is used.

### -O _
              With  this  option, you can give the lexer and formatter a comma-separated list of op‐
              tions, e.g. "-O bg=light,python=cool". Which options are valid for  which  lexers  and
              formatters  can  be  found  in  the  documentation.  This option can be given multiple
              times.

### -P _
              This option adds lexer and formatter options like the -O option, but you can only give
              one option per -P. That way, the option value may contain  commas  and  equals  signs,
              which it can't with -O.

### -S _
              Print  out  style  definitions  for  style _<style>_ and for formatter _<formatter>_.  The
              meaning of the argument given by **-a _**<arg>_ is formatter dependent and can be  found  in
              the documentation.

### -L [_
              List  lexers, formatters, styles or filters. Set _<which>_ to the thing you want to list
              (e.g. "styles"), or omit it to list everything.

### -N _
              Guess and print out a lexer name based solely on the given filename.   Does  not  take
              input or highlight anything.  If no specific lexer can be found, "text" is printed.

### -C     

### -H _
              Print  detailed  help  for  the  object  _<name>_ of type _<type>_, where _<type>_ is one of
              "lexer", "formatter" or "filter".

### -h     

### -V     

## SEE ALSO
       /usr/share/doc/python-pygments-doc/index.html

## AUTHOR
       pygmentize was written by Georg Brandl <<g.brandl@gmx.net>>.

       This manual page was written by Piotr Ozarowski <<ozarow@gmail.com>>, for  the  Debian  project
       (but may be used by others).

                                          January 20, 2021                             [_PYGMENTIZE_(1)](https://www.chedong.com/phpMan.php/man/PYGMENTIZE/1/markdown)
