Skip to content
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

Merged
merged 3 commits into from
Apr 4, 2023
Merged

Fix documentation issues #655

merged 3 commits into from
Apr 4, 2023

Conversation

marcinz
Copy link
Collaborator

@marcinz marcinz commented Mar 29, 2023

Need to generate heading anchors and the link must be absolute to work in Sphinx.

@marcinz
Copy link
Collaborator Author

marcinz commented Mar 29, 2023

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?

@bryevdv
Copy link
Contributor

bryevdv commented Apr 3, 2023

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:

https://github.com/bokeh/bokeh/blob/74b1f1a227dd1aa4735caa13199e79986b7e67f5/src/bokeh/sphinxext/bokeh_roles.py#L176-L203

    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.

@bryevdv
Copy link
Contributor

bryevdv commented Apr 3, 2023

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.

@manopapad
Copy link
Contributor

For the README, we could point a link to HEAD, and that is supposed to always go to the current default 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.

Copy link
Contributor

@bryevdv bryevdv left a 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>
@marcinz marcinz merged commit 3aff5e4 into nv-legate:branch-23.05 Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:documentation documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants