Skip to content

Instantly share code, notes, and snippets.

@alexpeattie
Created February 7, 2013 07:32
Show Gist options
  • Save alexpeattie/4729247 to your computer and use it in GitHub Desktop.
Save alexpeattie/4729247 to your computer and use it in GitHub Desktop.
Disable Github-flavored Markdown autolinking

http://example.com

http://<span></span>example.com
@tashimatoru
Copy link

http://github.com
http://aaa.github.com
http://aaa.bbb.github.com

http\://github.com
http\://aaa.github.com
http\://aaa.bbb.github.com

@grmo5
Copy link

grmo5 commented Jun 1, 2016

I used the punctuation character (&#46;) instead of the '.' and it seems to remove it! www&#46;example&#46;com www.example.com

@mgustavocoder
Copy link

thanks!

@braksator
Copy link

Treat it as code? http://www.example.com

@Shangri-GitHub
Copy link

cool

@ruleechen
Copy link

thank you all

@smed79
Copy link

smed79 commented Oct 15, 2017

Thanks for the tip.

Other examples:

http://www.github.com/
http://www.github.com/
http://www.github.com/

http\://www.github.com/
http:\//www.github.com/
http:/\/www.github.com/

@braksator Treat it as code disable the styling.
(For e.g you can not bold a word http://​www.example.com/)

@wraymond
Copy link

I have a similar issue but with the word "data". When knit, "data" turns into a link. I just want it be to Data:. Below is what I have in my markdown code
**Data:** texttexttexttext

@lukyjuranek
Copy link

Please tell me, how to do it without http:// ?

@arberiii
Copy link

arberiii commented Nov 1, 2018

Do you also know why a text like makedoc.sh renders as a link and how to prevent it? I want to to mention this file in my markdown.

Plain works fine with me now. I run into this discussion while I was writing using https://dillinger.io/ and no answer was working but then just pushed the commit and worked fine.

@AppleKatz
Copy link

@braksator Thanks! To me, yours was the simplest answer since my text was already inside a code block:
original: var="http://google.com"
modified-raw: var=`"http://google.com"`
modified-rendered: var="http://google.com"

Copy link

ghost commented Jan 2, 2019

Hey, thank you all. You really helped me.

Copy link

ghost commented Jan 28, 2019

Hello, I'm not sure, but when I remove the "Disqus" comment plugin, autolink stops generating automatically.

Can someone also perform the same test?

@chrisdothtml
Copy link

chrisdothtml commented Jan 30, 2019

This also works for disabling/escaping references to PRs or issues:

#103

#<span></span>103

@scottdorman
Copy link

For future reference, to disable the # from autolinking to a PR or issue, you can also just do

#103

#<span/>103

(Same as https://gist.github.com/alexpeattie/4729247#gistcomment-2824646, but fewer characters.)

@J0hnL0cke
Copy link

J0hnL0cke commented May 5, 2020

Use 2 HTML comments. They aren't visible, and you can leave a message to others editing the document to explain what they're for.

Old: https://gist.github.com/alexpeattie/4729247

New: https://gist.github.com/alexpeattie/4729247

Code: https://<!--This is a comment-->gist.github.com/<!--This is, too-->alexpeattie/4729247

@baflo
Copy link

baflo commented Jun 16, 2020

In my case, Socket.io bothered me, as it was rendered differently on Github than it was in VSCode: Markdown All In One. Using the <n/> suffix it's disabled in both engines.


github.com
github.com<n/>
www.github.com

github.com
github.com
www.github.com


<n/>www.github.com
www.github.<n/>com
www.github.com<n/>

www.github.com
www.github.com
www.github.com


<!---->www.github.com

www.github.com

@willianfalbo
Copy link

My hero! =D

@potados99
Copy link

Thank you!

@samyakranjan
Copy link

How can I make hyperlinks work for opening settings in windows?
Eg. ms-settings:windowsupdate
It isn't working and cant find a way to make it clickable

@jddcef
Copy link

jddcef commented Oct 4, 2020

How can I make hyperlinks work for opening settings in windows?
Eg. ms-settings:windowsupdate
It isn't working and cant find a way to make it clickable

I've got the same question, how to make a link to the ms-settings: uri's...
If I use markdown like [`Storage Settings`](ms-settings:storagesense) then it just gets made into plain text and it isn't rendered as a link at all. eg. here's an attempt: Storage Settings

Copy link

ghost commented Nov 13, 2021

use HTTP Entity (https://dev.w3.org/html5/html-author/charref) to replace

  1. : with either:
    • &colon;
    • &#x0003A;
    • &#58;
  2. . with either:
    • &period;
    • &#x0002E;
    • &#46;
  3. / with either:
    • &sol;
    • &#x0002F;
    • &#47;

just one or two replacements should be fine.

@Nakilon
Copy link

Nakilon commented Mar 13, 2022

I wonder what is the official solution.

Copy link

ghost commented Mar 13, 2022

I wonder what is the official solution.

probably wrapping with `` (not <code>) for single-line,
and ```txt   ``` (not <pre> ) for multiline,
since it also escapes the content automatically making it both web-safe (< and > won't be parsed as DOM-nodes),
and preserve the original textual-content, implicitly means it skips link'ifying the text
(will style the text as monospace though..).

other solutions will (try to) mitigate the link'ify (text into URL) algorithm
by disrupting the URL pattern-matching
(pretty safe to assume they will work though).

@Papallism
Copy link

Thanks!

@deven
Copy link

deven commented Mar 9, 2024

How can I make hyperlinks work for opening settings in windows?
Eg. ms-settings:windowsupdate
It isn't working and cant find a way to make it clickable

I've got the same question, how to make a link to the ms-settings: uri's... If I use markdown like [`Storage Settings`](ms-settings:storagesense) then it just gets made into plain text and it isn't rendered as a link at all. eg. here's an attempt: Storage Settings

GitHub appears to block most URL schemes for links. It's quite possible that http: and https: are the only URL schemes that GitHub will actually allow, which makes sense for security reasons.

Even if you attempt to make this link using direct HTML tags instead of Markdown link syntax to explicitly create that hyperlink, it still doesn't work because the forbidden URL scheme still causes the explicit hyperlink to be stripped out of the text:

<a href="ms-settings:storagesense">Storage Settings</a>

This still renders as plain text: Storage Settings

It appears that the only effective workaround would be to render the forbidden URL as plain text and instruct the reader to copy/paste it to their browser URL bar to open the link, like this:

Copy/paste this URL into your browser to open Storage Settings in Windows: ms-settings:storagesense

It's not as convenient for the user as a hyperlink, but it still offers a way to reach the intended destination!

@nitzmahone
Copy link

Did some more poking around for options that wouldn't noticeably affect formatting- the one that seems to work on everything I've tried is embedding &zwnj; (zero-width-non-joiner)- used for controlling ligature behavior, so should be a no-op in most interesting cases that get auto-linked with URLs, PR numbers, etc.

https:&zwnj;//example.com -> https:‌//example.com
ansible/ansible#&zwnj;83065 -> ansible/ansible#‌83065

We got nailed by this recently when a file size in a release note ended up mapping to a shortened commit SHA.

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