Hi PƔdraig,
At 2026-05-29T14:37:06+0100, PƔdraig Brady wrote:
> On 29/05/2026 13:41, G. Branden Robinson wrote:
> > At 2026-05-29T13:24:47+0100, PƔdraig Brady wrote:
> > > Could groff be adjusted so that it supports these tty links in
> > > html output?
> >
> > I'm...not sure what that would look like. When groff produces HTML,
> > the links become idiomatic `<a href=...>` elements. This has been
> > the style of groff's output for something like 25 years.
> >
> > $ groff -man -T html /tmp/salad.man | sed -n '/Baz/,$p'
> > <p style="margin-left:6%; margin-top: 1em">Baz.</p>
> >
> > <p style="margin-left:6%; margin-top: 1em">A
> > <a
> > href="https://www.gnu.org/software/coreutils/manual/html_node/Numeric-Modes.html"><b>numeric
> > mode</b></a> is from one to four octal digits (0-7), derived
> > by adding up the bits with values 4, 2, and 1. Omitted
> > digits are assumed to be leading zeros.</p>
> > <hr>
> > </body>
> > </html>
> >
> > What are your expectations of groff's HTML output in this area?
>
> The same output would be fine.
Okay. That's a relief! š
[...]
> > > > A
> > > > .UR https://\:www\:.gnu\:.org/\:software/\:coreutils/\:manual/\
> > > > \:html_node/\:Numeric\-Modes\:.html
> > > > .B "numeric mode"
> > > > .UE
> > > > is from one to four octal digits (0\-7), derived by
> > >
> > > Yes the most abstract the better, however the issue with that is
> > > it displays the URL. That gets messy fast.
> >
> > It can. The URL is not displayed if the output device is capable of
> > hyperlinking, unless there is no link text (a boldface "numeric
> > mode" in this case).
> >
> > Illustration:
> >
> > $ nroff -r LL=72n -man /tmp/salad.man | sed -n '/Baz/,$p'
> > Baz.
> >
> > A numeric mode is from one to four octal digits (0-7), derived by
> > adding up the bits with values 4, 2, and 1. Omitted digits are asā
> > sumed to be leading zeros.
>
> This doesn't work for me. groff/nroff 1.23 always display the URL
> when outputting to terminal here? As does the default `man`
> invocation on Fedora 44 at least.
>
> I must be missing something fundamental in all this.
Just a configuration option and its default.
groff 1.23.0 NEWS:
* The an (man) macro package can now produce clickable hyperlinks
within terminal emulators, using the OSC 8 support added to grotty(1)
(see below). The groff man(7) extension macros `UR` and `MT`,
present since 2007, expose this feature. At present the feature is
disabled by default in `man.local` pending more widespread
recognition of OSC 8 sequences in pager programs. The package now
recognizes a `U` register to enable hyperlinks in any output driver
supporting them.
Use a command like
printf '\033]8;;man:grotty(1)\033\\grotty(1)\033]8;;\033\\\n'|more
to check your terminal and pager for OSC 8 support. If you see
"grotty(1)" and no additional garbage characters, then you may wish
to edit "man.local" to remove the lines that disable this feature.
groff 1.24.0 NEWS:
* Hyperlink support is now enabled by default on PDF and terminal
devices for an (man) and doc (mdoc) documents. Instructions and
commented code for disabling it are in the "man.local" and
"mdoc.local" files.
groff_man(7) (1.24.x):
Options
The following groff options set registers (with -r) and strings
(with -d) recognized and used by the man macro package. To ensure
rendering consistent with output device capabilities and reader
preferences, man pages should never manipulate them.
...
-rU0 Disable generation of URI hyperlinks in output drivers
capable of them, making the arguments to MT and UR calls
visible as formatted text. grohtml(1), gropdf(1), and
grotty(1) enable hyperlinks by default (the last only if
not in its legacy output mode).
So in your case you want to either edit "/etc/groff/man.local" (and
likely "/etc/groff/mdoc.local" too) to add:
.nr U 1
or, if you're using man-db man(1):
export MANROFFOPT=-rU1
Either should suffice to turn on the OSC 8 hyperlinks.
Regards,
Branden