78

I want to write

http://www.foo.com/ 

and get a link with the URL as the text (e.g., in HTML output). I do not want to write

[http://www.foo.com/](http://www.foo.com/)

Is it possible?

Marco Eckstein
  • 4,448
  • 4
  • 37
  • 48
  • Can you do this without the HTTP-prefix? (this is useful for a markdown-based wiki, here you want to mark some <keywords> als links... – realbart Jun 29 '17 at 08:13

3 Answers3

103

Yes, here is the relevant section of the documentation:

AUTOMATIC LINKS

Markdown supports a shortcut style for creating “automatic” links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:

<http://example.com/>

Markdown will turn this into:

<a href="http://example.com/">http://example.com/</a>
Community
  • 1
  • 1
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
  • 3
    FYI here on SO, plain text links work without additional tags `http://www.foo.com/` => http://www.foo.com/ - in comments the text of the link is shorthened though. and `` => – Aprillion Jul 24 '14 at 12:29
  • 1
    @Chris Can you do this without the HTTP-prefix? (this is useful for a markdown-based wiki, here you want to mark some <keywords> als links... – realbart Jun 29 '17 at 08:14
  • @realbart, most wikis provide a way to easily link to pages. I would read the documentation of whatever wiki you are using and see how it handles this. – ChrisGPT was on strike Jun 29 '17 at 11:27
1

If your markdown is parsed as Github Flavored Markdown, this is already part of the GFM extended syntax called "Auto linked references". See the GFM docs for more details.

Carl Walsh
  • 6,100
  • 2
  • 46
  • 50
-1

I find this works with my IDE nicely, wrapping the link in an <a> tag:

<a>http://example.com/</a>
  • 7
    Does that actually link to `http://example.com/`? Or does it create a link to nothing? Or maybe to the current page? – ChrisGPT was on strike Sep 01 '19 at 17:55
  • 3
    "If the a element has no href attribute, then the element represents a placeholder for where a link might otherwise have been placed, if it had been relevant, consisting of just the element's contents." (https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-a-element) So it does not link to anything. – Falko Aug 17 '22 at 08:51