diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index 64ea08b73ff..84caacb723e 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -18,6 +18,8 @@ dependencies: - iris - jupyter_client - jupyter_sphinx + - jupyterlite-sphinx + - jupyterlite-pyodide-kernel - matplotlib-base - nbsphinx - ncdata diff --git a/doc/conf.py b/doc/conf.py index 4a0cca2ddab..fa0c6d36b5e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -71,6 +71,7 @@ "sphinx_design", "sphinx_inline_tabs", "sphinx_remove_toctrees", + "jupyterlite_sphinx", ] @@ -179,17 +180,26 @@ "pd.Index": "~pandas.Index", "pd.NaT": "~pandas.NaT", } - autodoc_type_aliases = napoleon_type_aliases # Keep both in sync +# jupyterlite try_examples config +global_enable_try_examples = True +try_examples_global_button_text = "Try it in your browser!" +try_examples_global_warning_text = "Interactive examples are experimental and may not always work as expected." + +def try_examples_preamble(): + import numpy as np + import pandas as pd + import xarray as xr + # mermaid config mermaid_version = "11.6.0" # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates", sphinx_autosummary_accessors.templates_path] -# The master toctree document. -master_doc = "index" +# The starting document. +root_doc = "index" remove_from_toctrees = ["generated/*"] # The language for content autogenerated by Sphinx. @@ -211,7 +221,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ["_build", "debug.ipynb", "**.ipynb_checkpoints"] +exclude_patterns = ["_build", "debug.ipynb", "**.ipynb_checkpoints", "_contents"] # The name of the Pygments (syntax highlighting) style to use. diff --git a/doc/try_examples.json b/doc/try_examples.json new file mode 100644 index 00000000000..47b9a700048 --- /dev/null +++ b/doc/try_examples.json @@ -0,0 +1,3 @@ +{ + "global_min_height": "400px" +}