3 ms·
Mandoc, which is what the BSDs and some other systems use for formatting manpages, has very good HTML output. In fact, the program used to be named “mdocml” bec
by anjbe 12y ago
Mandoc, which is what the BSDs and some other systems use for formatting manpages, has very good HTML output. In fact, the program used to be named “mdocml” because it was written to be a mdoc‐to‐HTML converter.
Unfortunately the -man macros (as opposed to the modern -mdoc macros) aren’t that good for conversion to other formats like HTML, because they’re by nature presentation‐focused. All major troff implementations support the -mdoc macros, though, and -mdoc is much better suited. It’s what I write all my manpages in these days (and it’s a drop‐in replacement—replace foo.1 written in -man with foo.1 written in -mdoc and groff, man, etc will handle it instantly). I also like to convert manpages from -man to -mdoc, or write new pages for programs that don’t have one. It gets a little exhausting to convert long pages like the one you linked, though.
Here’s some documentation on the format of -mdoc pages: http://mdocml.bsd.lv/man/mdoc.7.html http://mdocml.bsd.lv/man/mdoc.7.html
- kazinator 12y agoI wonder how good is mandoc's handling of the troff language as such. The long page that I wrote, though it is based on the old -man macros, is actually to a large extent based on its own macros which are retargettable. As I started to polish the document for better PDF output, I needed to reach into more of the power of groff, while maintaining compatibility with man2html. That's when I started hacking on man2html to handle more of the troff language. I found that loops didn't work very well and there were issues with nested if/else and such.