azure-devopswikiazure-devops-wiki

How to limit TOC level in wiki in Azure DevOps


I cannot see here https://learn.microsoft.com/en-us/azure/devops/project/wiki/wiki-markdown-guidance?view=azure-devops#table-of-contents-toc-for-wiki-pages any rule to do something like that:

[[__TOC__ limit:3]]

To limit the level of collected headers. Is it possible?


Solution

  • I had the same question and found a workaround. This ADO help page mentions "Only Markdown headings are considered for TOC (HTML heading tags aren't considered)."

    For example, to eliminate the duplicate page title in the embedded TOC, I used <h1>page title</h1> instead of #page title. This eliminated the page title from the embedded TOC, but the page title still rendered in the same visual style on the wiki page. The same approach worked for subtitles: using <h3>subtitle</h3> instead of ###subtitle rendered the subtitle appearing like a subtitle in the wiki page, but kept it out of the TOC.

    It's a manual approach but it helped keep the TOC simplified which is what I wanted.