How to write a table of contents in a Readme.md?

Hi,

I'm trying to add a table of contents into a Readme.md for one of my repositories but I can't find a way to do it.

I tried to use the same syntax as GitHub, something similar to:

# Table of Contents

1. [My first title](#my-first-title)
2. [My second title](#my-second-title)
## My first title
Some text.
## My second title

But it doesn't work. Nothing happens when I click on the links generated into the ToC.

I'm running Bitbucket server 5.4. Is it possible to do such a thing please? I didn't find anything relevant into the Atlassian documentation.

Thanks for your help.

Guillaume.

2 answers

0 vote
Gonchik Tsymzhitov Community Champion Nov 19, 2017

Hi Guillaume, 

Have you tried this tutorial for README.md? 

https://bitbucket.org/tutorials/markdowndemo/overview#markdown-header-tables

 

 

Hope it helps.

 

Cheers,

Gonchik Tsymzhitov

Hi Gonchik,

Thank you for your help, but it doesn't answered my question. I'm not trying to create a table (I have no problems for this), but a table of contents.

Like:

Sélection_041.png

In other words: a list of links to the titles inside the README.

Guillaume.

You need to add "markdown-header-" to your link parentheses.



1. [My First Title](#markdown-header-my-first-title)

2. [My Second Title](#markdown-header-my-second-title)

 

This worked for me.

This didn't work for me I tried with and without `markdown-header-`

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

71 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you