pydata-sphinx-theme
pydata-sphinx-theme copied to clipboard
ENH: Automatically shorten links for GitHub/GitLab
Fixes #841
I discover that Sphinx is already doing the same kind of operation for kbd Litteral nodes: https://github.com/sphinx-doc/sphinx/blob/5.x/sphinx/builders/html/transforms.py
So I adapted the code to read all the links on the pages (reference nodes). I'm taking the one from GitHub and GitLab at the moment and I'm shortening them using the same structure as the GitHub one i.e. <username>/<repository>#<id>. If some parameters are missing I just drop it.
I added an example here: https://pydata-sphinx-theme--957.org.readthedocs.build/en/957/user_guide/theme-elements.html#link-shortening
let me know what you think!
I think this is pretty cool! +1 on the functionality from me but I haven't given the code a deep look.
I'm trying to fix the codecov tests sorry for the noise
@choldgraf, it's done the PR is ready for review