Skip to content

Commit

Permalink
Try changing the nbsphinx_prolog to kikuchipy's
Browse files Browse the repository at this point in the history
  • Loading branch information
viljarjf committed Sep 6, 2024
1 parent cfca12b commit c8b3ee7
Showing 1 changed file with 14 additions and 29 deletions.
43 changes: 14 additions & 29 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,35 +152,20 @@
# This is processed by Jinja2 and inserted before each notebook
nbsphinx_prolog = (
r"""
{% set docname = 'doc/' + env.doc2path(env.docname, base=None) %}
.. raw:: html
<style>a:hover { text-decoration: underline; }</style>
<div class="admonition note">
This page was generated from
<a class="reference external" href="https://github.com/pyxem/pyxem-demos/blob/"""
+ f"{release_version}"
+ r"""/{{ docname|e }}">{{ docname|e }}</a>.
Interactive online version:
<span style="white-space: nowrap;"><a href="https://mybinder.org/v2/gh/pyxem/pyxem-demos/"""
+ f"{release_version}"
+ r"""?filepath={{ docname|e }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>.</span>
<script>
if (document.location.host) {
$(document.currentScript).replaceWith(
'<a class="reference external" ' +
'href="https://nbviewer.jupyter.org/url' +
(window.location.protocol == 'https:' ? 's/' : '/') +
window.location.host +
window.location.pathname.slice(0, -4) +
'ipynb">View in <em>nbviewer</em></a>.'
);
}
</script>
</div>
.. raw:: latex
\nbsphinxstartnotebook{\scriptsize\noindent\strut
\textcolor{gray}{The following section was generated from
\sphinxcode{\sphinxupquote{\strut {{ docname | escape_latex }}}} \dotfill}}
{% set docname = 'doc/' + env.doc2path(env.docname, base=None)[:-6] + '.ipynb' %}
.. admonition:: Live notebook
You can run this notebook in a `live session <https://mybinder.org/v2/gh/pyxem/pyxem-demos/"""
+ release_version
+ r"""?filepath={{ docname|e }}>`__ |Binder| or view it `on Github <https://github.com/pyxem/pyxem-demos/blob/"""
+ release_version
+ r"""/{{ docname|e }}>`__.
.. |Binder| image:: https://static.mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/pyxem/pyxem-demos/"""
+ release_version
+ r"""?filepath={{ docname|e }}
"""
)
# https://nbsphinx.readthedocs.io/en/0.8.0/never-execute.html
Expand Down

0 comments on commit c8b3ee7

Please sign in to comment.