With the introduction of aliases into Obsidian 0.9.16, it was time to rework the auto-linking tool. Here is an overview of what the tool does and what has changed.
The auto-linking tool is a Python script that scans your vault for Markdown files, collecting a list of all the note titles and any aliases that are defined in YAML frontmatter. Aliases were introduced in Obsidian v0.9.16 - https://publish.obsidian.md/help/How+to/Add+aliases+to+note.
To cut down on file access and increase speed, the aliases are stored in a file (aliases.md) in the root of the vault. This file can be regenerated at any time, or every time if desired.
The input to the script is the clipboard text, which is scanned for any instances of the titles or aliases. When one is identified, the text is replaced by a wikilink to the relevant note. The modified text is pushed back to the clipboard.
I use this when importing notes or other text so that it can be ‘linked’ into my graph. I also use it after composing notes, so that I don’t have to concern myself with linking as I enter text.
There are options that can be passed on the command line to limit the amount of link output, as well as a separate script to ‘unlink’ a block of text.
The latest version is available at https://github.com/perkinsben/obs_tools/tree/master/forward_linker. If you’re pulling this code down for the first time since aliases were introduced in Obsidian 0.9.16, you’ll need to install another Python dependency (‘pip install python-frontmatter’).