plp13 / qman

A more modern man page viewer for our terminals
BSD 2-Clause "Simplified" License
18 stars 0 forks source link

RFE: Page outline / navigate to subsection? #2

Open intelfx opened 3 weeks ago

intelfx commented 3 weeks ago

It would be nice if qman could somehow extract the page structure and present an "outline view" of the page, with potential fuzzy search capability for locating a (sub)section by name.

For instance, man.archlinux.org is able to extract (sub)section titles and other items into id= attributes, which then allows easy linking and navigation to a specific manpage section or even toa a specific option or subcommand described in the man:

https://man.archlinux.org/man/tmux.1#respawn-pane

It would be useful if qman could perform a similar process and present an outline view for navigation.

To be clear, in the above example of tmux(1) man page I'm expecting a hierarchical outline view similar to the "Table of contents" at the link above, but with added subitems for each tmux subcommand:

tmux(1) ├ NAME ├ SYNOPSIS ├ ... ├ WINDOWS AND PANES │ ├ append-selection │ ├ append-selection-and-cancel │ ├ ... │ └ unlink-window ├ KEY BINDINGS │ ├ bind-key │ ├ ... │ ├ send-prefix │ └ unbind-key ├ ... └ AUTHORS

Would it be feasible to implement such a feature?

plp13 commented 3 weeks ago

Hi intelfx, thanks for your suggestion.

Support for inline links to section headings is in the works. In fact, the program already supports such links in whatis/apropos pages, and in the index page. However, the way these are implemented wouldn't work for man pages without reworking the code a bit.

So, this is a feature that will definitely happen at some point.

And yes, the next logical step after that would be having some sort of searchable table of contents (and perhaps a table of links) for the entire page. Implementing this will take some effort, though.