sphinxcontrib-images 0.7.0¶
sphinxcontrib-images (formerly sphinxcontrib-fancybox).
How to install?¶
pip install sphinxcontrib-images
Add extension to conf.py
in your sphinx project.
extensions = [
…
'sphinxcontrib.images',
…
]
How to configure?¶
You can configure behaviour using a dictionary with options placed in conf.py
:
images_config = {
…
}
All available options with comments:
backend: | (default: ‘LightBox2’)
If Callable can be a function or a class which returns an instance of a backend to render images. The first argument is Sphinx’s app instance. Go to LightBox2 backend to see how to implement that. Each backend should implement rendering By default |
---|---|
override_image_directive: | |
(default:
|
|
cache_path: | (default : Path, where to keep downloaded images. Relative to
source (actually relative to |
requests_kwargs: | |
(default: Remote images are downloaded by requests. This
|
|
default_image_width: | |
(default: Default width of an image. Backend can use this setting to set width properly. |
|
default_image_height: | |
(default: Default height of an image. Backend can use this setting to set width properly. |
|
default_group: | (default: This setting sets the default group for images without
a defined group. If |
default_show_title: | |
(default: Defines whether a caption below the picture should be visible or not. Warning Currently this options does not work, I have no idea how to enable this feature in lightbox2. If you have any idea please do a pull request. |
|
download: | (default: Download remote images. |
Thumbnail directive¶
You can use it like:
.. thumbnail:: path/to/image.jpg
or:
.. thumbnail:: http://remote/image.jpg
You can pass options like regular Sphinxs’ directives:
.. thumbnail:: http://remote/image.jpg
:download: true
All available arguments:
group: | If you set the same group for different images the backend can group them. |
---|---|
class: | This can be used by the backend to apply some style. The straightforward use case is to define HTML classes here (LightBox2
backend puts these classes on outer |
width: | Backend can use this option to set the width of the
image. This overrides Values like:
are accepted. |
height: | Backend can use this option to set the height of the
image. This overrides Values like:
are accepted. |
alt: | If image cannot be displayed, this text will be shown. |
download: | This overrides |
title: |
be used (it will define whether to show title or not).
directive will be used as the title: .. thumbnail:: image.jpg
:title:
This will be a title
It’s up to the backend, how this will be displayed. Currently I have a problem with LightBox2 to make captions below thumbnails. If you have any idea how to solve it please write. |
align: | (default: ‘’) Align the picture. LightBox2 backend uses Values like:
are accepted. Note You may want to wrap aligned element with: .. container:: clearfix
to fix document flow. |
show_caption: | (default: Show the title as a caption below the image. Warning Enabling the caption nests the clickable image inside an HTML This mays break existing styles. To solve styles compatibility issues, you may use the legacy_class argument. |
legacy_class: | Only applicable when show_caption is The classese specified are added to the clickable image. The |