I put together a Python script to auto-create forward links in clipboard text based on the note titles in your vault. It includes:
- Defining aliases for pages (using aliases.yml)
- Handling of mismatched link text case
- Smart identification of links (won’t identify partial words or previously-linked text)
You pass the location of your vault to the script, which then:
- Scans your vault location recursively for .md files and builds a list of note titles
- Imports title aliases from aliases.yml in vault root
- Sorts the titles from longest to shortest
- Pulls the text from your clipboard
- Searches through that text for instances of the titles or aliases
- Replaces the text with the link (includes handling of differing case)
- Pushes the linked text back to the clipboard
Assuming you had a file in your vault named
problem solving: - solving problems - problem solve
In order to properly problem solve, you should wear your Problem Solving Hat.
In order to properly [[problem solving|problem solve]], you should wear your [[problem solving|Problem Solving]] Hat.
Here’s a gratuitous example of linking a large block of text:
Hopefully it’s of use to someone else.