Skip to main content
Ctrl+K
MyST Sphinx Gallery v0.3.0 documentation - Home
  • User Guide
  • Demo Gallery
  • API Reference
  • Contributing Guide
  • About
  • GitHub
  • PyPI
  • User Guide
  • Demo Gallery
  • API Reference
  • Contributing Guide
  • About
  • GitHub
  • PyPI

Section Navigation

Thumbnail selection strategies

  • Using alt attribute
    • Rst Image Directive
    • Rst Figure Directive
    • Markdown Conventional Image Syntax
    • Markdown Image Directive
    • Markdown Figure Directive
    • Notebook Conventional Image Syntax
    • Notebook Image Directive
    • Notebook Figure Directive
  • first/last Strategy
    • first strategy
    • last strategy
  • Code/Markdown Strategy for Notebooks
    • code | first strategy
    • code | last strategy
    • markdown | first strategy
    • markdown | last strategy
    • markdown | alt strategy
  • Default Gallery Thumbnail
    • Default Thumbnail

Ref Gallery

  • Using ref-gallery in Python Docs
  • ref-gallery in RST files
  • Demo Gallery
  • Using...

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-gallery directive in code docs.

Rst Image Directive
../alt/rst%20image.html
first strategy
../first_last/first.html
code | first strategy
../code_markdown/first%20code.html

previous

Default Thumbnail

next

ref-gallery in RST files

Edit on GitHub
Show Source

© Copyright 2024, Fan Chengyan (Fancy).

Created using Sphinx 8.0.2.

Built with the PyData Sphinx Theme 0.15.4.