-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add binder links #93
Add binder links #93
Conversation
I think README and examples should be enough. BTW, part of my upcoming examples refresh involves adding numbers to the notebooks. That will:
|
Perfect, then this one is ready for a review
Sounds great 😄 |
@dwhswenson (just FYI for the possibilities of binder; the strangest |
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.
Suggesting a little modification to move the Binder link higher up in the main examples page. Also, here's a better discussion of images/links/substitutions in RST than the one I linked in that comment:
Not necessarily for this PR, but nbsphinx has a trick for adding frontmatter that can automatically include a link to the relevant notebook on Binder:
(That link is also an example of this specific use in action.)
Consider that optional; if it is a pain to do, don't worry, but if it's easy, it would be nice. I don't mind having a Binder link for each page on RTD; I just didn't want to put Binder links in each ipynb, since it doesn't make sense if you've already loaded it locally.
So I got it working, but this only works for releases if the docs are build from a release install of [EDIT]
|
nvm, fixed it |
Alright, I also added |
html_context = {"release": release, | ||
"version": version} |
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.
These will be the variables that are available to jinja2
code in the .rst
return | ||
src = source[0] | ||
rendered = app.builder.templates.render_string( | ||
src, app.config.html_context |
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.
this html_context
is the dictionary build on line 69
and will provide the variables that jinja2
will put in scope during rendering.
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 very small change, then it looks good!
Co-authored-by: David W.H. Swenson <dwhs@hyperblazer.net>
Thanks! Corrected that one |
after pr #92
This PR adds the repective binder links to the
README.md
jinja2
rendering for all.rst
your docs(@dwhswenson any place missing? for example I can add a link to each
ipynb
that would start binder for themself)