.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