Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhchan authored Jun 2, 2022
1 parent e45e751 commit 2238d52
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Linkify
This plugin converts text into links based on regular expressions. It will highlight matching text the same way links are and when you click on them, it will open a browser and take you to the URL.

For example, you could make all text that follows the format of a Twitter handle, e.g. `@obsdmd`, link to the corresponding Twitter profile.
For example, you could make all text that is formatted like a Twitter handle, e.g. `@obsdmd`, link to the corresponding Twitter profile.

<img width="720" alt="image" src="https://user-images.githubusercontent.com/37097379/171517773-eec42523-5fa7-43c9-aa3d-d5bc4623c36d.png">
<img width="718" alt="image" src="https://user-images.githubusercontent.com/37097379/171535251-9c33087f-8f25-4a4e-8907-b819b61b6262.png">

In the example in the screenshot, clicking on `@obsdmd` will open a browser to http://www.twitter.com/obsdmd.
In the example, clicking on "@obsdmd" would open a browser to http://www.twitter.com/obsdmd.

Or maybe you want to make a shortcut for GitHub repos, so that `gh:user/repo` will link to the GitHub repo for `user/repo`.
Or perhaps you want to make a shortcut for GitHub repos, so that clicking on "gh:user/repo" will link to the GitHub repo for `user/repo`.

<img width="719" alt="image" src="https://user-images.githubusercontent.com/37097379/171517539-52a918f4-ea89-4112-bd1c-d3aa32e6665a.png">

In the example in the screenshot, clicking on `gh:obsidianmd/obsidian-releases` will open a browser to http://www.github.com/obsidianmd/obsidian-releases.
In this example, clicking on "gh:obsidianmd/obsidian-releases" would open a browser to http://www.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 makes no changes to your `.md` files.
_Note: The underlying text is not modified. This plugin makes no changes to your `.md` files._

## How to Use
## Usage
### Add a Link Pattern
To add a link pattern:
- Go to the *Options* page for Linkify.
Expand All @@ -28,11 +28,12 @@ To add a link pattern:

[^1]: The URL is allowed to include replacement patterns as described in [`String.prototype.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter).

Here is a screenshot of the Linkify *Options* page:
<img width="996" alt="image" src="https://user-images.githubusercontent.com/37097379/171518552-73ca93d9-2125-4c5e-bf70-ce4f9c0e95ee.png">

Now, any text that matches the regular expression will be highlighted as though they were links in *Live Preview* mode, and clicking on the text will open the link in a browser.
Now, any text that matches the regular expressions will be highlighted as though they were links 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 is `http://twitter.com/$1`, then any occurrence of `@obsdmd` in your notes will link to `http://twitter.com/obsdmd`, and the same is true for any other Twitter handle preceded by a `@`.
For example, if the regular expression is `@(\w+)` and the link is `http://twitter.com/$1`, then any occurrence of `@obsdmd` in your notes will link to http://twitter.com/obsdmd, and the same is true for any other Twitter handle preceded by a `@`.

You can have multiple regex-link entries. Each one is applied independently.

Expand Down

0 comments on commit 2238d52

Please sign in to comment.