Skip to content

Instantly share code, notes, and snippets.

@alexpeattie
Created February 7, 2013 07:32
Show Gist options
  • Select an option

  • Save alexpeattie/4729247 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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

grmo5 commented Jun 1, 2016

Copy link
Copy Markdown

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
Copy Markdown

thanks!

@braksator

Copy link
Copy Markdown

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

@Shangri-GitHub

Copy link
Copy Markdown

cool

@ruleechen

Copy link
Copy Markdown

thank you all

@smed79

smed79 commented Oct 15, 2017

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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

@arberiii

arberiii commented Nov 1, 2018

Copy link
Copy Markdown

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
Copy Markdown

@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"

ghost commented Jan 2, 2019

Copy link
Copy Markdown

Hey, thank you all. You really helped me.

ghost commented Jan 28, 2019

Copy link
Copy Markdown

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

chrisdothtml commented Jan 30, 2019

Copy link
Copy Markdown

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

#103

#<span></span>103

@scottdorman

Copy link
Copy Markdown

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

J0hnL0cke commented May 5, 2020

Copy link
Copy Markdown

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

baflo commented Jun 16, 2020

Copy link
Copy Markdown

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
Copy Markdown

My hero! =D

@potados99

Copy link
Copy Markdown

Thank you!

@samyakranjan

Copy link
Copy Markdown

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

jddcef commented Oct 4, 2020

Copy link
Copy Markdown

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

ghost commented Nov 13, 2021

Copy link
Copy Markdown

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

Nakilon commented Mar 13, 2022

Copy link
Copy Markdown

I wonder what is the official solution.

ghost commented Mar 13, 2022

Copy link
Copy Markdown

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
Copy Markdown

Thanks!

@deven

deven commented Mar 9, 2024

Copy link
Copy Markdown

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
Copy Markdown

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.

@quicktrick

Copy link
Copy Markdown

embedding &zwnj; (zero-width-non-joiner)- used for controlling ligature behavior

@nitzmahone, thanks a lot, man! It was the only way that worked in my case.

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