Skip to content

Comments

WIP: Docs: use a Sphinx extension to eliminate excessive links#145130

Open
nedbat wants to merge 1 commit intopython:mainfrom
nedbat:nedbat/no-duplicate-links
Open

WIP: Docs: use a Sphinx extension to eliminate excessive links#145130
nedbat wants to merge 1 commit intopython:mainfrom
nedbat:nedbat/no-duplicate-links

Conversation

@nedbat
Copy link
Member

@nedbat nedbat commented Feb 22, 2026

@nedbat
Copy link
Member Author

nedbat commented Feb 22, 2026

I had a good idea: instead of writing a linter to change .rst files (pinging everyone, expecting reviews, hardcoding what's excessive, etc), now we have a Sphinx extension that does it all on the fly during the build.

@nedbat
Copy link
Member Author

nedbat commented Feb 22, 2026

Of course: if we like this, I'll publish linklint for real.

@nedbat
Copy link
Member Author

nedbat commented Feb 23, 2026

Some methods aren't unlinking properly, like ZipFile.close, but I think that's because the .rst is wrong: the methods aren't indented under the class. Is that a mistake in the .rst? Sphinx understands that "close" is "ZipFile.close", or is that because the .rst has .. method: ZipFile.close() ?

@nedbat
Copy link
Member Author

nedbat commented Feb 23, 2026

I see many classes document their methods that way, so there's more work to do.

@hugovk
Copy link
Member

hugovk commented Feb 23, 2026

In general I think this is a good idea, no big source change+pings+reviews.

We have been careful not to use third-party extensions that downstream redistributors might not have installed, and this extension would be fine: we can list it in _OPTIONAL_EXTENSIONS instead of extensions and they'll just end up with more links.


Comparing some pages that were mentioned during the discussion:

We could possibly omit links for the repeated default_factory in other paragraphs. But I understand if it's a bit risky to automate this for all paragraphs (and some are long) and anyway, it's fine to start with less unlinking and increase later.


Unlinks the second pair of str and bytes 👍


Unlinks repeats 👍

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants