Skip to content

Commit

Permalink
Merge pull request #3076 from agriyakhetarpal/download-notebooks
Browse files Browse the repository at this point in the history
Add an option to download Jupyter notebooks from readthedocs
  • Loading branch information
valentinsulzer committed Jun 28, 2023
2 parents ea95ee8 + 3a1c00c commit 7aefb87
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,15 @@

nbsphinx_prolog = r"""
{% set docname =
{% set github_docname =
'github/pybamm-team/pybamm/blob/develop/docs/' +
env.doc2path(env.docname, base=None) %}
{% set readthedocs_download_url =
'https://docs.pybamm.org/en/latest/' %}
{% set doc_path = env.doc2path(env.docname, base=None) %}
.. raw:: html
<div class="admonition tip">
Expand All @@ -280,11 +285,18 @@
<p>
An interactive online version of this notebook is available, which can be
accessed via
<a href="https://colab.research.google.com/{{ docname | e }}"
<a href="https://colab.research.google.com/{{ github_docname | e }}"
target="_blank">
<img src="https://colab.research.google.com/assets/colab-badge.svg"
alt="Open this notebook in Google Colab"/></a>
</p>
<hr>
<p>
Alternatively, you may
<a href="{{ readthedocs_download_url | e }}{{ doc_path | e }}"
target="_blank" download>
download this notebook</a> and run it offline.
</p>
</div>
"""
Expand Down

0 comments on commit 7aefb87

Please sign in to comment.