summary refs log tree commit diff
path: root/bin/hilex/hilex.1
blob: 2b789f6547c86b6cb06d77ec46f8e3dc4c157146 (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
.Dd December 29, 2020
.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 .
.
.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.
.
.It Cm html
Output HTML
.Sy <span>
elements
within a
.Sy <pre>
element.
Each element has the classes
.Sy hilex
and one of the following:
.Sy Operator ,
.Sy Number ,
.Sy Keyword ,
.Sy Identifier ,
.Sy IdentifierTag ,
.Sy Macro ,
.Sy Comment ,
.Sy String ,
.Sy StringEscape ,
.Sy StringFormat ,
.Sy Interpolation .
.
.Pp
The options are as follows:
.Bl -tag -width "title=..."
.It Cm anchor
Output identifier tags as anchor links.
.
.It Cm css Ns = Ns Ar url
With
.Cm document ,
output a
.Sy <link>
element for the external stylesheet
.Ar url .
If unset,
output default styles in a
.Sy <style>
element.
.
.It Cm document
Output an HTML document containing the
.Sy <pre>
element.
.
.It Cm inline
Output inline
.Sy style
attributes rather than classes.
.
.It Cm tab Ns = Ns Ar n
With
.Cm document
or
.Cm inline ,
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
The portable subset of
.Xr make 1 .
Inferred for
.Pa *.mk
and
.Pa Makefile
files.
.
.It Cm mdoc
The
.Xr mdoc 7
language.
Inferred for
.Pa *.[1-9]
files.
.
.It Cm text
Plain text.
Inferred for
.Pa *.txt
files.
.El