jupyterlite / jupyterlite-sphinx

Sphinx extension using JupyterLite to render Notebooks
https://jupyterlite-sphinx.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
68 stars 21 forks source link

Add a loading spinner for TryExamples directive. #133

Closed steppi closed 9 months ago

steppi commented 9 months ago

Closes #120

This PR adds a loading spinner for the TryExamples directive. I've offered no options to customize the spinner because I don't have sufficient time to think about how to do that cleanly and document it properly. My goal is just to get this working before submitting a PR adding interactive docs to SciPy. We can revisit later.

I've also fixed a bug where I was referring to a configuration variable which no longer exists (it only occurs when global_enable_try_examples = True), and I've added a link to try_examples.css in the try examples documentation to make it easier for readers to find that file.

steppi commented 9 months ago

I've deployed SciPy's docs built against this feature branch. You can check out the spinner in action here https://steppi.github.io/scipy/reference/generated/scipy.stats.kurtosistest.html#scipy.stats.kurtosistest

steppi commented 9 months ago

@martinRenou, I've added the spinner for the other directives too. I also see what you mean now about the spinner not being centered. If we have left and top at 50% then the top and left are in the center and we need to add negative margins to actually center the spinner. I've also changed how the spinner is placed for the try examples directive to put it in the center if the center is in view, otherwise halfway between the top of the iframe and the bottom of the viewport.

steppi commented 9 months ago

SciPy docs incorporating the updates are up now: https://steppi.github.io/scipy/reference/generated/scipy.stats.kurtosistest.html#scipy.stats.kurtosistest