Hyperlinks in Terminal man pages
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Several third party applications (eg ManOpen) put hyperlinks in man pages. Often this is done on the fly using the same man page source as the Terminal.
Does Apple do this with the Terminal or any other applications which use local (ie not web) man pages?
My groff_mdoc man page says:
.Lk To be written
but a more informative description at
http://www.daemon-systems.org/man/mdoc.7.html says:
.Lk link (for conversion to HTML). Usage: .Lk [anchor-text]
I suspect Lk has not been widely used and that third party applications probably use the existing Xr tags about which my groff_mdoc man page says:
Manual Page Cross References
Usage: .Xr ⟨man page name⟩ [⟨section⟩] ...
.Xr mdoc mdoc
.Xr mdoc , mdoc,
.Xr mdoc 7 mdoc(7)
.Xr xinit 1x ; xinit(1x);
The default width is 10n.
Is it possible to get the Terminal to use these existing Xr tags as hyperlinks?
15 replies
Sign in or join Beachball Help to reply.
- 0
Tony T1 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Take a look at
http://discussions.apple.com/thread.jspa?threadID=2387445&tstart=0I think that Bob's script does what you want:
BobHarris wrote:
Here is a little script that should generate an HTML list of section 1 and 8 commands
#!/usr/bin/env bash
apropos ' ' | awk ' /(1)|(8)/ {
match($0,/ - /)
cmd = substr($0,1,RSTART-1)
therest = substr($0,RSTART)
page = cmd
sub(/(.*/,"",page)
printf("%s%s
", page, cmd, therest)
}' >tmp.html - 0
Neville Hillyer ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Clearly I was aware of this script on my earlier thread but it does not open a man page with hyperlinks in the Terminal. It generates a new HTML-like page with hyperlinks from apropos output and puts it in my Home directory.
- 0
BobHarris ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Most of the man pages come straight from the FreeBSD distribution, or from the Open Source distribution of the command/tool/utility. Apple has made very few modifications to the man page set.
- 0
Neville Hillyer ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Most of the man pages come straight from the FreeBSD distribution, or from the Open Source distribution of the command/tool/utility. Apple has made very few modifications to the man page set.
Sorry Bob but I am unclear about the point you are making.
- 0
Tony T1 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Does ManOpen do what you're looking for? If so, then take a look at the ManOpen code
- 0
Neville Hillyer ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
ManOpen is very good but I suspect it is no longer being maintained - most preference panes can no longer be accessed. It is not as fast as the Terminal and it is not possible to alter its text width in the way that one can do by increasing the width of the Terminal window.
However, your point about looking at its code may be worth considering.
- 0
BobHarris ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Several third party applications (eg ManOpen) put hyperlinks in man pages. Often this is done on the fly using the same man page source as the Terminal.
Does Apple do this with the Terminal or any other applications which use local (ie not web) man pages?
My point was, Apple does next to nothing with respect to man pages. What little they do is related to Mac OS X specific commands they have written or modifications they have made to Unix commands for Mac OS X.
Apple is not marketing a Unix system. They are marketing a click-on-it GUI interface. The fact that it happens to have Unix under pinning is a side effect not an objective.
So if the FreeBSD man page system implements the links, then Apple has it. If the FreeBSD man page system does not, then neither does Apple.
Or at least that has been my observation. Your mileage may vary, and tomorrow, next week, next month, ... Apple could change how they implement the man system. But for now, I do not think it does what you desire.
- 0
Neville Hillyer ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Or at least that has been my observation.
Thanks for the observations. You could be correct about Apple objectives. However, as a long term Apple user (I started with an Apple II Euro plus in 1981), I have observed that Apple often tries to improve ergonomics and usability in all manner of ways.
As I have previously mentioned Terminal man pages are now displayed with the hard line wraps removed (like HTML) - this can be demonstrated by increasing Terminal window width in Preferences. I unaware of other implementations doing this for local pages - they mostly display like <pre>. Apple also provides an extensive online set of man pages which I suspect employs several people just to maintain them. I would be surprised if Apple did not already have simple tweaks to display Xr tags as hyperlinks particularly as, for all practical purposes, the man page source code already supports such links. From what you say, even if such tweaks exist, Apple appears not to have told anybody about them. Perhaps I should mention this relatively simple usability improvement in Bug Reporter.
Are there any groff experts who can shed further light on this?
- 0
Tony T1 ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
ManOpen is very good but I suspect it is no longer being maintained - most preference panes can no longer be accessed. It is not as fast as the Terminal
Unfortunately, it's not being maintained. I was able to 'fix' the speed issue by compiling on my intel Mac as a Universal Binary (I believe that the pre-compiled version is powerPC), but I still have the preference problems you noted.
- 0
Neville Hillyer ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
My main use would be on a G4.
I have tried looking at the code and concluded that changes to it may be beyond me.
I would like to set it to be the default application for x-man-page in Leopard but I can only access this setting in Tiger. I will eventually discover how to set this elsewhere - perhaps change LaunchServices.plist.
It occasionally refuses to display a man page when first launched from the Terminal in Leopard. This started after several days use combined with experiments. A simple reinstall fixed it temporarily. I intend to try a cleaner reinstall of all its components later.
I would like to find a way to get it to display man text to window width, like the terminal, rather than its <pre> like behaviour. I much prefer to see more on the screen at once. Does anybody have any thoughts on this?
- 0
baltwo ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Does Apple do this with the Terminal or any other applications which use local (ie not web) man pages?
I don't know about Apple, but
Bwana displays manpages in Safari, using the local installed ones, and has active hyperlinks to other pages. That should do what you want. - 0
Neville Hillyer ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
This is what I said on my linked thread:
I read a poor review a while ago so was put off Bwana.However I have just tried it and it does most things it claims to do. Pity 'man' does not work in Safari - I have to use 'man://'.
In common with other viewers it is not clear if the text width can be increased in the same way that it can with the standard terminal. Any thoughts on this?
It took over my computer for some time building its index but I assume this is a rare event. ManOpen was much faster at doing this.
Is there a way to invoke it by typing something simple in the terminal such as 'm ls' ? I have got ManOpen working in this way.
The HTML is better than most but not as clean as it could be. Putting 'width="50%"' on half the index TDs is totally unnecessary. The individual pages are much worse with much redundant use of 'span' tags. Nothing will validate without DOCTYPE statements. It is now storing its own copy of these bloated files on my disk!
Can you answer any of these questions?
- 0
baltwo ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Sorry, I didn't peruse that link. On my machine,
man:<commmand> works in Safari. As for width, no can help. I haven't tried building the index, since I rarely use it. The only time I do is if I want to copy the nicely formatted stuff into TextEdit and save it. Can't help with your other issues.Additionally, WRT
As I have previously mentioned Terminal man pages are now displayed with the hard line wraps removed (like HTML) - this can be demonstrated by increasing Terminal window width in Preferences.
That's incorrect. This example is from the chmod manpage:
+ The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options override each other and the command's+
+ actions are determined by the last one specified.+ - 0
Neville Hillyer ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Sorry, I didn't peruse that link. On my machine,
man:<commmand> works in Safari.Thanks for that I had misread the instructions and tried man: ls and man ls (as per terminal) rather than the correct man:ls
That's incorrect. This example is from the chmod manpage:
+ The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options override each other and the command's+
+ actions are determined by the last one specified.+In my terminal I get the following:
Case 1 - Terminal/Prefences/Window Columns set to 80
The -H, -L and -P options are ignored unless the -R option is specified.
In addition, these options override each other and the command's actions
are determined by the last one specified.Case 2 - Terminal/Prefences/Window Columns set to 120
The -H, -L and -P options are ignored unless the -R option is specified. In addition, these options
override each other and the command's actions are determined by the last one specified.For these tests I closed Preferences and then opened a new Terminal window. Manually widening the windows did not increase text width further but narrowing them resulted in an untidy soft text wrap a character at a time rather than the normal word at a time.
Am I the only one with a Terminal that does this or does it work for others?
- 0
baltwo ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I get the same behavior. My default setting is 140 columns wide.