-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix documentation issues #655
Conversation
for more information, see https://pre-commit.ci
Unfortunately, to create a link to the file, one must hardcode the version of the tree. That creates an issue where this must be updated periodically. @bryevdv, is there a better way to do that? |
Not that I am aware of, out of the box. For Bokeh we created a custom sphinx role to link to the right branch automatically: app = inliner.document.settings.env.app
tag = app.env.config["version"]
if "-" in tag:
tag = "main"
url = f"{BOKEH_GH}/tree/{tag}/{text}"
options = options or {}
set_classes(options)
node = nodes.reference(rawtext, text, refuri=url, **options)
return [node], [] I could add a similar directive to our Sphinx setup if that's desired. We just need to be able to get the version from somewhere in the config. |
Though, apologies, I just realized this was in the README, not the sphinx docs. The custom role will really only help for versioning repo links that are in ReST sources. For the README, we could point a link to HEAD, and that is supposed to always go to the current default branch, not sure if that is more or less desirable. If we want the README to be correct "per-branch" then I think we will just be stuck updating the link in the README every time we rev a new branch. |
I think we can just do that for now. The plan is to move away from copying the .md files to the sphinx tree anyway, and at that point we can remove this explicit link from README.md. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one suggestion
Co-authored-by: Bryan Van de Ven <bryan@bokeh.org>
Need to generate heading anchors and the link must be absolute to work in Sphinx.