xcode-man-pages icon indicating copy to clipboard operation
xcode-man-pages copied to clipboard

Use mandoc.css like OpenBSD man.cgi (formatting)

Open Artoria2e5 opened this issue 2 years ago • 5 comments

The OpenBSD man website is similar to this one in that it also takes the mandoc -Thtml output, but it just looks a lot better. The man.cgi code is part of upstream mandoc in... ~~oh no cvs~~ https://cvsweb.bsd.lv/mandoc/cgi.c. What really matters is the styling, which is also there pre-canned in https://cvsweb.bsd.lv/mandoc/mandoc.css?rev=1.52&content-type=text/x-cvsweb-markup.

  • The page width is constrained.
  • There's some fun little tooltip on macros to show what it was.

Honestly, just get the whole CSS. It's how the author intended the HTML to be used. It's all in there.

Artoria2e5 avatar May 09 '23 02:05 Artoria2e5

The mandoc(1) manual has a lot of useful options for -Thtml output. See https://man.openbsd.org/mandoc.1. We will need:

  • -Ostyle=/xcode-man-pages/mandoc.css, which causes it to inject the correct code for CSS inclusion.
  • -Oman=/xcode-man-pages/%N.%S.html, which makes the See Also section (technically the .Xr macro) work.

Roff2html isn't going to do any of that still, so py hack may need to be retained.

Artoria2e5 avatar May 09 '23 03:05 Artoria2e5

For reference, here are before and after screenshots of a sample page:

Current
image
With mandoc.css
image

IMHO the constrained width, the less vibrant anchor links, and the aligned <dl> items are clear improvements over the current style.

waldyrious avatar Jan 31 '24 09:01 waldyrious

Roff2html isn't going to do any of that still

Yay, it got removed with 24e4e034df8c2a0c3d29d36b7d25d0d6b8c46ece. It's even simpler now.

Artoria2e5 avatar Jan 31 '24 14:01 Artoria2e5

happy to take some PR here as long as it still works well with variable screen sizes!

keith avatar Jan 31 '24 18:01 keith

Hmmm... I can get -Oman= to work in an isolated invocation, but I am still struggling to understand what -Ostyle wants. Going to put it off for now; maybe I will hit my head on the range hood when heating some soup and get some sudden inspiration from that.

It's only a max-width, so don't worry about screen size variability.

Artoria2e5 avatar Feb 01 '24 07:02 Artoria2e5