Hi Pádraig,

At 2026-05-29T13:24:47+0100, Pádraig Brady wrote:
> On 29/05/2026 11:05, G. Branden Robinson wrote:
> > Holy cow!  I of course appreciate usage of the support for OSC 8
> > hyperlinks that I slaved over to get into grotty(1) for groff 1.23
> > (July 2023), but this is an unnecessarily hard-core way to achieve
> > what you're doing, and moreover deprives users of groff's HTML and
> > PDF output from enjoying the convenience of the hyperlink.
> 
> 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?

> Note the arch linux man pages support these formats it seems:
> https://man.archlinux.org/man/tee.1
> and that mentions that mandoc is used.

Yes.  mandoc(1) supports groff man(7)'s ~17 year old `UR`/`UE`/`MT`/`ME`
extensions.

Here's what it produces given the same input as my groff HTML output
example above.

$ mandoc -man -T html /tmp/salad.man | sed -n '/Baz/,$p'
<p class="Pp">Baz.</p>
<p class="Pp">A
    <a class="Lk" 
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>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">2026-05-29</td>
    <td class="foot-os">groff test suite</td>
  </tr>
</table>
</body>
</html>

Can you help me understand your request better?

> > May I propose the following alternative?
> > 
> > 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.

groff test suite               2026‐05‐29                         foo(1)

Here's the full description of the macro's behavior.

groff_man(7):
   Hyperlink macros
...
     .UR uri
     .UE [trailing‐text]
            Identify uri as an RFC 3986 URI hyperlink with the text
            between the two macro calls as the link text.  An argument
            to UE is placed after the link text without intervening
            space.  uri may not be visible in the rendered document if
            hyperlinks are enabled and supported by the output driver.
            If they are not, uri is set in angle brackets after the link
            text and before trailing‐text.  If hyperlinking is enabled
            but there is no link text, uri is formatted and hyperlinked
            without angle brackets, except when uri appears as a TP
            paragraph tag.

Does this help any?

Regards,
Branden

Attachment: signature.asc
Description: PGP signature

Reply via email to