File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 215215 "github_user" : "OceanParcels" ,
216216 "github_repo" : "parcels" ,
217217 "github_version" : "main" ,
218- "doc_path" : "docs" ,
218+ "doc_path" : "docs"
219219}
220220
221221
@@ -384,6 +384,26 @@ def linkcode_resolve(domain, info):
384384nbsphinx_execute = "never"
385385# -- Options for LaTeX output ---------------------------------------------
386386
387+ # -- Detect branch name -----------------------------------
388+ # Works on GitHub Actions, ReadTheDocs, and local fallback
389+ BRANCH = (
390+ os .environ .get ("GITHUB_REF_NAME" ) # GitHub Actions
391+ or os .environ .get ("READTHEDOCS_VERSION" ) # ReadTheDocs
392+ or "main" # fallback
393+ )
394+
395+ nbsphinx_prolog = f"""
396+ .. raw:: html
397+
398+ <a href="https://mybinder.org/v2/gh/OceanParcels/Parcels/{ BRANCH } ?urlpath=lab/tree/docs/{{{{ env.doc2path(env.docname, base=None) }}}}" target="_blank">
399+ <img alt="Binder badge" src="https://mybinder.org/badge_logo.svg">
400+ </a>
401+ or view it
402+ <a href="https://github.com/OceanParcels/Parcels/blob/{ BRANCH } /docs/{{{{ env.doc2path(env.docname, base=None) }}}}" target="_blank">
403+ on GitHub
404+ </a>
405+ """
406+
387407latex_elements = {
388408 # The paper size ('letterpaper' or 'a4paper').
389409 # 'papersize': 'letterpaper',
You can’t perform that action at this time.
0 commit comments