Skip to content

Commit

Permalink
Add example notebooks in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
flferretti committed Jun 21, 2024
1 parent 99f84fc commit ab08085
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 2 deletions.
30 changes: 30 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"sphinx_autodoc_typehints",
"sphinx_multiversion",
"enum_tools.autoenum",
"myst_nb",
"sphinx_gallery.gen_gallery",
"sphinxcontrib.collections",
"sphinx_design",
]

Expand All @@ -72,3 +75,30 @@
autosummary_generate = False

epub_show_urls = "footnote"

# -- Options for sphinx-collections

collections = {
"examples": {"driver": "copy_folder", "source": "../examples/", "ignore": "assets"}
}

# -- Options for sphinx-gallery ----------------------------------------------

sphinx_gallery_conf = {
"examples_dirs": "_collections/examples",
"gallery_dirs": ("_collections/generated_examples/"),
"ignore_pattern": r"_test\.py",
"doc_module": "jaxsim",
"backreferences_dir": os.path.join("modules", "generated"),
}

# -- Options for myst -------------------------------------------------------
myst_enable_extensions = [
"amsmath",
"dollarmath",
]
nb_execution_mode = "force"
nb_execution_allow_errors = False
nb_render_image_options = {}

source_suffix = [".rst", ".md", ".ipynb"]
42 changes: 42 additions & 0 deletions docs/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.. _examples:

Example Notebooks
=================

.. toctree::
:glob:
:hidden:
:maxdepth: 1

_collections/examples/README.md

.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="Parallel Simulation.">

.. only:: html

:doc:`_collections/examples/Parallel_computing`

</div>


.. raw:: html

<div class="sphx-glr-thumbnail-title">Parallel Simulation</div>
</div>

.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="PD Controller.">

.. only:: html

:doc:`_collections/examples/PD_Controller`

</div>

.. raw:: html

<div class="sphx-glr-thumbnail-title">PD Controller</div>
</div>
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ Features

.. toctree::
:hidden:
:maxdepth: 1
:caption: User Guide

guide/install

examples

.. toctree::
:hidden:
:maxdepth: 1
Expand Down
4 changes: 4 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ dependencies:
- filecache
- filelock
- jinja2
- myst-nb
- pip
- sphinx
- sphinx-autodoc-typehints
- sphinx-book-theme
- sphinx-copybutton
- sphinx-design
- sphinx_fontawesome
- sphinx-gallery
- sphinx-jinja2-compat
- sphinx-multiversion
- sphinx_rtd_theme
Expand All @@ -53,3 +55,5 @@ dependencies:
# Other dependencies for GitHub Codespaces
# ========================================
- ipython
- pip:
- sphinx-collection # TODO (flferretti): PR to conda-forge

0 comments on commit ab08085

Please sign in to comment.