13

Introducing scdoc, a man page generator

 3 years ago
source link: https://drewdevault.com/2018/05/13/scdoc.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Introducing scdoc, a man page generator

Introducing scdoc, a man page generator May 13, 2018 on Drew DeVault's blog

A man page generator is one of those tools that I’ve said I would write for a long time, being displeased with most of the other options. For a while I used asciidoc, but was never fond of it. There are a few things I want to see in a man page generator:

  1. A syntax which is easy to read and write
  2. Small and with minimal dependencies
  3. Designed with man pages as a first-class target

All of the existing tools failed some of these criteria. asciidoc hits #1, but fails #2 and #3 by being written in XSLT+Python and targetting man pages as a second-class citizen. mdocml fails #1 (it’s not much better than writing raw roff), and to a lesser extent also fails criteria #21. Another option, ronn meets criteria #1 and #3, but it’s written in Ruby and fails #2. All of these are fine for the niches they fill, but not what I’m looking for. And as for GNU info… ugh.

nemf.png

So, after tolerating less-than-optimal tools for too long, I eventually wrote the man page generator I’d been promising for years: scdoc. In a nutshell, scdoc is a man page generator that:

  • Has an easy to read and write syntax. It’s inspired by Markdown, but importantly it’s not actually Markdown, because Markdown is designed for HTML and not man pages.
  • Is less than 1,000 lines of POSIX.1 C99 code with no dependencies and weighs 78 KiB statically linked against musl libc.
  • Only supports generating man pages. You can post-process the roff output if you want it converted to something else (e.g. html).

I recently migrated sway’s manual to scdoc after adding support for generating tables to it (a feature from asciidoc that the sway manual took advantage of). This change also removes a blocker to localizing man pages - something that would have been needlessly difficult to do with asciidoc. Of course, scdoc has full support for UTF-8.

My goal was to make a man page generator that had no more dependencies than man itself and would be a no-brainer for projects to use to make their manual more maintainable. Please give it a try!


  1. mdocml is small and has minimal dependencies, but it has runtime dependencies - you need it installed to read the man pages it generates. This is Bad. ↩︎

Have a comment on one of my posts? Start a discussion in my public inbox by sending an email to ~sircmpwn/[email protected] [mailing list etiquette]

Articles from blogs I read Generated by openring

Go on ARM and Beyond

The industry is abuzz about non-x86 processors recently, so we thought it would be worth a brief post about Go’s support for them. It has always been important to us for Go to be portable, not overfitting to any particular operating sys…

via The Go Programming Language Blog December 17, 2020

Status update, December 2020

Hi all! This status update is the 24th one, so it’s been 2 years I’ve started writing those now (ignoring a little hiatus). Time flies! This month I’ve invested a lot of time into wlroots. My main focus has been renderer v6, which has now been internally rol…

via emersion December 16, 2020

What's cooking on Sourcehut? December 2020

A brisk wind of winter chill sets a stir down my spine, as I sit down with a fresh cup of coffee to yarn a story of careful engineering and passionate spirit that took place over the course of 30 days. The last 30 days. Cause this is the monthly “what’s cook…

via Blogs on Sourcehut December 15, 2020
The content for this site is CC-BY-SA. The code for this site is MIT.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK