summary refs log tree commit diff
path: root/bin/man1/hilex.1
blob: 80b3155b4f9ff9cb9e5724d045b2a64640e091d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
.Dd January 20, 2021
.Dt HILEX 1
.Os
.
.Sh NAME
.Nm hilex
.Nd syntax highlighter
.
.Sh SYNOPSIS
.Nm
.Op Fl t
.Op Fl f Ar format
.Op Fl l Ar lexer
.Op Fl n Ar name
.Op Fl o Ar opts
.Op Ar file
.
.Sh DESCRIPTION
The
.Nm
utility
syntax highlights
the contents of
.Ar file
or standard input
and formats it on standard output.
.
.Pp
The arguments are as follows:
.Bl -tag -width "-f format"
.It Fl f Ar format
Set the output format.
See
.Sx Output Formats .
The default format is
.Cm ansi .
.
.It Fl l Ar lexer
Set the input lexer.
See
.Sx Input Lexers .
The default input lexer is inferred from
.Ar name
or the first line of input.
.
.It Fl n Ar name
Set the name used to infer the input lexer.
The default is the final component of
.Ar file .
.
.It Fl o Ar opts
Set output format options.
.Ar opts
is a comma-separated list of options.
Options for each output format are documented in
.Sx Output Formats .
.
.It Fl t
Default to the
.Cm text
input lexer if one cannot be inferred.
.El
.
.Ss Output Formats
.Bl -tag -width Ds
.It Cm ansi
Output ANSI terminal control sequences.
If standard output is a terminal
and standard input is not being read,
output is piped to
.Ev PAGER
with
.Ev LESS=FRX
if it is not already set.
.
.It Cm html
Output HTML
.Sy span
elements
with the following classes:
.Pp
.Bl -hang -width "\&Op" -compact
.It Sy \&Op
operators
.It Sy \&Nu
numbers
.It Sy \&Ke
keywords
.It Sy \&Id
identifiers
.It Sy \&Ma
macros
.It Sy \&Co
comments
.It Sy \&St
strings
.It Sy \&Es
character escapes
.It Sy \&Fo
format strings
.It Sy \&Su
variable substitutions
.El
.Pp
The options are as follows:
.Bl -tag -width "title=..."
.It Cm document
Output an HTML document containing a
.Sy pre
element.
.It Cm inline
Output inline style attributes
rather than classes.
.It Cm pre
Wrap the output in a
.Sy pre
element with the class
.Sy hilex .
.It Cm style Ns = Ns Ar url
With
.Cm document ,
use the external stylesheet
.Ar url .
If unset,
default styles are included in a
.Sy style
element.
.It Cm tab Ns = Ns Ar n
With
.Cm document ,
.Cm inline
or
.Cm pre ,
set the
.Sy tab-size
property to
.Ar n .
.It Cm title Ns = Ns Ar ...
With
.Cm document ,
set the
.Sy title
element text.
The default title is the same as
.Ar name .
.El
.
.It Cm irc
Output IRC formatting codes.
The options are as follows:
.Bl -tag -width "monospace"
.It Cm monospace
Use the IRCCloud monospace formatting code.
.El
.El
.
.Ss Input Lexers
.Bl -tag -width Ds
.It Cm c
The C11 language,
with minimal support for
.Xr lex 1 ,
.Xr yacc 1
and Objective-C input.
Inferred for
.Pa *.[chlmy]
files.
.
.It Cm make
BSD
.Xr make 1 .
Inferred for
.Pa Makefile ,
.Pa *.mk
and
.Pa *.am
files.
.
.It Cm mdoc
The
.Xr mdoc 7
language.
Inferred for
.Pa *.[1-9]
files
and files starting with
.Dq .Dd .
.
.It Cm sh
POSIX
.Xr sh 1 .
Since lexical analysis of
the shell command language
is effectively impossible,
this is best-effort only.
Inferred for
.Pa *.sh ,
.Pa .profile ,
.Pa .shrc
files
and files starting with
.Dq #!/bin/sh .
.
.It Cm text
Plain text.
Inferred for
.Pa *.txt
files.
.El
.
.Sh ENVIRONMENT
.Bl -tag -width "PAGER"
.It Ev PAGER
The command to pipe ANSI output to
if standard output is a terminal.
The default is
.Ev PAGER=less .
.El