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