sphinx_gallery.directives

Custom Sphinx directives

Functions

sphinx_gallery.directives.depart_imgsg_html(self, node)[source]
sphinx_gallery.directives.depart_imgsg_latex(self, node)[source]
sphinx_gallery.directives.directive_boolean(value)[source]
sphinx_gallery.directives.imagesg_addnode(app)[source]
sphinx_gallery.directives.visit_imgsg_html(self, node)[source]
sphinx_gallery.directives.visit_imgsg_latex(self, node)[source]
sphinx_gallery.directives.visit_sg_other(self, node)[source]

Classes

class sphinx_gallery.directives.ImageSg(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]

Implements a directive to allow an optional hidpi image. Meant to be used with the image_srcset configuration option.

e.g.:

.. image-sg:: /plot_types/basic/images/sphx_glr_bar_001.png
    :alt: bar
    :srcset: /plot_types/basic/images/sphx_glr_bar_001.png,
             /plot_types/basic/images/sphx_glr_bar_001_2_0x.png 2.0x
    :class: sphx-glr-single-img

The resulting html is:

<img src="sphx_glr_bar_001_hidpi.png"
    srcset="_images/sphx_glr_bar_001.png,
            _images/sphx_glr_bar_001_2_0x.png 2x",
    alt="bar"
    class="sphx-glr-single-img" />
class sphinx_gallery.directives.MiniGallery(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine)[source]

Custom directive to insert a mini-gallery

The required argument is one or more fully qualified names of objects, separated by spaces. The mini-gallery will be the subset of gallery examples that make use of that object (from that specific namespace).

Options:

  • add-heading adds a heading to the mini-gallery. If an argument is provided, it uses that text for the heading. Otherwise, it uses default text.

  • heading-level specifies the heading level of the heading as a single character. If omitted, the default heading level is ‘^’.

class sphinx_gallery.directives.imgsgnode(rawsource='', *children, **attributes)[source]