Skip to content

Conversation

@m12watanabe1a
Copy link
Contributor

Features

Add linkcheck ignore settings

  • Ignore local url
  • Ignore anchor

Related

#4209

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although this is not perfect solution for #4209, it can exclude local links and anchors. that i think the improvement to take.

@ros2/team what do you think?

Copy link
Collaborator

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with green CI

@kscottz
Copy link
Collaborator

kscottz commented May 29, 2024

Cool! Thanks!

conf.py Outdated
linkcheck_ignore = [
r"^(?!http(|s):\/\/).*", # For ignore local link
]
linkcheck_anchors = False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we should use https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-linkcheck_anchors_ignore_for_url instead. In particular, I that will still check that the URL is valid, it just won't check that the anchor is valid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. So I would use linkcheck_anchors_ignore_for_url instead for

  • https://index.ros.org
  • https://github.com

Thank you so much for the suggestions.

conf.py Outdated

# -- Options for linkcheck ------------------------------------------------
linkcheck_ignore = [
r"^(?!http(|s):\/\/).*", # For ignore local link
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain exactly what we are skipping here? An example of a link that this is skipping would help.

Copy link
Contributor Author

@m12watanabe1a m12watanabe1a Jun 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The local link which does not start from https:// or http:// are ignored here.
This is for the link like ../../humble/Installation.htm which refers to the different distro that didn't build with a particular branch but exists on the published document.

However, this way of implementation ignores all local links and possibly passes the real broken links like #4488.

So to prevent those cases, it is better to add local links one by one manually

linkcheck_ignore = [
    r"../../(humble|galactic|etc..)/Installation.htm",  # For ignore local link

If you prefer the former, I will modify it accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants