sphinx-doc / sphinx

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

linkcheck: add a 'locality' reporting field to indicate local/remote handling of hyperlinks #13069

Open jayaddison opened 1 week ago

jayaddison commented 1 week ago

Is your feature request related to a problem? Please describe. The linkcheck builder is capable of checking hyperlinks that refer to network resources, and also a limited set of host-local filesystem resources.

Currently, the locality of the hyperlink is not included in the linkcheck report output; despite that, in many cases it's probably fairly clear whether each hyperlink is to a local path or remote, by inspection.

Describe the solution you'd like Although inspecting URIs is possible, I think it might be helpful to add a string-typed locality report field that indicates whether the linkcheck builder considered each hyperlink to be local or remote at runtime.

Describe alternatives you've considered

Additional context

jayaddison commented 6 days ago

Using a boolean-typed field, perhaps named is_local or simply local. This would work equally well provided that locality preserves this clear distinction -- and it may well do -- but to me it feels worth having some potential for extensibility.

Two additional locality values I can think of are: cache (according to a recent local cached result, the status of the hyperlink is ...) and archive (according to a nearby, but not necessarily same-host, archived result, the status of the hyperlink is ...).