johnbillion / obsidian-smart-links

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Obsidian Smart Links

This is a plugin for Obsidian that lets you define custom "smart" links which will be auto-linked when reading documents.

If you're used to writing in an environment that auto-links certain strings and don't want to build new habits, this will help with that. E.g. T12345 in phabricator, or #4324 in github.

It'll turn this...

edit mode

Into this...

reading mode

target focus

You can add your own replacement patterns in Obsidian's settings:

settings

Usage

Install and enable the plugin. Once you do, you'll find there's a new section in your settings called "Smart Links". In it you can add/remove replacement rules. You'll need to write a regular expression and a replacement string for it. This can range from very simple to very complicated.

Regular expression Replacement
T\d+ https://phabricator.wikimedia.org/$&
\$([A-Z]+) https://finance.yahoo.com/quote/$1
go\/[_\d\w-/]+ http://$&

The replacements work using normal Javascript regular expression replacement syntax. I'm so very sorry. Remember that you'll need to escape characters with special meaning in regular expressions. Matches are restricted so they'll only occur immediately after either the start of a line or some whitespace.

Credits

The reading-mode code was heavily influenced by Obsidian GoLinks -- this plugin is (arguably) a customizable superset of that one's functionality.

About

License:MIT License


Languages

Language:TypeScript 84.2%Language:JavaScript 13.1%Language:CSS 2.7%