1PYGMENTIZE(1) General Commands Manual PYGMENTIZE(1)
2
3
4
6 pygmentize - highlights the input file
7
8
10 pygmentize [-l <lexer> | -g] [-F <filter>[:<options>]] [-f <formatter>]
11 [-O <options>] [-P <option=value>] [-o <outfile>] [<infile>]
12 pygmentize -S <style> -f <formatter> [-a <arg>] [-O <options>] [-P <op‐
13 tion=value>]
14 pygmentize -L [<which> ...]
15 pygmentize -N <filename>
16 pygmentize -C
17 pygmentize -H <type> <name>
18 pygmentize -h | -V
19
20
22 Pygments is a generic syntax highlighter for general use in all kinds
23 of software such as forum systems, wikis or other applications that
24 need to prettify source code.
25
26 Its highlights are:
27 * a wide range of common languages and markup formats is supported
28 * special attention is paid to details, increasing quality by a fair
29 amount
30 * support for new languages and formats are added easily
31 * a number of output formats, presently HTML, LaTeX and ANSI se‐
32 quences
33 * it is usable as a command-line tool and as a library
34 * ... and it highlights even Brainfuck!
35
36 pygmentize is a command that uses Pygments to highlight the input file
37 and write the result to <outfile>. If no <infile> is given, stdin is
38 used.
39
41 A summary of options is included below.
42
43 -l <lexer>
44 Set the lexer name. If not given, the lexer is guessed from the
45 extension of the input file name (this obviously doesn't work if
46 the input is stdin).
47
48 -g Attempt to guess the lexer from the file contents, or pass
49 through as plain text if this fails (this option works for high‐
50 lighting standard input).
51
52 -F <filter>[:<options>]
53 Add a filter to the token stream. You can give options in the
54 same way as for -O after a colon (note: there must not be spaces
55 around the colon). This option can be given multiple times.
56
57 -f <formatter>
58 Set the formatter name. If not given, it will be guessed from
59 the extension of the output file name. If no output file is
60 given, the terminal formatter will be used by default.
61
62 -o <outfile>
63 Set output file. If not given, stdout is used.
64
65 -O <options>
66 With this option, you can give the lexer and formatter a comma-
67 separated list of options, e.g. "-O bg=light,python=cool". Which
68 options are valid for which lexers and formatters can be found
69 in the documentation. This option can be given multiple times.
70
71 -P <option=value>
72 This option adds lexer and formatter options like the -O option,
73 but you can only give one option per -P. That way, the option
74 value may contain commas and equals signs, which it can't with
75 -O.
76
77 -S <style>
78 Print out style definitions for style <style> and for formatter
79 <formatter>. The meaning of the argument given by -a <arg> is
80 formatter dependent and can be found in the documentation.
81
82 -L [<which> ...]
83 List lexers, formatters, styles or filters. Set <which> to the
84 thing you want to list (e.g. "styles"), or omit it to list ev‐
85 erything.
86
87 -N <filename>
88 Guess and print out a lexer name based solely on the given file‐
89 name. Does not take input or highlight anything. If no spe‐
90 cific lexer can be found, "text" is printed.
91
92 -C Like -N, but guess a lexer based on content read from standard
93 input.
94
95 -H <type> <name>
96 Print detailed help for the object <name> of type <type>, where
97 <type> is one of "lexer", "formatter" or "filter".
98
99 -h Show help screen.
100
101 -V Show version of the Pygments package.
102
104 /usr/share/doc/python-pygments/index.html
105
107 pygmentize was written by Georg Brandl <g.brandl@gmx.net>.
108
109 This manual page was written by Piotr Ozarowski <ozarow@gmail.com>, for
110 the Debian project (but may be used by others).
111
112
113
114 January 20, 2021 PYGMENTIZE(1)