Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I prevent auto-generated links in the GitHub wiki?

On a GitHub wiki page, if I type:

www.foobar.com

GitHub automatically assumes this is a URL and makes the text a hyperlink to http://www.foobar.com. However, sometimes I do not want a hyperlink to be created. Is there a way to stop this behavior? Perhaps some sort of markdown?

like image 399
david Avatar asked Sep 07 '14 00:09

david


People also ask

How do you hyperlink in markdown?

Markdown syntax for a hyperlink is square brackets followed by parentheses. The square brackets hold the text, the parentheses hold the link.

How do you add a link to a readme in GitHub?

Links. You can create an inline link by wrapping link text in brackets [ ] , and then wrapping the URL in parentheses ( ) . You can also use the keyboard shortcut Command + K to create a link.

Does GitHub markdown support HTML?

Wherever HTML is rendered on GitHub (gists, README files in repos, comments on issues and pull requests, ...) you can use any of the HTML elements that GitHub Flavored Markdown (GFM) provides syntactic sugar for.


4 Answers

Update Nov. 2021, VSCode 1.63:

This issue should be allievated with issue 136198 "markdown preview wrongly creates links "

While "markdown.preview.linkify": false will disable linkify features entirely, setting md.linkify.fuzzyLink to false will disable it only for links without http(s) header.
Which, I think, is a better alternative, and it's already supported by markdown-it.


Original answer (2014): This isn't limited to wiki page, and is part of the GFM (GitHub Flavored Markdown) url autolinking feature.

Putting them in `` can work but display the url as a code: foo http://example.com bar.

foo `http://example.com` bar

Another trick (mentioned in this gist) is

ht<span>tp://</span>example.com 

That will display http://example.com as regular text.

In your case (without the http://)

w<span>ww.</span>foobar.com

That would also display www.foobar.com as regular text.

geekley adds in the comments:

For emails, you can use foo<span>@</span>example.com


Venryx suggests in the comments a shorter/cleaner solution:

Just add one of the void element tags (I prefer <area>), at a location that breaks the URL detectability, eg. right before the first dot.

Example: www<area>.foobar.com

like image 97
VonC Avatar answered Oct 08 '22 10:10

VonC


Also, if you are having a issue with something other than a URL auto-linking I found escaping the . works as well.

Example:

foobar.web -> foobar&#46;web
like image 25
Justin Slone Avatar answered Oct 08 '22 08:10

Justin Slone


You can use a zero-width space to prevent most auto-linkers from interpreting characters as a URL

Here's an example with a zero width space inserted between https and :

https​://example.com/

To insert one, you can copy from the url above or this page

See also this thread on twitter

like image 12
KyleMit Avatar answered Oct 08 '22 09:10

KyleMit


You can also just apply a backslash escape to the colon (or any of the other punctuation, apparently), like this:

http\://www.foobar.com
like image 10
SamB Avatar answered Oct 08 '22 08:10

SamB