Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: optionally use html id to scope svg's css #234

Open
stertooy opened this issue Mar 27, 2023 · 1 comment
Open

Feature request: optionally use html id to scope svg's css #234

stertooy opened this issue Mar 27, 2023 · 1 comment
Assignees
Labels
feature feature request

Comments

@stertooy
Copy link

Currently, dvisvgm outputs svg files containing css like this:

<svg [...]>
<style type='text/css'>
<![CDATA[
[...font faces...]
text.f0 { [...] }
text.f1 { [...] }
[...more fonts...]
]]>
</style>
[...]
</svg>

I would like to use multiple svg's created by dvisvgm inline on a given html page. However, this causes these svg's to overwrite each other's css. One solution would be to generate a unique id for the svg, and then using that id in the css to scope it:

<svg [...] id='myAwesomeIdHere' >
<style type='text/css'>
<![CDATA[
[...font faces...]
#myAwesomeIdHere text.f0 { [...] }
#myAwesomeIdHere text.f1 { [...] }
[...more fonts...]
]]>
</style>
[...]
</svg>

Would it be possible to implement an option for dvisvgm to do this automatically?

@mgieseki
Copy link
Owner

mgieseki commented Apr 1, 2023

I have to look into this more closely but don't have time to work on dvisvgm in the next few weeks. As a workaround you could use option --no-styles maybe in combination with --optimize.

@mgieseki mgieseki self-assigned this Apr 1, 2023
@mgieseki mgieseki added the feature feature request label Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature request
Projects
None yet
Development

No branches or pull requests

2 participants