Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Artoria2e5
Created March 8, 2021 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Artoria2e5/f5b8901e8ab53f6d15eff73ade9f40b4 to your computer and use it in GitHub Desktop.
Save Artoria2e5/f5b8901e8ab53f6d15eff73ade9f40b4 to your computer and use it in GitHub Desktop.
Addendum to "Italics and colour in manual pages on a nosh user-space virtual terminal"

Addendum to Italics and colour in manual pages on a nosh user-space virtual terminal

This is an addendum to Jonathan de Boyne Pollard's Italics and colour in manual pages on a nosh user-space virtual terminal.

FreeBSD and other mandoc deployments

FreeBSD et al. has switched to mandoc as their main manpage formatter. This formatter is faster, but is only capable of emitting overstrike for bold and underline. The only way to see italicized text is by telling less to make italics when it wants underline:

export LESS_TERMCAP_us=$(tput sitm || tput us) LESS_TERMCAP_ue=$(tput ritm || tput ue) 2>/dev/null
mandoc -mdoc <<< '.Em italics' | less 

The export command can be added to the last lines of the man_display_page function, before the final eval.

Colour

It's eludes me to see colors in man pages, since grotty strongly discourages their direct use. I checked the groff tmacs, but no color is requested in an nor doc.

Most sources recommend doing termcap force-feeding to show color, or using a most pager that automatically does so. Konsole seems to do it automatically for underline, since it doesn't support underlining.

macOS

macOS's built-in grotty does not respect the -i option at all, always emitting the overstrike sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment