cssgithubmarkdown

Remove background color on image inside markdown table


I have the following table in markdown on GitHub and I want to be able to remove the background color on the images inside the second column. They are transparent png's but there is CSS in markdown that adds background-color: white; to all images inside the table.

Is there any way to overwrite that style and have images with a transparent background?

| Project State  | Icon |
|----------------|:----:|
| In Development |<img src="https://i.sstatic.net/0a2rs.png">|
| In Progress    |<img src="https://i.sstatic.net/g9uuh.png" style="background-color: transparent;">|
| Completed      |<img src="https://i.sstatic.net/wlvw7.png">|


Solution

  • This is not possible.

    While img elements are whitelisted, the filter only allows src and longdesc attributes, so your style attribute will be stripped.

    The only workaround would be to switch from a transparent background to one matching the actual background, in this case F8F8F8.

    If you wish to add support for style attribute, voice your support for the open issue at the html-pipeline repo.