Manner
Convert troff man pages to semantic HTML
Install / Use
/learn @jacksonp/MannerREADME
manner
Convert troff man pages to semantic HTML.
This is used for rendering pages on ManKier.
Macro conversion:
.TH→<title>, <h1>: title heading macros become HTML title elements and the highest level of HTML section heading..SH, .SS→<section>, <h2>, <h3>: section heading macros become HTML section elements with HTML section headings..PP→<p>: paragraph macros become HTML paragraphs..TP, .TQ→<dl>, <dt>, <dd>: sequences of tagged paragraph macros become HTML definition lists..IP \(bu→<ul>: indented paragraph macros used for lists become HTML unordered lists.TS, .TE→<table>: tables handled by the tbl preprocessor for troff become HTML tables..UR, .UE→<a href="">: hyperlink URI macros become HTML URL anchors..MT, .ME→<a href="">: hyperlink email macros become HTML URL anchors with amailto:scheme
Example
See in the examples folder:
.TH EXAMPLE "1" "June 2024" "manner" "Example Man Page"
.SH NAME
example \- sample man page
.SH SYNOPSIS
.B example
[\fI\,OPTION\/\fR]...
.SH DESCRIPTION
.\" This is a comment
.PP
Not a real command or man page!
.TP
\fB\-a\fR, \fB\-\-all\fR
a sample option
.TP
\fB\-b\fR, \fB\-\-ball\fR
another sample option
.PP
.TS
tab(@);
l l.
T{
Column 1
T}@T{
Column 2
T}
_
T{
row1
T}@T{
This is some tabular date
T}
T{
this is the second row
T}@T{
translated to an HTML <table>
T}
.TE
.SH SEE ALSO
.IP \(bu
First thing to see:
.UR https://example.com/something
Some Project
.UE .
.IP \(bu
Second thing to see.
.SH AUTHORS
This was written by
.MT author1@example.com
Author 1
.ME
and
.MT author2@example.com
Author 2
.ME .
After running:
./manner.php example.1 > example.html
... the output is compact, but reformatting with Prettier to show the structure of the output gives:
<!doctype html>
<meta charset="utf-8" />
<meta
name="man-page-info"
data-extra1="June 2024"
data-extra2="manner"
data-extra3="Example Man Page"
/>
<title>EXAMPLE</title>
<body>
<h1>EXAMPLE</h1>
<section>
<h2>NAME</h2>
<p>example - sample man page</p>
</section>
<section>
<h2>SYNOPSIS</h2>
<p><strong>example</strong> [<em>OPTION</em>]...</p>
</section>
<section>
<h2>DESCRIPTION</h2>
<p>Not a real command or man page!</p>
<dl>
<dt><strong>-a</strong>, <strong>--all</strong></dt>
<dd><p>a sample option</p></dd>
<dt><strong>-b</strong>, <strong>--ball</strong></dt>
<dd><p>another sample option</p></dd>
</dl>
<table>
<tr class="border-bottom">
<td>Column 1</td>
<td>Column 2</td>
</tr>
<tr>
<td>row1</td>
<td>This is some tabular date</td>
</tr>
<tr>
<td>this is the second row</td>
<td>translated to an HTML <table></td>
</tr>
</table>
</section>
<section>
<h2>SEE ALSO</h2>
<ul>
<li class="p">
First thing to see:
<a href="https://example.com/something">Some Project</a>.
</li>
<li class="p">Second thing to see.</li>
</ul>
</section>
<section>
<h2>AUTHORS</h2>
<p>
This was written by <a href="mailto:author1@example.com">Author 1</a> and
<a href="mailto:author2@example.com">Author 2</a>.
</p>
</section>
</body>
Requirements
- PHP >= 8.4
- A few man pages contain
.EQmacros, for these theeqncommand is required. - A few man pages contain
.PSmacros, for these thepic2plotandinkscapecommands are required.
Related Skills
node-connect
344.1kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
96.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
344.1kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
344.1kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
