Created
September 14, 2011 10:58
-
-
Save Olical/1216308 to your computer and use it in GitHub Desktop.
Replace MarkDown links with HTML links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function htmlLinks(md) { | |
| return md.replace(/\[(.*?)\]\((.*?)\)/ig, '<a href=\'$2\'>$1</a>'); | |
| } | |
| htmlLinks('This is now [linked to Google](http://www.google.co.uk/).'); // This is now <a href='http://www.google.co.uk/'>linked to Google</a>. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Find: \[(.*?)\]\((.*?)\) | |
| Replace: <a href='$2'>$1</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment