Skip to content

Theme-dependent image variants #1990

Open
@mlange-42

Description

@mlange-42

Problem

MdBook themes do currently not work well together with images.

Images with light background look weird in the dark and Rust themes, while images with transparent background can become invisible e.g. on the dark themes.

Proposed Solution

Allow for different image versions for different themes. There are several ways to implement it, as well as to realize a syntax for it.

My ideas so far:

  • Implement it in mdBook (using a custom syntax)
  • Write a preprocessor for it (using a custom syntax)
  • Use HTML classes and CSS and/or JS to hide specific classes (e.g., each theme could hide HTML tags that have a certain class, like no-rust or no-light)

For the first two options, a syntax would be required. could be something like an HTML comment on the line before the image.

Probably, the last option would be the most consistent one.

Notes

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement or feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions