Skip to content

link-path-input-suggest

Completes the whole value of an <input> as a link path: a vault file, then, after #, one of that file’s headings.

Class Description
LinkPathInputSuggest Completes the WHOLE value of an input as a link path, for a field that holds only a link target, such as the target field of a link editor. It is the counterpart of LinkAndTagInputSuggest, which completes a [[ link typed inside free text. Before a # it suggests vault files by their link text relative to the source path. After <path># it suggests the headings of the file that path resolves to, and after a bare # those of the source file. A block subpath (#^) gets no suggestions. Picking a suggestion replaces the value and dispatches an input event, so a component listening on the input sees the change. The value is the link path as Obsidian resolves it, not URL-encoded: a caller that writes it into a Markdown link encodes it there. ts new Setting(containerEl).addText((text) => \{ new LinkPathInputSuggest(\{ app: this.app, inputEl: text.inputEl, sourcePath: file.path \}); \});
Interface Description
LinkPathHeadingSuggestion A suggested heading of the file a link path resolves to.
LinkPathInputSuggestConstructorParams Parameters of LinkPathInputSuggest.
Type Description
LinkPathSuggestion A suggestion of LinkPathInputSuggest: a file before the #, a heading after it.