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, ODT, LaTeX, TeX,
15       BBCode, SVG, XTERM or ANSI escape sequences.  There are several  colour
16       themes  available.   Highlight  recognizes  keywords, numbers, strings,
17       comments, symbols and preprocessor directives.  It supports  about  160
18       programming 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       --plug-in-read
76              set input file for a plug-in (e.g. 'tags')
77
78       --print-config
79              print path configuration
80
81       --print-style
82              print stylesheet only (see --style-outfile)
83
84       --skip=<list>
85              ignore listed unknown file types (Example: --skip='bak;c~;h~')
86
87       --start-nested=<lang>
88              define nested language which starts input without opening delim‐
89              iter
90
91       --validate-input
92              test if input is a valid text file
93
94       --version
95              print version and copyright info
96
97

Output formatting options

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

(X)HTML OPTIONS

176       -a, --anchors
177              attach anchors to line numbers (HTML only)
178
179       -y, --anchor-prefix=<str>
180              set anchor name prefix
181
182       -N, --anchor-filename
183              use input file name as anchor name
184
185       -C, --print-index
186              print index file with links to all output files
187
188       -n, --ordered-list
189              print lines as ordered list items
190
191       --class-name=<str>
192              set CSS class name prefix; omit class name if set to "NONE"
193
194       --inline-css
195              output CSS within each tag (verbose output)
196
197       --enclose-pre
198              enclose fragmented output with pre tag (assumes -f)
199
200

LaTeX OPTIONS

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

RTF OPTIONS

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

SVG OPTIONS

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

GNU SOURCE-HIGHLIGHT COMPATIBILITY OPTIONS

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

BUGS

267       The wrapping options might cause faulty highlighting of multi line com‐
268       ments.
269

FILES

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

Examples

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

AUTHORS

310       Andre Simon <as@andre-simon.de>
311

SEE ALSO

313       README file and highlight webpage at http://www.andre-simon.de/.
314
315
316
317Andre Simon                       2012-10-03                      highlight(1)
Impressum