Using ref-gallery in Python Docs#
Here is an example demonstrating how to use the ref-gallery
directive in your python code documentation.
myst_sphinx_gallery/directives.py#
def gallery_example(self) -> None:
"""Serve as an example for the ``ref-gallery`` directive in code docs.
.. ref-gallery::
:tooltip:
examples/alt/rst image
examples/first_last/first
examples/code_markdown/first code
"""
The documentation for this function will display a gallery as follows:
- myst_sphinx_gallery.directives.RefGalleryDirective.gallery_example(self) None
Serve as an example for the
ref-gallerydirective in code docs.