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

“Edit on GitHub” for autosummary (code inside!) #28

Open
flying-sheep opened this issue Aug 29, 2017 · 1 comment
Open

“Edit on GitHub” for autosummary (code inside!) #28

flying-sheep opened this issue Aug 29, 2017 · 1 comment

Comments

@flying-sheep
Copy link

When using autosummary, the .rst files are only stubs, and can be autogenerated (which would make them volatile and ideally not under version control).

it would be much more useful to link to the actual source code. i created this to achieve that (GitHub specific but easily generalizable).

we should include this as an option in the readthedocs extension. fortunately, injecting the template directory from the gist between autosummary’s default template dir and the user’s template dir will work perfectly, and just add the :github_url: field list entry.


as an aside: sadly i had to use a hack, and add a filter to jinja2.defaults.DEFAULT_FILTERS. this is because the environment of the autosummary templates has no potential for extension (e.g. html_context is not used). this should be fixed in sphinx.

@mgeier
Copy link

mgeier commented Apr 18, 2020

Is there any news on this?

An alternative approach to solve this problem might be to check with git whether the source file is checked into Git (if not, it was likely auto-generated locally).

I've added this as a feature to my (very fresh) Sphinx extension mgeier/sphinx-last-updated-by-git#7.

This extension un-defines the sourcename context value for files that are not versioned by Git. I'm not sure whether this would work for readthedocs-sphinx-ext, but you might want to give it a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants