Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic detection of URLs in markdown #21

Open
iteles opened this issue Jan 21, 2016 · 3 comments
Open

Automatic detection of URLs in markdown #21

iteles opened this issue Jan 21, 2016 · 3 comments

Comments

@iteles
Copy link
Member

iteles commented Jan 21, 2016

It would be a nice enhancement (low priority) to automatically detect URLs in the markdown and convert them into HTML links <a> elements.

This example is from: http://ampl-demo.herokuapp.com/dwyl/learn-react
non-detected-urls

@des-des
Copy link
Member

des-des commented Jan 22, 2016

👍

@pankajpatel
Copy link
Member

/(https?:)*\/\/[\w.\/?&@:%._\+~#=]*\b/g can be used to detect URLs and replace with links.
http://regexr.com/3f3bq

const text = `foo@demo.net	bar.ba@test.co.uk
www.demo.com	http://foo.co.uk/x
http://regexr.com/foo.html?q=bar&baz=new&q=a+b
https://mediatemple.net
//www.google.com
demo.google.com`;

let formatedText = text.replace(
  /((https?:)*\/\/[\w.\/?&@:%._\+~#=]*\b)/gi,
  '<a href="$1">$1</a>'
);
console.log( formatedText );

@des-des
Copy link
Member

des-des commented Jan 18, 2017

Currently I think this is being done by remarkable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants