sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.43k stars 2.1k forks source link

Warning for invalid relative link anchors #5128

Open asmeurer opened 6 years ago

asmeurer commented 6 years ago

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.

tk0miya commented 6 years ago

+1: reasonable.