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, 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

GENERAL OPTIONS

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[=topic]
36               print this help or a topic description
37               <topic> = [syntax, theme, plugin, config]
38
39       -i, --input=<file>
40              name of input file
41
42       -o, --output=<file>
43              name of output file
44
45       -d, --outdir=<output directory>
46              name of output directory
47
48       -P, --progress
49              print progress bar in batch mode
50
51       -S, --syntax=<type>
52              set type of source code, necessary if input file suffix is miss‐
53              ing
54
55       --syntax-by-name=<name>
56              specify type of source code by given name.  Will not read a file
57              of  this  name,  useful for stdin and to determine the syntax of
58              the file before piping its content  to  highlight.  This  option
59              overrides --syntax.
60
61       -v, --verbose
62              print debug info to stderr
63
64       -q, --quiet
65              suppress progress info in batch mode
66
67       --force
68              generate output if input syntax is unknown
69
70       --list-scripts=<type>
71              list installed scripts <type> = [langs, themes, plugins]
72
73       --list-cat=<categories>
74              filter  the  scripts  by  the given categories (example: --list-
75              cat='source;script' )
76
77       --plug-in=<script>
78              execute Lua plug-in script;  repeat  option  to  apply  multiple
79              plug-ins
80
81       --plug-in-param
82              set  plug-in  input  parameter. This might be an input file name
83              (ie. 'tags').
84
85       --print-config
86              print path configuration
87
88       --print-style
89              print stylesheet only (see --style-outfile)
90
91       --skip=<list>
92              ignore listed unknown file types (example: --skip='bak;c~;h~')
93
94       --start-nested=<lang>
95              define nested language which starts input without opening delim‐
96              iter
97
98       --stdout
99              output to stdout (batch mode, --print-style)
100
101       --validate-input
102              test if input is a valid text file
103
104       --version
105              print version and copyright info
106
107

OUTPUT FORMATTING OPTIONS

109       -O, --out-format=<format>
110              output  file  in given format <format>=[html, xhtml, latex, tex,
111              rtf, odt, ansi, xterm256, truecolor, bbcode, pango, svg]
112
113       -c, --style-outfile=<file>
114              name of style definition file
115
116       -T, --doc-title
117              document title
118
119       -e, --style-infile=<file>
120              name of file to be included in style-outfile
121
122       -f, --fragment
123              omit header and footer of the output document (see --keep-injec‐
124              tions)
125
126       -F, --reformat=<style>
127              reformat  output  in given style.  <style>=[allman, gnu, google,
128              horstmann, java, kr, linux,  lisp,  mozilla,  otbs,  pico,  vtk,
129              ratliff, stroustrup, webkit, whitesmith, user]
130
131              The  user style does not apply a predefined scheme. Use --refor‐
132              mat-option to define reformatting behaviour.
133
134       --reformat-option=<opt>
135              apply an astyle cmd line option (assumes -F). Can be repeated to
136              override settings of the chosen indentation scheme.
137
138       -I, --include-style
139              include style definition in output
140
141       -J, --line-length=<num>
142              line length before wrapping (see -V, -W)
143
144       -j, --line-number-length=<num>
145              line number length incl. left padding. Default length: 5
146
147       -k, --font=<font>
148              set font (specific to output format)
149
150       -K, --font-size=<num?>
151              set font size (specific to output format)
152
153       -l, --line-numbers
154              print line numbers in output file
155
156       -m, --line-number-start=<cnt>
157              start line numbering with cnt (assumes -l)
158
159       --line-range=<start-end>
160              output only lines from number <start> to <end>
161
162       -s, --style=<style name>
163              set highlighting style (theme). See --base16.
164
165       -t  --replace-tabs=<num>
166              replace tabs by num spaces
167
168       -u, --encoding=<enc>
169              set  output  encoding  which  matches  input file encoding; omit
170              encoding information if set to "NONE"
171
172       -V, --wrap-simple
173              wrap lines after 80 (default) characters without indenting func‐
174              tion parameters and statements.
175
176       -W, --wrap
177              wrap lines after 80 (default) characters (use with caution).
178
179       -z, --zeroes
180              fill leading space of line numbers with zeroes
181
182       --base16
183              use a theme of the Base16 collection. Use a classic theme other‐
184              wise.
185
186       --delim-cr
187              set CR as end-of-line delimiter (MacOS 9)
188
189       --keep-injections
190              output plug-in header and footer injections in spite of -f
191
192       --kw-case=<upper|lower|capitalize>
193              output all keywords in given case if language is not case sensi‐
194              tive
195
196       --no-trailing-nl
197              omit trailing newline
198
199       --no-version-info
200              omit version info comment
201
202       --wrap-no-numbers
203              omit line numbers of wrapped lines (assumes -l)
204
205

(X)HTML OPTIONS

207       -a, --anchors
208              attach anchors to line numbers (HTML only)
209
210       -y, --anchor-prefix=<str>
211              set anchor name prefix
212
213       -N, --anchor-filename
214              use input file name as anchor name
215
216       -C, --print-index
217              print index file with links to all output files
218
219       -n, --ordered-list
220              print lines as ordered list items
221
222       --class-name=<str>
223              set CSS class name prefix; omit class name if set to "NONE"
224
225       --inline-css
226              output CSS within each tag (verbose output)
227
228       --enclose-pre
229              enclose fragmented output with pre tag (assumes -f)
230
231

LATEX OPTIONS

233       -b, --babel
234              disable Babel package shorthands
235
236       -r, --replace-quotes
237              replace double quotes by \dq
238
239       --beamer
240              adapt output for the Beamer package
241
242       --pretty-symbols
243              improve appearance of brackets and other symbols
244
245

RTF OPTIONS

247       --page-color
248              include page color attributes
249
250       -x, --page-size=<size>
251              set page size, <size>=[a3, a4, a5, b4, b5, b6, letter]
252
253       --char-styles
254              include character stylesheets
255
256

SVG OPTIONS

258       --height=<h>
259              set image height (units allowed)
260
261       --width=<w>
262              set image size (see --height)
263
264

TERMINAL ESCAPE OUTPUT OPTIONS (XTERM256 OR TRUECOLOR)

266       --canvas[=width]
267              set background colour padding (default: 80)
268
269

GNU SOURCE-HIGHLIGHT COMPATIBILITY OPTIONS

271       --doc  create stand alone document
272
273       --no-doc
274              cancel the --doc option
275
276       --css=filename
277              the external style sheet filename
278
279       --src-lang=STRING
280              source language
281
282        -t, --tab=INT
283              specify tab length
284
285        -n, --line-number[=0]
286              number all output lines, optional padding
287
288       --line-number-ref[=p]
289              number  all  output  lines  and  generate an anchor, made of the
290              specified prefix
291               p + the line number  (default='line')
292
293       --output-dir=path
294               output directory
295
296       --failsafe
297              if no language definition is found for the input, it  is  simply
298              copied to the output
299
300

ENV VARIABLES

302       Highlight recognizes these variables:
303
304       HIGHLIGHT_DATADIR
305              sets the path to highlight's configuration scripts
306
307       HIGHLIGHT_OPTIONS
308              may contain command line options, but no input file paths.
309
310

HINTS

312       If  no in- or output files are specified, stdin and stdout will be used
313       for  in- or output.  Since version 3.44, reading from stdin can also be
314       triggered by the '-' option.
315
316       Default  output format: xterm256 or truecolor if appropriate, HTML oth‐
317       erwise.
318
319       Style definitions are stored in highlight.css  (HTML,  XHTML,  SVG)  or
320       highlight.sty (LaTeX, TeX) if neither -c nor -I is given. For CSS, def‐
321       initions are stored in the output document header with  -I,  if  -f  is
322       also given there will be no style definitions.
323
324       Reformatting  code  (-F)  will only work with C, C++, C# and Java input
325       files.
326

BUGS

328       Wrapping lines with -V or -W will cause  faulty  highlighting  of  long
329       single  line comments and directives.  Using line-range might interfere
330       with multi line syntax elements. Use with caution.
331

FILES

333       The configuration files are stored in /usr/share/highlight/.   Language
334       definitions, themes and plugins are located in subdirectories.
335
336       Documentation  files are stored in /usr/share/doc/highlight/ , configu‐
337       ration files in /etc/highlight/.
338
339       See README how to install own scripts in the home directory.
340

EXAMPLES

342       Single file conversion:
343
344       highlight -o hello.html -i hello.c
345
346       highlight -o hello.html hello.c
347
348       highlight -o hello.html -S c < hello.c
349
350       highlight -S c < hello.c > hello.html
351
352       Note that a file highlight.css is created in the current directory.
353
354       Batch file processing:
355
356       highlight --out-format=xhtml  -B '*.cpp' -d /home/you/html_code/
357
358       converts all *.cpp files in the current directory and  its  subdirecto‐
359       ries to xhtml files, and stores the output in /home/you/html_code.
360
361       highlight --out-format=latex  * -d /home/you/latex_code/
362
363       converts all files to LaTeX, stored in /home/you/latex_code/.
364
365       Use  --quiet  to  improve  performance of batch file processing (recom‐
366       mended for usage in shell scripts).
367
368       Use highlight --out-format=xterm256 <yourfile> | less -R to  display  a
369       source file in a terminal.
370
371       Run highlight --list-scripts=langs to see all supported syntax types.
372
373

AUTHORS

375       Andre Simon <as@andre-simon.de>
376

SEE ALSO

378       README file and highlight webpage at http://www.andre-simon.de/.
379
380
381
382Andre Simon                       2019-03-11                      highlight(1)
Impressum