dotnet / dotnet/docfx

Use xref target heading instead of first heading as link title

Open
#2,657 2 comments 1 reaction 0 assignees View on GitHub
xref
Dominant language
C#
Stars
4.4k
Forks
890
Avg merge
2h 11m
Merged PRs (30d)
10

Description

**Feature request**

xref can link to the middle of a document using #. Documentation says:

> Title is extracted from the first heading of the Markdown file. Or you can also specify title
> using title metadata.

When linking to the middle of a document, I almost always want to use the _target_ heading as the title, and almost never the _first_ heading, as is the current default. I therefore have to specify the link text explicitly every time, and also keep the link text in sync with the target heading, which is onerous and error prone.

**Expected Behavior**:

If an xref links to the _middle_ of a document, use the _target_ heading text as the link text.

**Actual Behavior**:

If an xref links to the _middle_ of a document, the _first_ heading text is used as the link text.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.