How do I prevent auto-generated links in the GitHub wiki?
GithubHyperlinkMarkdownGithub Flavored-MarkdownAutolinkGithub Problem Overview
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?
Github Solutions
Solution 1 - Github
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
Solution 2 - Github
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.web
Solution 3 - Github
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
Solution 4 - Github
You can also just apply a backslash escape to the colon (or any of the other punctuation, apparently), like this:
http\://www.foobar.com
Solution 5 - Github
Would suggest to use zero-width no-break space.
In HTML could be used as Unicode char reference: 
or 
Benefits are:
- prevents autolinks (obviously)
- invisible
- no unexpected line breaks
- readable in source
Examples
For urls insert between http
and :
https://example.com/
→ https://example.com/
For emails insert after @
:
user@example.com
→ user@example.com
Solution 6 - Github
I suggest this is just a more complete and currently correct answer.
It was brought up that VSCode behaves differently from Github. It seems Github auto-URL handling acts on the "www." prefix (perhaps other triggers), while VSCode auto-converts any period/fullstop-delimited text that ends with a suffix that is a IANA registered country-code TLD. VSCode does not auto-complete any text that begins with "www." like Github does. Compare the three images below and note the placement of tags and how each environment renders the text.
Note that the only mechanism that suppresses all auto-URL rendering is (the most ugly) to put a tag before every period. It probably doesn't matter what the tag is. 'span' may do in all cases. I use 'nowiki' because it's consistent here and in MediaWiki and perhaps others.
Knowing the rules, however, it appears "the answer" to suppressing auto-URL rendering is dependent on the text.
- If it starts with "www.", go with the ugly solution. See the last two lines of the Github render and note that the tag just before the last period will suppress rendering only for the last part of the text.
- But if the text does not begin with "www.", a single tag before the final period is all that is required for both VSC and GH.
- Both environments are subject to rules that evaluate the text. At some point, either or both may auto-convert .gov, .net, other common TLDs, and eventually any valid ggTLD like .online, .xyz, or .aaa. To future-proof your text, consider using the ugly approach for all text like this, where the text isn't code that will be rendered with backticks.
- The actual tag seems unimportant, whether
<nowiki/>
,<span/>
, or<k>
. Personally I recommendnowiki
because it's already a recognized tag for exactly this purpose. - About
&#
HTML encoding, I tried the recommendations here and the text was not processed. I did not include examples here, but feel free to substitute any in-text tag with character encoding to see how it works for you.
Solution 7 - Github
in my case,
i used
# some.thing
in title , then i get a title without link outside.
some.thing
and use
[some.thing](#something)
as link.
"#something" is come from the link previewed in web.