Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

BSD man pages (and many Linux man pages, though a minority) are written in semantic “mdoc” macros, rather than the classic “man” macros that are strictly presentational.

If you’re using mandoc (http://mandoc.bsd.lv/) as your man(1) program—the default on OpenBSD and a couple of Linuxes like Void and Alpine—it will use these semantics to generate hyperlinks in the terminal using more(1) and less(1)’s ctags support.

So on my machine, your example becomes:

    type man foo
    type :t
    type p
This brings me to the first instance of a command‐line flag named “-p” or environment variable named “p” in an itemized list.

It translates to HTML too—check out the links generated by the web viewer, which uses the same backend. https://man.openbsd.org/ls.1



That’s awesome! I think a table of contents could be nice addition for the HTML version (at least for pages that are longer than less).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: