1highlight(1) user documentation highlight(1)
2
3
4
6 Highlight - a universal sourcecode to formatted text converter
7
8
10 highlight [OPTIONS]... [FILES]...
11
12
14 Highlight converts sourcecode to HTML, XHTML, RTF, ODT, LaTeX, TeX,
15 BBCode, Pango markup, SVG, XTERM or ANSI escape sequences. There are
16 several colour themes available. Highlight recognizes keywords, num‐
17 bers, strings, comments, symbols and preprocessor directives. It sup‐
18 ports about 180 programming languages, which are defined in Lua
19 scripts.
20
21
22 It's easily possible to enhance highlight's database of programming
23 languages and colour themes. See the README file for details.
24
26 -B, --batch-recursive=<wildcard>
27 convert all files matching the wildcard (uses recursive search)
28
29 -D, --data-dir=<path>
30 set path to highlight data directory
31
32 --config-file=<file>
33 set path to a lang or theme file
34
35 -h, --help
36 print this help
37
38 -i, --input=<file>
39 name of input file
40
41 -o, --output=<file>
42 name of output file
43
44 -d, --outdir=<output directory>
45 name of output directory
46
47 -P, --progress
48 print progress bar in batch mode
49
50 -S, --syntax=<type>
51 set type of source code, necessary if input file suffix is miss‐
52 ing
53
54 -v, --verbose
55 print debug info to stderr
56
57 -q, --quiet
58 supress progress info in batch mode
59
60 --force
61 generate output if input syntax is unknown
62
63 --list-scripts=<type>
64 list installed scripts <type> = [langs, themes, plugins]
65
66 --plug-in=<script>
67 execute Lua plug-in script; repeat option to apply multiple
68 plug-ins
69
70 --plug-in-param
71 set plug-in input parameter. This might be an input file name
72 (ie. 'tags').
73
74 --print-config
75 print path configuration
76
77 --print-style
78 print stylesheet only (see --style-outfile)
79
80 --skip=<list>
81 ignore listed unknown file types (Example: --skip='bak;c~;h~')
82
83 --start-nested=<lang>
84 define nested language which starts input without opening delim‐
85 iter
86
87 --stdout
88 output to stdout (batch mode, --print-style)
89
90 --validate-input
91 test if input is a valid text file
92
93 --version
94 print version and copyright info
95
96
98 -O, --out-format=<format>
99 output file in given format <format>=[html, xhtml, latex, tex,
100 rtf, odt, ansi, xterm256, truecolor, bbcode, pango, svg]
101
102 -c, --style-outfile=<file>
103 name of style definition file
104
105 -T, --doc-title
106 document title
107
108 -e, --style-infile=<file>
109 name of file to be included in style-outfile
110
111 -f, --fragment
112 omit header and footer of the output document (see --keep-injec‐
113 tions)
114
115 -F, --reformat=<style>
116 reformat output in given style. <style>=[allman, gnu, google,
117 horstmann, java, kr, linux, lisp, mozilla, otbs, pico, vtk,
118 ratliff, 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 -V, -W)
125
126 -j, --line-number-length=<num>
127 line number length incl. left padding. Default length: 5
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 (theme)
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 lines after 80 (default) characters without indenting func‐
153 tion parameters and statements.
154
155 -W, --wrap
156 wrap lines after 80 (default) characters (use with caution).
157
158 -z, --zeroes
159 fill leading space of line numbers with zeroes
160
161 --delim-cr
162 set CR as end-of-line delimiter (MacOS 9)
163
164 --keep-injections
165 output plug-in header and footer injections in spite of -f
166
167 --kw-case=<upper|lower|capitalize>
168 output all keywords in given case if language is not case sensi‐
169 tive
170
171 --no-trailing-nl
172 omit trailing newline
173
174 --no-version-info
175 omit version info comment
176
177 --wrap-no-numbers
178 omit line numbers of wrapped lines (assumes -l)
179
180
182 -a, --anchors
183 attach anchors to line numbers (HTML only)
184
185 -y, --anchor-prefix=<str>
186 set anchor name prefix
187
188 -N, --anchor-filename
189 use input file name as anchor name
190
191 -C, --print-index
192 print index file with links to all output files
193
194 -n, --ordered-list
195 print lines as ordered list items
196
197 --class-name=<str>
198 set CSS class name prefix; omit class name if set to "NONE"
199
200 --inline-css
201 output CSS within each tag (verbose output)
202
203 --enclose-pre
204 enclose fragmented output with pre tag (assumes -f)
205
206
208 -b, --babel
209 disable Babel package shorthands
210
211 -r, --replace-quotes
212 replace double quotes by \dq
213
214 --beamer
215 adapt output for the Beamer package
216
217 --pretty-symbols
218 improve appearance of brackets and other symbols
219
220
222 --page-color
223 include page color attributes
224
225 -x, --page-size=<size>
226 set page size, <size>=[a3, a4, a5, b4, b5, b6, letter]
227
228 --char-styles
229 include character stylesheets
230
231
233 --height=<h>
234 set image height (units allowed)
235
236 --width=<w>
237 set image size (see --height)
238
239
241 --canvas[=width]
242 set background colour padding (default: 80)
243
244
246 --doc create stand alone document
247
248 --no-doc
249 cancel the --doc option
250
251 --css=filename
252 the external style sheet filename
253
254 --src-lang=STRING
255 source language
256
257 -t, --tab=INT
258 specify tab length
259
260 -n, --line-number[=0]
261 number all output lines, optional padding
262
263 --line-number-ref[=p]
264 number all output lines and generate an anchor, made of the
265 specified prefix
266 p + the line number (default='line')
267
268 --output-dir=path
269 output directory
270
271 --failsafe
272 if no language definition is found for the input, it is simply
273 copied to the output
274
275
277 Highlight recognizes these variables:
278
279 HIGHLIGHT_DATADIR
280 sets the path to highlight's configuration scripts
281
282 HIGHLIGHT_OPTIONS
283 may contain command line options, but no input file paths.
284
285
287 If no in- or output files are specified, stdin and stdout will be used
288 for in- or output. HTML will be generated unless an other output for‐
289 mat is given. Style definitions are stored in highlight.css (HTML,
290 XHTML, SVG) or highlight.sty (LaTeX, TeX) if neither -c nor -I is
291 given. Reformatting code (-F) will only work with C, C++, C# and Java
292 input files.
293
295 The wrapping options might cause faulty highlighting of long single
296 line comments.
297
299 The configuration files are stored in /usr/share/highlight/. Language
300 definitions, themes and plugins are located in subdirectories.
301
302 Documentation files are stored in /usr/share/doc/highlight/ , configu‐
303 ration files in /etc/highlight/.
304
305 See README how to install own scripts in the home directory.
306
308 Single file conversion:
309
310 highlight -o hello.html -i hello.c
311
312 highlight -o hello.html hello.c
313
314 highlight -o hello.html -S c < hello.c
315
316 highlight -S c < hello.c > hello.html
317
318 Note that a file highlight.css is created in the current directory.
319
320 Batch file processing:
321
322 highlight --out-format=xhtml -B '*.cpp' -d /home/you/html_code/
323
324 converts all *.cpp files in the current directory and its subdirecto‐
325 ries to xhtml files, and stores the output in /home/you/html_code.
326
327 highlight --out-format=latex * -d /home/you/latex_code/
328
329 converts all files to LaTeX, stored in /home/you/latex_code/.
330
331 Use --quiet to improve performance of batch file processing (recom‐
332 mended for usage in shell scripts).
333
334 Use highlight --out-format=xterm256 <yourfile> | less -R to display a
335 source file in a terminal.
336
337 Run highlight --list-scripts=langs to see all supported syntax types.
338
339
341 Andre Simon <as@andre-simon.de>
342
344 README file and highlight webpage at http://www.andre-simon.de/.
345
346
347
348Andre Simon 2018-01-08 highlight(1)