Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make linkcheck wrongly reports valid anchors as broken for certain links #9255

Closed
mara004 opened this issue May 20, 2021 · 3 comments
Closed

Comments

@mara004
Copy link

mara004 commented May 20, 2021

Description
make linkcheck reports certain links with anchor would be broken, altough they are not.
Example: https://framagit.org/peppercarrot/wiki/-/blob/master/Creatures.md#phanda

Steps to Reproduce

  • initialise a new documentation via sphinx-quickstart
  • create a file with the aforementioned link connected to index.rst
  • run make linkcheck
(...)    broken    https://framagit.org/peppercarrot/wiki/-/blob/master/Creatures.md#phanda - Anchor 'phanda' not found

Expected behavior
The link is valid and works from the browser, hence it should be reported as ok rather than broken

Environment info

  • OS: KDE Neon User 5.21.5 (Linux)
  • Python version: 3.8.5
  • Sphinx version: 3.5.3
  • Extra tools: Chromium M90

→ Potential duplicate of #9016

@mara004
Copy link
Author

mara004 commented May 20, 2021

As the discussion on #9016 suggests, this is hard to fix. Would it be possible to rather report not-found anchors as partly ok or something like this as a workaround?

@mara004 mara004 changed the title <what happen when you do on which document project> make linkcheck wrongly reports anchors as broken for certain links May 20, 2021
@mara004 mara004 changed the title make linkcheck wrongly reports anchors as broken for certain links make linkcheck wrongly reports valid anchors as broken for certain links May 20, 2021
@bskinn
Copy link
Contributor

bskinn commented May 20, 2021

Concur, having not-found anchors report as a warning, instead of a hard error, would be useful for me, too.

Adding a config/CLI option to convert these linkcheck warnings to errors would be a nice feature also.

@tk0miya
Copy link
Member

tk0miya commented May 22, 2021

It seems the HTML returned from https://framagit.org/peppercarrot/wiki/-/blob/master/Creatures.md does not contains #phanda anchor.

$ curl -s -o - -L https://framagit.org/peppercarrot/wiki/-/blob/master/Creatures.md | grep phanda
$ 

I can't find any content in the .md file also.

$ curl -s -o - -L https://framagit.org/peppercarrot/wiki/-/blob/master/Creatures.md | grep "Argiope Spiders"
$ 
$ curl -s -o - -L https://framagit.org/peppercarrot/wiki/-/blob/master/Creatures.md | grep "DragonCow"
$ 

I guess the whole of the content is lazily rendered by JavaScript. Surely this is similar to #9016. So I feel this is also difficult to resolve.

How about using linkcheck_anchors_ignore? In this case, the above link is considered as "working" with this setting:

linkcheck_anchors_ignore = ['phanda']

@mara004 mara004 closed this as completed May 31, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants