Reputation: 441
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?
Upvotes: 27
Views: 21716
Reputation: 66264
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)
Upvotes: 35
Reputation: 479
Anchor links work on my Bitbucket server but don't work in VS Code unfortunately.
[link](#section)
## Code and Syntax highlighting <a name="section"></a>
Upvotes: 15