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

NAME

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

SYNOPSIS

10       highlight  [acdefhiklnopqrstuvwzABCDEHIKLOPRSTXVWZ] [-i input file] [-o
11       output file] [-S syntax] [-O outdir] [-B wildcard]  [-H  language]  [-t
12       num]  [-c style_outfile] [-e style_infile] [-s style] [-D data dir] [-E
13       add. data dir] [-F format] [-u encoding] [input files]
14
15

DESCRIPTION

17       Highlight converts sourcecode to HTML, XHTML, RTF, LaTeX, TeX,  XML  or
18       ANSI escape sequences. There are 40 colour themes available.  Highlight
19       recognizes keywords, numbers, strings, comments, symbols and preproces‐
20       sor directives.  It supports Action Script, ADA 95, Agda, AMPL, Aspect,
21       Assembler, Amtrix, Avenue, (G)AWK, Bash, BlitzBasic, BMS, C,  C++,  C#,
22       ClearBasic,  Clipper, Cobol, CSS, DOS-Batch, Eiffel, Euphoria, Express,
23       Felix, Frink, Forth, Fortran, Haskell, HTML, HTTPD, IDL, INI, IO,  Jas‐
24       min, Java, JavaScript, JSP, LaTeX, LDIF, Lotus Script, Lua, Make, Maya,
25       Matlab, MaxScript, Modelica, Modula  3,  Nasal,  Nice,  Oberon,  Object
26       Script,  OCaml, Pascal, Paradox, PATROL, Perl, PHP, Pike, PL/1, PL/SQL,
27       POV Ray, Progress, Python, Relax NG,  Rexx,  Ruby,  Small,  SML,  Spin,
28       Sybase, Squirrel, SuperX++, VHDL, Visual Basic, XML and more.
29
30       It's  easily  possible  to  enhance highlight's database of programming
31       languages and colour themes.  See the README file for details.
32

General options

34       -B, --batch-recursive=<wildcard>
35              convert all files matching the wildcard (uses recursive search)
36
37       -D, --data-dir=<path>
38              set path to highlight data directory
39
40       -E, --add-data-dir=<path>
41              set path to an additional  data  directory,  which  is  searched
42              first
43
44       --add-config-dir=<path>
45              set path to an additional configuration directory
46
47       --help-lang=<lang>
48              print help in given language <lng>=[br, cz, en, es, de, fr]
49
50       -h, --help
51              print this help
52
53       -i, --input=<file>
54              name of input file
55
56       -o, --output=<file>
57              name of output file
58
59       -O, --outdir=<output directory>
60              name of output directory
61
62       -P, --progress
63              print progress bar in batch mode
64
65       -S, --syntax=<type>
66              define  type  of  source  code,  necessary  if input filename is
67              unknown
68
69       -v, --verbose
70              print debug info to stderr
71
72       -p, --list-langs
73              list installed language definitions
74
75       -q, --quiet
76              supress progress info in batch mode
77
78       -w, --list-themes
79              list installed themes
80
81       --force
82              generate output if language type is unknown
83
84       --print-config
85              print path configuration
86
87       --validate-input
88              test if input is a valid text file
89
90       --version
91              print version and copyright info
92
93

Output formats

95       -H, --html
96              generate HTML file (default)
97
98       -A, --ansi
99              generate terminal output (16 colours)
100
101       -L, --latex
102              generate LaTeX file
103
104       -M, --xterm256
105              generate terminal output (256 colours)
106
107       -R, --rtf
108              generate RTF file
109
110       -T, --tex
111              generate TeX file
112
113       -X, --xhtml
114              generate XHTML 1.1 file
115
116       -Z, --xml
117              generate XML file
118
119
120

Output formatting options

122       -c, --style-outfile=<file>
123              name of style definition file or output to stdout,  if  "stdout"
124              is given as file argument
125
126       -d, --doc-title
127              document title
128
129       -e, --style-infile=<file>
130              name of file to be included in style-outfile
131
132       -f, --fragment
133              omit header and footer of the output document
134
135       -F, --reformat=<style>
136              reformat  output  in given style.  <style>=[ansi, gnu, kr, java,
137              linux]
138
139       -I, --include-style
140              include style definition in output
141
142       -J, --line-length=<num>
143              line length before wrapping (see -W, -V)
144
145       -j, --line-number-length=<num>
146              line number length incl. left padding
147
148       -k, --font=<font>
149              defines font (specific to output format)
150
151       -K, --font-size=<num?>
152              defines font size (specific to output format)
153
154       -l, --linenumbers
155              print line numbers in output file
156
157       -m, --line-number-start=<cnt>
158              start line numbering with cnt (assumes -l)
159
160       -s, --style=<style name>
161              define highlighting style (see --list-themes)
162
163       -t  --replace-tabs=<num>
164              replace tabs by num spaces
165
166       -u, --encoding=<enc>
167              define output encoding which matches input file  encoding;  omit
168              encoding information if enc=NONE
169
170       -V, --wrap-simple
171              wrap long lines without indenting function parameters and state‐
172              ments
173
174       -W, --wrap
175              wrap long lines (use with caution)
176
177       -z, --zeroes
178              fill leading space of line numbers with zeroes
179
180       --kw-case=<upper|lower|capitalize>
181              output all keywords in given case if language is not case sensi‐
182              tive
183
184

(X)HTML OPTIONS

186       -a, --anchors
187              attach anchors to line numbers (HTML only)
188
189       -y, --anchor-prefix=<str>
190              define anchor name prefix
191
192       -N, --anchor-filename
193              use input file name as anchor name
194
195       -G, --class-name=<str>
196              define CSS class name prefix
197
198       -C, --print-index
199              print index file with links to all output files
200
201       --ordered-list
202              print lines as ordered list items (assumes -l)
203
204       --inline-css
205              output CSS within each tag (generates verbose output)
206
207       --mark-line='n[=txt]; m'
208              mark given lines n..m and add optional help texts as tooltips
209
210       --enclose-pre
211              enclose fragmented output with pre tag (assumes -f)
212
213

LaTeX OPTIONS

215       -b, --babel
216              disable Babel package shorthands
217
218       -r, --replace-quotes
219              replace double quotes by \dq (assumes -f is set)
220
221

RTF OPTIONS

223       -x, --page-size=<size>
224              define page size, <size>=[a3, a4, a5, b4, b5, b6, letter]
225
226
227       If  no in- or output files are specified, stdin and stdout will be used
228       for  in- or output.  -t will be ignored if -F is set.  -i and  -o  will
229       be ignored if -b or -B is set.  -c will be ignored if the output format
230       does not support referenced style files.  HTML will be generated, if no
231       other  output  format  is  given  Style definitions are stored in high‐
232       light.css (HTML, XHTML) or highlight.sty (LaTeX, TeX) if neither -c nor
233       -I is given.  Reformatting code will only work with C, C++, C# and java
234       input files.
235

BUGS

237       The converter is  not  able  to  recognize  mixed  code  like  PHP  and
238       JavaScript  in one file.  The wrapping options might cause faulty high‐
239       lighting of multi line comments.
240

FILES

242       The parsing information of  the  programming  languages  is  stored  in
243       /usr/share/highlight/langDefs/.   You  may  enhance highlight's parsing
244       capabilities by adding more *.lang - files to this directory.  You  can
245       also  define  other  directories  with -D, or add search paths with -E.
246       Documentation files are stored in /usr/share/doc/highlight/ ,  configu‐
247       ration files in /etc/highlight/.
248
249

Examples

251       Single file conversion:
252
253       highlight -o hello.html -i hello.c
254
255       highlight -o hello.html hello.c
256
257       highlight -o hello.html -S c < hello.c
258
259       highlight -S c < hello.c > hello.html
260
261       Note that a file highlight.css is created in the current directory.
262
263       Batch file processing:
264
265       highlight -X  -B '*.cpp' -O /home/you/html_code/
266
267       converts  all  *.cpp files in the current directory and its subdirecto‐
268       ries to xhtml files, and stores the output in /home/you/html_code.
269
270       highlight -L  * -O /home/you/latex_code/
271
272       converts all files to LaTeX, stored in /home/you/latex_code/.
273
274       Use --quiet to improve performance of  batch  file  processing  (recom‐
275       mended for usage in shell scripts).
276
277       Use  highlight  -A  <yourfile>  | less -R to display a source file in a
278       terminal.
279

AUTHORS

281       Andre Simon <andre.simon1@gmx.de>
282

SEE ALSO

284       README file and highlight  webpage  at  http://www.andre-simon.de/  and
285       http://wiki.andre-simon.de.
286
287
288
289Andre Simon                       2008-01-04                      highlight(1)
Impressum