How to unlink autolinked bitbucket readme markdown

1.7k views Asked by At

BitBucket uses a MarkDown to render the 'index page' with the readme.md file which is in our repository.

There is a string in the readme.md file which looks like a commit hash 'a68c7c33f98668bea65636a7462a94f17446e151' but it isn't.

Now apperently bitbucket uses urlize (projekt from django) to autolink everything usefull in our readme.md.

This is useful for links but not when this hash, which is not a commit has, becomes a link to a commit which doesn't exist.

I'm looking now for a simple way to unlink this hash without marking it as sourcecode.

Anyone an idea?

Thank you!

2

There are 2 answers

0
Chris On BEST ANSWER

Atlassian's documentation specifies that 7-40 hex characters will be automatically linked.

You could prefix your hash with enough zeroes to surpass the 40 character threshold, e.g.

0a68c7c33f98668bea65636a7462a94f17446e151

or add a 0x hexadecimal indicator, e.g.

0xa68c7c33f98668bea65636a7462a94f17446e151

to prevent the auto-linking.

Alternatively, you could insert a syntactically null value like []() (an empty link) between every six hex characters, so each segment is below the seven character threshold:

a68c7c[]()33f986[]()68bea6[]()5636a7[]()462a94[]()f17446[]()e151
1
adkisson On

You could wrap it in backticks as an inline code block. It is easily readable in the markdown and avoids the 6 empty anchor tags in the html. Those empty anchor tags break copy/paste in the editors I tried. Unfortunately it causes monospace formatting, so it is a trade-off.

`0xa68c7c33f98668bea65636a7462a94f17446e151`