Skip to content

only_light/only_dark classes break alignment of images within figures #423

Closed Answered by idryzhov
idryzhov asked this question in Potential Issue
Discussion options

You must be logged in to vote

@pradyunsg hi again!

Actually, I think I found the right solution.
When using figures, one must use :figclass: only_light/dark instead of :class: only_light/dark.
This way, the class applies to the <figure> HTML tag instead of the <img> and the image is aligned correctly.
More than that, it allows to use different captions depending on the light/dark mode:

.. figure:: https://source.unsplash.com/200x200/daily?cute+dogs
    :figclass: only_light
    :align: center

    Dog

.. figure:: https://source.unsplash.com/200x200/daily?cute+cats
    :figclass: only_dark
    :align: center

    Cat

So there's no issue with the Furo theme, sorry. However, the usage of :figclass: only_light/dark for …

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@idryzhov
Comment options

Comment options

You must be logged in to vote
1 reply
@pradyunsg
Comment options

Answer selected by idryzhov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants