marp-team / marp-core

The core of Marp converter
MIT License
750 stars 127 forks source link

Transparent images broken with regular `[]()` tags but not with `[bg]()` #371

Closed ymollard closed 2 months ago

ymollard commented 2 months ago

I made an example code to demonstrate that issue:

Deployment: https://candid-tulumba-47300d.netlify.app/ Code: https://gitlab.com/ymollard/test-marp-img-bng/-/blob/main/index.md

Expected behaviour: transparent background for both Python logos using the []() tag and [bg]() Actual behaviour: transparent background only for [bg]() but not for []().

yhatt commented 2 months ago

Aren't you using Marp Core's default theme?

default theme has an inherited style from GitHub's Markdown rendering. Markdown images in GitHub by ![]() actually has colored background inherited from GitHub's background. https://github.com/sindresorhus/github-markdown-css/blob/b3977a0367f753d1c58812c4218f69f013504c51/github-markdown.css#L216-L221

marp-default-theme-bg

You can tweak the style within Markdown to remove inherited background color:

<style>
img {
  background-color: transparent;
}
</style>

Related

ymollard commented 2 months ago

Yes, theme: gaia works properly but the default does not. The manual img {} also fixes the issue. So if I understand well, it's not a bug, it's a feature, so I close that issue. Thanks for the fast and complete answer!