Skip to content

Transparency failing for svg output #102

Open
@fpreiss

Description

@fpreiss

When targeting the svg output, the file is embedded using the html <object>
tag. While this displays correctly on chromium, firefox does not apply the
transparency correctly to the object (see the undesired white background in the image below):

Screenshot_20221221_164225

I suggest using an img tag instead of the object tag as listed below, as
this will display the svg correctly in firefox:

         if _fmt == "svg":
-            svgtag = """<object data="%s" type="image/svg+xml">
-            <p class="warning">%s</p></object>\n""" % (
+            svgtag = """<img src="%s" alt="%s"/>\n""" % (
                 fname,
                 alt,
             )

One caveat for this approach is that this might impact the behaviour for
animated/interactive svg files (if that is even a concern for the svg target of mmdc).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions