This plugin converts text into links based on regular expressions. The regular expressions and link destinations are configurable on the Options page for the plugin.
For example, you could make social media handles link to the profile page so that @obsdmd
becomes a link to http://twitter.com/obsdmd:
Or you could make a shortcut for GitHub repos so that gh:obsidianmd/obsidian-releases
becomes a link to http://github.com/obsidianmd/obsidian-releases:
The text you want to match and the URL you want it to link to are configured on the Options page for the plugin.
Note: The underlying text is not modified. This plugin only changes the appearance and functionality of your notes. It makes no changes to your .md
files.
To add a link pattern:
[^1]: The URL is allowed to include replacement patterns as described in String.prototype.replace
.
Here's what the Linkify Options page looks like:
Now, any text that matches a regular expression will be highlighted as though it were a link in Live Preview mode, and clicking on the text will open the link in a browser.
For example, if the regular expression is @(\w+)
and the link pattern is http://twitter.com/$1
, then any occurrence of @obsdmd
in your notes will link to http://twitter.com/obsdmd, @github
will link to http://twitter.com/github, etc.
Links to Obsidian notes, e.g. [[Journal/$1]]
, are also supported.
You can have multiple regex-link entries. Each one is applied independently.
By default, links will have the linkified
CSS class applied to them. You can add additional classes based on the pattern by adding them to the "CSS Class" field.
You can delete an entry by clicking on the trash can icon to the right of the entry.
By default, the plugin starts with three example entries:
g:([a-zA-Z0-9.-]*)
will link to http://google.com/search?q=$1
.gh:([a-zA-Z0-9.-/]*)
will link to http://github.com/$1
.@([a-zA-Z0-9]*)
will link to http://twitter.com/$1
.