Fix broken relative links in README and CHANGELOG for both GitHub and Sphinx#2530
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2530 +/- ##
=======================================
Coverage 99.15% 99.15%
=======================================
Files 41 41
Lines 3090 3090
Branches 668 668
=======================================
Hits 3064 3064
Misses 14 14
Partials 12 12 🚀 New features to boost your workflow:
|
DanielNoord
left a comment
There was a problem hiding this comment.
Can we put the generated files in _build to keep the gitignore (and all generated files) in the same place?
Rest of this LGTM from a first glance.
|
Can you look into the failing docs build? :) |
Hey Daniel! I've updated the PR with the requested type annotations. Regarding the failing build: it turns out Sphinx excludes the _build folder by default, which was causing the include failure on RTD. I've moved the generated files to a new generated/ directory (added to .gitignore) and switched to absolute paths to make the build rock-solid. Let me know if everything looks good now! :) |
Fixes #2526
This PR resolves the broken relative links in
README.mdandCHANGELOG.mdwhen rendered on GitHub, while ensuring they continue to work correctly within the Sphinx documentation build.The Solution
I have implemented a dual-context solution:
README.mdandCHANGELOG.mdnow usedocs/paths. Since these files sit at the repository root, these links now resolve correctly on GitHub.docs/conf.pythat generates temporary Sphinx-friendly include files (_readme_include.mdand_changelog_include.md). This hook strips thedocs/prefix from relative links during the build process.docs/index.rstanddocs/changelog.rstto include these generated files.This approach ensures that both GitHub visitors and ReadTheDocs readers have a seamless experience with working internal links.
Changes
docs/prefix.builder-initedandbuild-finishedhooks to handle the dynamic link rewriting for Sphinx._includefiles to prevent accidental commits.