On Mon Nov 4, 2024 at 4:03 PM CET, onf wrote: > On Mon Nov 4, 2024 at 1:45 AM CET, Alexis wrote: > > "onf" <o...@disroot.org> writes: > > > While you can absolutely get a list of manpages containing a > > > specific term of a specific type with apropos (like the example > > > you gave), what I was getting at is that you can't say to your > > > pager "jump to the flag -e". [...] > > > > Well, what i was trying (poorly!) to get at is that if you've got > > semantic markup rather than presentational markup, one can use > > that fact for the sort of functionality you describe: a program > > could find the documentation for that flag by searching the source > > for '.Op Fl e', which would be more reliable than having to make > > guesses / use heuristics. > > Agreed. I was mostly complaining such a thing hasn't been done yet > despite mdoc existing since the 90s (iirc).
Actually, BSD mandoc does implement this, it's just documented at a poorly visible place in the docs. BSD mandoc's man(1): MANPAGER Any non-empty value of the environment variable MANPAGER is used instead of the standard pagination program, less(1). If less(1) is used, the interactive :t command can be used to go to the definitions of various terms, for example command line options, command modifiers, internal commands, environment variables, function names, preprocessor macros, errno(2) values, and some other emphasized words. Some terms may have defining text at more than one place. In that case, the less(1) interactive commands t and T can be used to move to the next and to the previous place providing information about the term last searched for with :t. The -O tag[=term] option documented in the mandoc(1) manual opens a manual page at the definition of a specific term rather than at the beginning. And it works quite nicely, actually. The definitions are generated automatically, so all manpages written in mdoc benefit from it. I assume groff mdoc + man-db doesn't implement this? ~ onf