How to unlink autolinked bitbucket readme markdown

*爱你&永不变心* 提交于 2020-01-25 18:28:11

问题


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!


回答1:


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



回答2:


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`


来源:https://stackoverflow.com/questions/27145878/how-to-unlink-autolinked-bitbucket-readme-markdown

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!