Skip to content

Light and dark mode images do not appear consistent when used with md_in_html extension #5428

@broktoram

Description

@broktoram

Context

I want to add light and dark mode images with a common caption so I'm trying to use the md_in_html extension as follows:

<figure markdown>
  ![test_image_light](images/mask_rcnn.jpg#only-light)
  ![test_image_dark](images/mask_rcnn.jpg#only-dark)
</figure>

bug

Bug description

This seems to happen whenever using the md_in_html extension. It doesn't matter if <figcaption> is used. In dark mode, the content after the figure seems to be pushed down slightly lower compared to light mode.

When inspecting the html, the height of the <p> tag is a bit more in dark mode compared to light mode. I have also tried it with markdown="block", markdown="1" and markdown="span" and it doesn't seem to make a difference.

Related links

Reproduction

image_bug.zip

Steps to reproduce

  1. Add the md_in_html extension to mkdocs.yml
  2. Create a <figure markdown> element and add the only-light and only-dark images one after another (order doesn't matter, it's always the dark mode content that appears differently)
  3. Optionally, include the <figcaption> element
  4. Add some content below this <figure> block
  5. View the page

Browser

No response

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions