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 votes
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 Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

656 views 0 4
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot