1highlight(1)                  user documentation                  highlight(1)
2
3
4

NAME

6       Highlight - a universal sourcecode to formatted text converter
7
8

SYNOPSIS

10       highlight [OPTIONS]... [FILES]...
11
12

DESCRIPTION

14       Highlight  converts sourcecode to HTML, XHTML, RTF, LaTeX, TeX, BBCode,
15       SVG, XTERM or ANSI escape sequences.  There are several  colour  themes
16       available.   Highlight recognizes keywords, numbers, strings, comments,
17       symbols and preprocessor directives.  It supports about 160 programming
18       languages, which are defined in Lua scripts.
19
20
21       It's  easily  possible  to  enhance highlight's database of programming
22       languages and colour themes.  See the README file for details.
23

General options

25       -B, --batch-recursive=<wildcard>
26              convert all files matching the wildcard (uses recursive search)
27
28       -D, --data-dir=<path>
29              set path to highlight data directory
30
31       --add-config-dir=<path>
32              set path to an additional configuration directory
33
34       --config-file=<file>
35              set path to a lang or theme file
36
37       -h, --help
38              print this help
39
40       -i, --input=<file>
41              name of input file
42
43       -o, --output=<file>
44              name of output file
45
46       -d, --outdir=<output directory>
47              name of output directory
48
49       -P, --progress
50              print progress bar in batch mode
51
52       -S, --syntax=<type>
53              set type of source code, necessary if input file suffix is miss‐
54              ing
55
56       -v, --verbose
57              print debug info to stderr
58
59       -p, --list-langs
60              list installed language definitions
61
62       -q, --quiet
63              supress progress info in batch mode
64
65       -w, --list-themes
66              list installed themes
67
68       --force
69              generate output if input syntax is unknown
70
71       --plug-in=<script>
72              execute  Lua  plug-in  script;  repeat  option to apply multiple
73              plug-ins
74
75       --print-config
76              print path configuration
77
78       --print-style
79              print stylesheet only (see --style-outfile)
80
81       --skip=<list>
82              ignore listed unknown file types (Example: --skip='bak;c~;h~')
83
84       --start-nested=<lang>
85              define nested language which starts input without opening delim‐
86              iter
87
88       --validate-input
89              test if input is a valid text file
90
91       --version
92              print version and copyright info
93
94

Output formatting options

96       -O, --out-format=<format>
97              output  file  in given format <format>=[html, xhtml, latex, tex,
98              rtf, ansi, xterm256, bbcode, svg]
99
100       -c, --style-outfile=<file>
101              name of style definition file or output to stdout,  if  "stdout"
102              is given as file argument
103
104       -T, --doc-title
105              document title
106
107       -e, --style-infile=<file>
108              name of file to be included in style-outfile
109
110       -f, --fragment
111              omit header and footer of the output document
112
113       -F, --reformat=<style>
114              reformat  output  in given style.  <style>=[allman, banner, gnu,
115              java, kr, linux, stroustrup, whitesmith]
116
117       -I, --include-style
118              include style definition in output
119
120       -J, --line-length=<num>
121              line length before wrapping (see -W, -V)
122
123       -j, --line-number-length=<num>
124              line number length incl. left padding
125
126       -k, --font=<font>
127              set font (specific to output format)
128
129       -K, --font-size=<num?>
130              set font size (specific to output format)
131
132       -l, --line-numbers
133              print line numbers in output file
134
135       -m, --line-number-start=<cnt>
136              start line numbering with cnt (assumes -l)
137
138       -s, --style=<style name>
139              set highlighting style (see --list-themes)
140
141       -t  --replace-tabs=<num>
142              replace tabs by num spaces
143
144       -u, --encoding=<enc>
145              set output encoding which  matches  input  file  encoding;  omit
146              encoding information if enc is "NONE"
147
148       -V, --wrap-simple
149              wrap long lines without indenting function parameters and state‐
150              ments
151
152       -W, --wrap
153              wrap long lines (use with caution)
154
155       -z, --zeroes
156              fill leading space of line numbers with zeroes
157
158       --kw-case=<upper|lower|capitalize>
159              output all keywords in given case if language is not case sensi‐
160              tive
161
162       --delim-cr
163              set CR as end-of-line delimiter (MacOS 9)
164
165       --no-trailing-nl
166              omit trailing newline
167
168

(X)HTML OPTIONS

170       -a, --anchors
171              attach anchors to line numbers (HTML only)
172
173       -y, --anchor-prefix=<str>
174              set anchor name prefix
175
176       -N, --anchor-filename
177              use input file name as anchor name
178
179       -C, --print-index
180              print index file with links to all output files
181
182       -n, --ordered-list
183              print lines as ordered list items
184
185       --class-name=<str>
186              set CSS class name prefix
187
188       --inline-css
189              output CSS within each tag (verbose output)
190
191       --enclose-pre
192              enclose fragmented output with pre tag (assumes -f)
193
194       --ctags-file[=<file>]
195              read ctags file to include meta information as tooltips (default
196              value: tags)
197
198

LaTeX OPTIONS

200       -b, --babel
201              disable Babel package shorthands
202
203       -r, --replace-quotes
204              replace double quotes by \dq
205
206       --pretty-symbols
207              improve appearance of brackets and other symbols
208
209

RTF OPTIONS

211       -x, --page-size=<size>
212              set page size, <size>=[a3, a4, a5, b4, b5, b6, letter]
213
214       --char-styles
215              include character stylesheets
216
217

SVG OPTIONS

219       --height=<h>
220              set image height (units allowed)
221
222       --width=<w>
223              set image size (see --height)
224
225

GNU SOURCE-HIGHLIGHT COMPATIBILITY OPTIONS

227       --doc  create stand alone document
228
229       --no-doc
230              cancel the --doc option
231
232       --css=filename
233              the external style sheet filename
234
235       --src-lang=STRING
236              source language
237
238        -t, --tab=INT
239              specify tab length
240
241        -n, --line-number[=0]
242              number all output lines, optional padding
243
244       --line-number-ref[=p]
245              number all output lines and generate  an  anchor,  made  of  the
246              specified prefix
247               p + the line number  (default='line')
248
249       --output-dir=path
250               output directory
251
252       --failsafe
253              if  no  language definition is found for the input, it is simply
254              copied to the output
255
256
257       If no in- or output files are specified, stdin and stdout will be  used
258       for  in- or output.  HTML will be generated unless an other output for‐
259       mat is given.  Style definitions are  stored  in  highlight.css  (HTML,
260       XHTML,  SVG)  or  highlight.sty  (LaTeX,  TeX)  if neither -c nor -I is
261       given.  Reformatting code (-F)  will only work with C, C++, C# and Java
262       input files.
263

BUGS

265       The wrapping options might cause faulty highlighting of multi line com‐
266       ments.
267

FILES

269       The parsing information of  the  programming  languages  is  stored  in
270       /usr/share/highlight/langDefs/.   You  may  enhance highlight's parsing
271       capabilities by adding more *.lang - files to this directory.  You  can
272       also define other directories with --data-dir.  Documentation files are
273       stored in /usr/share/doc/highlight/ , configuration files in /etc/high‐
274       light/.
275
276

Examples

278       Single file conversion:
279
280       highlight -o hello.html -i hello.c
281
282       highlight -o hello.html hello.c
283
284       highlight -o hello.html -S c < hello.c
285
286       highlight -S c < hello.c > hello.html
287
288       Note that a file highlight.css is created in the current directory.
289
290       Batch file processing:
291
292       highlight --out-format=xhtml  -B '*.cpp' -d /home/you/html_code/
293
294       converts  all  *.cpp files in the current directory and its subdirecto‐
295       ries to xhtml files, and stores the output in /home/you/html_code.
296
297       highlight --out-format=latex  * -d /home/you/latex_code/
298
299       converts all files to LaTeX, stored in /home/you/latex_code/.
300
301       Use --quiet to improve performance of  batch  file  processing  (recom‐
302       mended for usage in shell scripts).
303
304       Use  highlight  --out-format=xterm256 <yourfile> | less -R to display a
305       source file in a terminal.
306

AUTHORS

308       Andre Simon <as@andre-simon.de>
309

SEE ALSO

311       README file and highlight webpage at http://www.andre-simon.de/.
312
313
314
315Andre Simon                       2010-05-28                      highlight(1)
Impressum