Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I link to a Markdown section of my Bitbucket README?

I'm trying to create a link to a section of the README file of my Bitbucket repository. The following works as expected on GitHub, but not on Bitbucket. What am I doing wrong?

## Navigation
[1. GIT To Work](#git)

... 

## 1. Git To Work - Working with git<a name="git"></a>
### What is git?
like image 351
Cruzito Avatar asked Mar 22 '15 11:03

Cruzito


1 Answers

One peculiarity of Bitbucket's Markdown "flavour" is the way it names heading identifiers. If you inspect the HTML source of your Bitbucket README page (by default accessible at https://bitbucket.org/<username>/<reponame>), you'll see that the Markdown section

## 1. Git To Work - Wording with git

translates to the following HTML heading element:

<h2 id="markdown-header-1-git-to-work-working-with-git">1. Git To Work - Working with git</h2>

Note that Bitbucket uses, as the value of the id attribute, a URL-friendly version of your heading, prefixed by markdown-header-. Therefore, you can create a link to the corresponding section, in your Markdown code, using

[Link to Git](#markdown-header-1-git-to-work-working-with-git)
like image 68
jub0bs Avatar answered Nov 16 '22 03:11

jub0bs