Sphinx automatic image numbering / captions?

Is there a way to automatically generate an image / picture caption using sphinx?

Currently, I have rest-sphinx files that I convert to html and (latex) pdf using sphinx.

I would like users to be able to link to a specific image in the resulting html / pdf files. For example, if a user refers to the documentation in an email, “Image 65 says“ XXX, ”but that doesn't work for me.”

I tried using figure , where it allows you to apply the caption to the image, but you need to add it manually, (And I have problems getting it to work with substitution for some reason).

Is there a rest-sphinx method that I don't notice to achieve this? Or is there a way to modify / modify existing sphinx templates to add this ability?

+3
source share
1 answer

Sphinx uses reStructuredText as a Jinja template . However, according to the Sphinx documentation, you have other template options .

You should be able to use the Jinja control structure in your custom template to achieve the effect you need.

+2
source

Source: https://habr.com/ru/post/1707398/


All Articles