sphinx-doc / sphinx-doc/sphinx

Warning for invalid relative link anchors

Open
#5,128 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

builder:linkcheck help wanted type:proposal
Dominant language
Python
Stars
8k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

If I have something like

`link <file.html#anchor>`_

and file.html exists and is part of the project, and #anchor is not a valid anchor for that file, it should raise a warning in the build.

Alternately, it would be nice if linkcheck checked anchors for relative links.

The problem is that I'm using recommonmark, which doesn't support cross-referencing. I'm perfectly fine writing out the anchors manually (believe me, it's worth it to support formatted text in links), but it would be nice to have some checking. Right now, I have been using the W3C validator on my site after it has been published to check for invalid anchors.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files or tests are named. Start by locating the relative-link handling and the linkcheck entry point in Sphinx, then clarify whether the accepted scope is build warnings or anchor checking there; done means invalid anchors in existing relative files are reported by the chosen path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.