Links
The linking location is that type of location that resolves to some resource, be it on the local filesystem or remotely.
This is what we often think of as the address or URL
to a resource. In the majority of cases, we work with links in the bookmark manager.
You often identify a link by its URL scheme:
-
An address that begins with http is a web URL;
-
A path that begins with
~/
is a directory on the local computer; -
And so on.
There are many protocols that are in use to help us resolve these links. For a bookmark manager like hlg
, it is important to resolve such protocols whenever a path is provided.
As a result, a program to resolve a location has to be provided.
If you do not provide one, you have to set in your configuration file how each protocol is to be handled for certain types of locations.
In your configuration file, you will find default file handlers for dealing with various types of links:
- Browser
-
To open web pages.
- file-manager
-
To open your local directories.
- command
For other types of links, for example ordinary files, hlg
is guided by a file extension.
For that, it uses an auxiliary configuration file that stores file formats. We call this the formats file.
You must edit this file and add the following information:
-
The program for opening certain types of files, for example
libreoffice
-
A list of file extensions that this program opens, for example `["docx", "odt", "rtf"]
The entry in the formats file looks like this:
libreoffice = ["docx", "doc", "odt", "rtf"]
Such that a bookmark entry like this:
assignment <~/Documents/school-work/commerce_assignment.odt>
will be resolved by hlg
as follows:
-
As this link location has no handler in its handler field, it checks for the file extension.
-
In this case, the extension is
.odt
-
It will lookup the “odt” extension in the formats file.
-
In this case, it will find that
libreoffice
is the program to use for this linking location; and then -
Launch it with the location as its argument.
Otherwise, hlg
will fail. This is why we recommend using handlers all the time, especially for unusual file extensions. The idea behind the formats file is to deal with common URL schemes and protocols. This saves some typing when adding bookmarks.
Limitations of links
No embedded spaces in links
A link must not have embedded spaces in it. If it happens that you are linking to a filename with spaces in it, consider renaming the file to remove spaces. We suggest using dashes or underscores in place of spaces.
hlg cannot validate links
hlg
as a bookmark manager has no way of following link targets. For that reason, it cannot validate target resources. It is up to you to supply valid targets for your bookmarks.
The only type of location that hlg
checks for the validity of its target is the reference, and not the link nor the the command.