Dims
Dims

Reputation: 51039

Is it possible embed pictures into docstring in Python?

Is it possible embed pictures into docstring in Python?

I saw docpicture keyword somewhere, but can't find doc on it. Is it stabdartized or not?

Where does picture should located?

UPDATE

I tried Sphinx notation, but my PyCharm shows

enter image description here

i.e. it sees that it should be an image here, but doesn't see image file.

Where I would put if used Sphinx?

Upvotes: 3

Views: 3678

Answers (1)

Felk
Felk

Reputation: 8224

That depends on what tool you use for processing your docstring. Check your tool's documentation to find out how to embed images.

For example, if you are using Sphinx, you can use the image directive, as described in this StackOverflow answer:

.. image:: example.png

Regarding the location of the image, the documentation states:

When used within Sphinx, the file name given [...] must either be relative to the source file, or absolute which means that they are relative to the top source directory. For example, the file sketch/spam.rst could refer to the image images/spam.png as ../images/spam.png or /images/spam.png.

Upvotes: 6

Related Questions