Add a single direct link using a file name prompt
The denote-link command (alias denote-insert-link) inserts a link at point to a file selected at the minibuffer prompt. Links are formatted depending on the file type of the current note. In Org and plain text buffers, links are formatted thus: ‘[[denote:IDENTIFIER][DESCRIPTION]]’. While in Markdown they are expressed as ‘[DESCRIPTION](denote:IDENTIFIER)’.
When denote-link is called with a prefix argument (‘C-u’ by default), it formats links like ‘[[denote:IDENTIFIER]]’, regardless of file type (Fontify links in non-Org buffers). The user might prefer its simplicity.
By default, the description of the link is determined thus:
- If the region is active, its text becomes the description of the link. In other words, the region text becomes the link.
- If the region is active but has no text, the description is empty and so the link is formatted the same way as if using the ‘
C-u’ prefix argument. - If there is no region active, the description consists of the target file’s signature and title, using the former only if it is present. The title is retrieved either from the front matter or the file name.
- If the target file has no signature, the title is used.
To insert multiple such links at once, use the command denote-add-links (Insert links matching a regexp in their file name).
If you want to directly link to a single file whose contents match a given query, then use the command denote-link-to-file-with-contents (Adding a direct link to a file whose contents include the given query).
Links are styled with the denote-faces-link face, which looks exactly like an ordinary link by default.
[ We optionally support direct links to a file followed by an extra target to an Org headings (The denote-org-store-link-to-heading user option). Other file types do not have the features of Org, so we cannot generalise this. ]