Images and figures#
MyST Markdown can be used to include images and figures in your documents as well as referencing those images easily throughout your project.
1. Inline images#
The standard Markdown syntax for images is:
![fishy](img/fun-fish.png)
This will create an inline image, which is displayed in the flow of the text.
The attrs_inline extension can be used to add attributes to an inline image:
The html_image extension can also be used, to allow MyST to parse HTML image tags:
2. Block level images#
To create a block image, use the image
directive:
The following options are recognized:
Image options
alt
: textAlternate text: a short description of the image, displayed by applications that cannot display images, or spoken by applications for visually impaired users.
height
: lengthThe desired height of the image. Used to reserve space or scale the image vertically. When the “scale” option is also specified, they are combined. For example, a height of 200px and a scale of 50 is equivalent to a height of 100px with no scale.
width
: length or percentage of the current line widthThe width of the image. Used to reserve space or scale the image horizontally. As with “height” above, when the “scale” option is also specified, they are combined.
scale
: integer percentage (the “%” symbol is optional)The uniform scaling factor of the image. The default is “100 %”, i.e. no scaling.
align
: “top”, “middle”, “bottom”, “left”, “center”, or “right”The values “top”, “middle”, and “bottom” control an image’s vertical alignment
The values “left”, “center”, and “right” control an image’s horizontal alignment, allowing the image to float and have the text flow around it.
target
: text (URI or reference name)Makes the image into a hyperlink reference (“clickable”).
class
A space-separated list of CSS classes to add to the image.
name
A reference target for the admonition (see cross-referencing).
4. Figures with multiple images#
See the sphinx-subfigure extension for a way to create figures with multiple images.