Hi Benno, At 2025-02-16T12:04:05+0100, Benno Schulenberg wrote: > In the HTML version of a man page it can happen that a long option > (like --restricted) occurs near the right edge and that the browser > splits the thing into "--" at the end of the line and "restricted" > at the beginning of the next line. Is there a way to mark such long > options in the man page so that browsers are prevented from breaking > the marked text in any way?
Yes. It sounds like what you're looking for is the hyphenation control escape sequence, `\%`. And, to mark a break point after the interior dash in an ultra-long option name (though I see that nano(1) doesn't seem to have any), you can use the `\:` escape sequence. So you'd write "--unix" as \%\-\-unix and (notionally) "--modern-bindings" as \%\-\-modern-\:\%bindings ..for example. groff_man_style(7): \% Control hyphenation. The location of this escape sequence within a word marks a hyphenation point, supplementing groff’s automatic hyphenation patterns. At the beginning of a word, it suppresses any hyphenation breaks within except those specified with \%. \: Insert a non‐printing break point. A word can break at such a point, but a hyphen glyph is not written to the output if it does. The remainder of the word is subject to hyphenation as normal. You can use \: and \% in combination to control breaking of a file name or URI or to permit hyphenation only after certain explicit hyphens within a word. See subsection “Hyperlink macros” above for an example. \: is a GNU extension also supported by Heirloom Doctools troff 050915 (September 2005), mandoc 1.13.1 (2014‐08‐10), and neatroff (commit 399a4936, 2014‐02‐17), but not by Plan 9, Solaris, or Documenter’s Workbench troffs. > For example, in the man page of GNU nano [1], search for "--unix" > (without the quotes) and see that in the description of this option > and the next two options another long option is mentioned. With > the default width of my browser, the description of the next option > (--view) gets wrapped like this: > > Just view the file and ... ... other files for viewing, unless -- > restricted is given too. > > [1] https://nano-editor.org/dist/v7/nano.1.html > > This is undesirable. So I've tried experimenting with: > > .de nobreak > . ie '\*[.T]'html' <nobr>\\$1</nobr> > . el \\$1 > .. > > But that, of course, outputs <nobr> and </nobr> as text. Is there > a way to tell groff to insert these things verbatim into the output, > as actual tags? > > (I know that <nobr> is a deprecated tag, but it still works in > Firefox. That's good enough for me for now.) I think an HTML-only solution is undesirable because hyphenation can occur with any groff output device, and the problem you're trying to solve is general. Does this help? Please follow-up with any further issues or questions. Regards, Branden
signature.asc
Description: PGP signature