Azure DevOps markdown preview in repo: heading anchors rendering as work item links

Viewed 420

I have a markdown file in my Azure DevOps repo. The file has a TOC that uses heading anchors:

- [1. Abstract](#1.-abstract)
- [2. Table of contents](#2.-table-of-contents)
- [3. Introduction](#3.-introduction)
  - [3.1. Recommended reading](#3.1.-recommended-reading)

## 1. Abstract
...
## 2. Table of contents
...
## 3. Introduction
...
### 3.1. Recommended reading

The links work in vs code and any other editor that I use. In Azure DevOps, when navigating to the file and selecting preview, the heading anchors are being rendered as Azure DevOps work item links:

enter image description here

Is there a way to use heading anchors without having them link to work items within Azure DevOps?

1 Answers

Instead of manually creating the anchor links you can use the TOC directive. It works not only in the wiki, but also in the preview pane for markdown files.

[[_TOC_]]

## 1. Abstract
...
## 2. Table of contents
...
## 3. Introduction
...
### 3.1. Recommended reading

The result will look like the following (The links are anchor links to each heading)

Exmaple of how TOC looks

Related