-
Notifications
You must be signed in to change notification settings - Fork 16
/
ronn.1
232 lines (230 loc) · 12.3 KB
/
ronn.1
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
.\" generated with Ronn-NG/v0.10.2
.\" http://github.com/apjanke/ronn-ng/tree/0.10.2.wip
.TH "RONN" "1" "January 2024" "Ronn-NG 0.10.2.wip" "Ronn Manual"
.SH "NAME"
\fBronn\fR \- convert markdown files to manpages
.SH "SYNOPSIS"
\fBronn\fR [\fIformat\fR\|\.\|\.\|\.] \fIfile\fR\|\.\|\.\|\.
.br
\fBronn\fR \fB\-m\fR|\fB\-\-man\fR \fIfile\fR\|\.\|\.\|\.
.br
\fBronn\fR \fB\-S\fR|\fB\-\-server\fR \fIfile\fR\|\.\|\.\|\.
.br
\fBronn\fR \fB\-\-pipe\fR \fIfile\fR
.br
\fBronn\fR < \fIfile\fR
.br
\fBronn\fR \fB\-E\fR|\fB\-\-encoding\fR \fIencoding\fR \|\.\|\.\|\.
.SH "DESCRIPTION"
\fBRonn\fR converts textfiles to standard roff\-formatted Unix manpages or HTML\. ronn\-format(7) is based on markdown(7) but includes additional rules and syntax geared toward authoring manuals\.
.P
In its default mode, \fBronn\fR converts one or more input \fIfile\fRs to HTML or roff output files\. The \fB\-\-roff\fR, \fB\-\-html\fR, and \fB\-\-fragment\fR options dictate which output files are generated\. Multiple format arguments may be specified to generate multiple output files\. Output files are named after and written to the same directory as input \fIfile\fRs\.
.P
The \fB\-\-server\fR and \fB\-\-man\fR options change the output behavior from file generation to serving dynamically generated HTML manpages or viewing \fIfile\fR as with man(1)\.
.P
With no \fIfile\fR arguments, \fBronn\fR acts as simple filter\. Ronn source text is read from standard input and roff output is written to standard output\. Use the \fB\-\-html\fR, \fB\-\-roff\fR, and/or \fB\-\-fragment\fR options to select the output format\.
.SH "FILES"
The \fBronn\fR command expects input to be valid ronn\-format(7) text\. Source files are typically named \fIname\fR\.\fIsection\fR\.ronn (e\.g\., \fBexample\.1\.ronn\fR)\. The \fIname\fR and \fIsection\fR should match the name and section defined in the \fIfile\fR's heading\.
.P
Source files must be in UTF\-8 encoding, or the encoding specified by the \fB\-E\fR/\fB\-\-encoding\fR option, regardless of the locale that \fBronn\fR is running under\.
.P
When building roff or HTML output files, destination filenames are determined by taking the basename of the input \fIfile\fR and adding the appropriate file extension (or removing the file extension in the case of roff output)\. For example, executing \fBronn example\.1\.ronn\fR generates \fBexample\.1\fR with roff output and \fBexample\.1\.html\fR with HTML output\.
.SH "OPTIONS"
These options control whether output is written to file(s), standard output, or directly to a man pager\.
.TP
\fB\-m\fR, \fB\-\-man\fR
Don't generate files, display \fIfile\fRs as if man(1) were invoked on the roff output file\. This simulates default man behavior by piping the roff output through groff(1) and the paging program specified by the \fBMANPAGER\fR environment variable\.
.TP
\fB\-S\fR, \fB\-\-server\fR
Don't generate files, start an HTTP server at \fIhttp://localhost:1207/\fR and serve dynamically generated HTML for the set of input \fIfile\fRs\. A file named \fIexample\.2\.ronn\fR is served as \fI/example\.2\.html\fR\. There's also an index page at the root with links to each \fIfile\fR\.
.IP
The server respects the \fB\-\-style\fR and document attribute options (\fB\-\-manual\fR, \fB\-\-date\fR, etc\.)\. These same options can be varied at request time by giving them as query parameters: \fB?manual=FOO&style=dark,toc\fR
.IP
\fINOTE: The builtin server is designed to assist in the process of writing and styling manuals\. It is in no way recommended as a general purpose web server\.\fR
.TP
\fB\-\-port\fR=\fIport\fR
When used with \fB\-S\fR/\fB\-\-server\fR, runs the server at the specified port instead of the default port 1207\.
.TP
\fB\-\-pipe\fR
Don't generate files, write generated output to standard output\. This is the default behavior when ronn source text is piped in on standard input and no \fIfile\fR arguments are provided\.
.TP
\fB\-o\fR=\fIdirectory\fR, \fB\-\-output\-dir\fR=\fIdirectory\fR
Write generated files to the specified directory instead of the default location\.
.TP
\fB\-E\fR=\fIencoding\fR, \fB\-\-encoding\fR=\fIencoding\fR
Specify the encoding that input files are in\. Default is UTF\-8, regardless of user's locale settings\. Input sent to STDIN is always treated as UTF\-8, regardless of whether \fB\-E\fR is passed\.
.P
Format options control the files \fBronn\fR generates, or the output format when the \fB\-\-pipe\fR argument is specified\. When no format options are given, both \fB\-\-roff\fR and \fB\-\-html\fR are assumed\.
.TP
\fB\-r\fR, \fB\-\-roff\fR
Generate roff output\. This is the default behavior when no \fIfile\fRs are given and ronn source text is read from standard input\.
.TP
\fB\-5\fR, \fB\-\-html\fR
Generate output in HTML format\.
.TP
\fB\-f\fR, \fB\-\-fragment\fR
Generate output in HTML format but only the document fragment, not the header, title, or footer\.
.P
Document attributes displayed in the header and footer areas of generated content are specified with these options\. (These values may also be set via the \fIENVIRONMENT\fR\.)
.TP
\fB\-\-manual\fR=\fImanual\fR
The name of the manual this man page belongs to; \fImanual\fR is prominently displayed top\-center in the header area\.
.TP
\fB\-\-organization\fR=\fIname\fR
The name of the group, organization, or individual responsible for publishing the document; \fIname\fR is displayed in the bottom\-left footer area\.
.TP
\fB\-\-date\fR=\fIdate\fR
The document's published date; \fIdate\fR must be formatted \fBYYYY\-MM\-DD\fR and is displayed in the bottom\-center footer area\. The \fIfile\fR mtime is used when no \fIdate\fR is given, or the current time when no \fIfile\fR is available\.
.P
HTML output can be customized through the use of CSS stylesheets:
.TP
\fB\-\-style\fR=\fImodule\fR[,\fImodule\fR]\|\.\|\.\|\.
The list of CSS stylesheets to apply to the document\. Multiple \fImodule\fR arguments may be specified, but must be separated by commas or spaces\.
.IP
When \fImodule\fR is a simple word, search for files named \fImodule\fR\fB\.css\fR in all directories listed in the \fI\fBRONN_STYLE\fR\fR environment variable, and then search internal styles\.
.IP
When \fImodule\fR includes a \fI/\fR character, use it as the full path to a stylesheet file\.
.IP
Internal styles are \fIman\fR (included by default), \fItoc\fR, and \fI80c\fR\. See \fISTYLES\fR for descriptions of features added by each module\.
.P
Miscellaneous options:
.TP
\fB\-w\fR, \fB\-\-warnings\fR
Show troff warnings on standard error when performing roff conversion\. Warnings are most often the result of a bug in ronn's HTML to roff conversion logic\.
.TP
\fB\-W\fR
Disable troff warnings\. Warnings are disabled by default\. This option can be used to revert the effect of a previous \fB\-w\fR argument\.
.TP
\fB\-v\fR, \fB\-\-version\fR
Show ronn version and exit\.
.SH "LINK INDEXES"
When generating HTML output, \fBronn\fR hyperlinks manual references (like \fBgrep(1)\fR, \fBls(1)\fR, \fBmarkdown(7)\fR) in source text based on reference name to URL mappings defined in an \fBindex\.txt\fR file\. Each line of the index file describes a single reference link, with whitespace separating the reference's \fIid\fR from its \fIlocation\fR\. Blank lines are allowed; lines beginning with a \fB#\fR character are ignored:
.IP "" 4
.nf
# manuals included in this project:
whisky(1) whisky\.1\.ronn
tango(5) tango\.5\.ronn
# external manuals
grep(1) https://man7\.org/linux/man\-pages/man1/grep\.1\.html
ls(1) https://man7\.org/linux/man\-pages/man1/ls\.1\.html
# other URLs for use with markdown reference links
src https://github\.com/
.fi
.IP "" 0
.P
The \fIlocation\fR is an absolute or relative URL that usually points at an HTML version of manpage\. It's possible to define references for things that aren't manpages\.
.P
All manuals in an individual directory share the references defined in that directory's \fBindex\.txt\fR file\. Index references may be used explicitly in Markdown reference style links using the syntax: \fB[\fR\fItext\fR\fB][\fR\fIid\fR\fB]\fR, where \fItext\fR is the link text and \fIid\fR is a reference name defined in the index\.
.SH "STYLES"
The \fB\-\-style\fR option selects a list of CSS stylesheets to include in the generated HTML\. Styles are applied in the order defined, so each can use the cascade to override previously defined styles\.
.SS "Builtin Stylesheets"
These styles are included with the distribution:
.TP
\fBman\fR
Basic manpage styles: typography, definition lists, indentation\. This is always included regardless of \fB\-\-style\fR argument\. It is however possible to replace the default \fBman\fR module with a custom one by placing a \fBman\.css\fR file on the \fBRONN_STYLE\fR path\.
.TP
\fBprint\fR
Basic print stylesheet\. The generated \fB<style>\fR tag includes a \fBmedia=print\fR attribute\.
.TP
\fBtoc\fR
Enables the Table of Contents navigation\. The TOC markup is included in generated HTML by default but hidden with an inline \fBdisplay:none\fR style rule; the \fBtoc\fR module turns it on and applies basic TOC styles\.
.TP
\fBdark\fR
Light text on a dark background\.
.TP
\fB80c\fR
Changes the display width to mimic the display of a classic 80 character terminal\. The default display width causes lines to wrap at a gratuitous 100 characters\.
.SS "Custom Stylesheets"
Writing custom stylesheets is straight\-forward\. The following core selectors allow targeting all generated elements:
.TP
\fB\.mp\fR
The manual page container element\. Present on full documents and document fragments\.
.TP
\fBbody#manpage\fR
Signifies that the page was fully\-generated by Ronn and contains a single manual page (\fB\.mp\fR element)\.
.TP
\fB\.man\-decor\fR
The three\-item heading and footing elements both have this class\.
.TP
\fB\.man\-head\fR, \fB\.man\-foot\fR
The heading and footing, respectively\.
.TP
\fB\.man\-title\fR
The main \fB<h1>\fR element\. Hidden by default unless the manual has no \fIname\fR or \fIsection\fR attributes\.
.P
See the builtin style sources \fIhttps://github\.com/apjanke/ronn\-ng/tree/main/lib/ronn/template\fR for examples\.
.SH "EXAMPLES"
Build roff and HTML output files and view the roff manpage using man(1):
.IP "" 4
.nf
$ ronn some\-great\-program\.1\.ronn
roff: some\-great\-program\.1
html: some\-great\-program\.1\.html
$ man \./some\-great\-program\.1
.fi
.IP "" 0
.P
Build only the roff manpage for all \fB\.ronn\fR files in the current directory:
.IP "" 4
.nf
$ ronn \-\-roff *\.ronn
roff: mv\.1
roff: ls\.1
roff: cd\.1
roff: sh\.1
.fi
.IP "" 0
.P
Build only the HTML manpage for a few files and apply the \fBdark\fR and \fBtoc\fR stylesheets:
.IP "" 4
.nf
$ ronn \-\-html \-\-style=dark,toc mv\.1\.ronn ls\.1\.ronn
html: mv\.1\.html
html: ls\.1\.html
.fi
.IP "" 0
.P
Generate roff output on standard output and write to file:
.IP "" 4
.nf
$ ronn <hello\.1\.ronn >hello\.1
.fi
.IP "" 0
.P
View a ronn file in the same way as man(1) without building a roff file:
.IP "" 4
.nf
$ ronn \-\-man hello\.1\.ronn
.fi
.IP "" 0
.P
Serve HTML manpages at \fIhttp://localhost:1207/\fR for all \fB*\.ronn\fR files under a \fBman/\fR directory:
.IP "" 4
.nf
$ ronn \-\-server man/*\.ronn
$ open http://localhost:1207/
.fi
.IP "" 0
.SH "ENVIRONMENT"
.TP
\fBRONN_MANUAL\fR
A default manual name to be displayed in the top\-center header area\. The \fB\-\-manual\fR option takes precedence over this value\.
.TP
\fBRONN_ORGANIZATION\fR
The default manual publishing group, organization, or individual to be displayed in the bottom\-left footer area\. The \fB\-\-organization\fR option takes precedence over this value\.
.TP
\fBRONN_DATE\fR
The default manual date in \fBYYYY\-MM\-DD\fR format\. Displayed in the bottom\-center footer area\. The \fB\-\-date\fR option takes precedence over this value\.
.TP
\fBRONN_STYLE\fR
A \fBPATH\fR\-style list of directories to check for stylesheets given to the \fB\-\-style\fR option\. Directories are separated by a \fI:\fR; blank entries are ignored\. Use \fI\.\fR to include the current working directory\.
.TP
\fBMANPAGER\fR
The paging program used for man pages\. This is typically set to something like 'less \-is'\.
.TP
\fBPAGER\fR
Used instead of \fBMANPAGER\fR when \fBMANPAGER\fR is not defined\.
.SH "COPYRIGHT"
Ronn\-NG is Copyright (C) 2009 Ryan Tomayko \fIhttps://tomayko\.com/about\fR, (C) 2018\-2023 Andrew Janke \fIhttps://apjanke\.net\fR, and other contributors\. See the AUTHORS file in the Ronn\-NG distribution for full details\.
.SH "SEE ALSO"
groff(1), man(1), pandoc(1), manpages(5), markdown(7), roff(7), ronn\-format(7)