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

dtreeviz/utils.py: Fix ID collisions in inline_svg_images output #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CyberShadow
Copy link

Inlined SVGs may have IDs which are not globally unique. Patch the tree of the inlined images and add a prefix to all IDs, to make collisions much less likely.

Please excuse my Python.

Inlined SVGs may have IDs which are not globally unique.
Patch the tree of the inlined images and add a prefix to all IDs,
to make collisions much less likely.
@parrt
Copy link
Owner

parrt commented Mar 29, 2020

Interesting! Can you tell me what problems occurred because of this? In other words how did you know this was a problem? thanks!

@parrt parrt added the bug Something isn't working label Mar 29, 2020
@CyberShadow
Copy link
Author

CyberShadow commented Mar 29, 2020

I found a link to this file in a StackOverflow post and applied it to my toolchain for putting LaTeX formulas in Graphviz SVG renders... sorry if this is not useful to the project as a whole :)

@parrt
Copy link
Owner

parrt commented Mar 30, 2020

I've noticed that jupyter notebooks tend not to show my SVG images except the first time you run it, not when you reload it. You think that could be because of this unique identifier thing? Can you give me a link to the StackOverflow post? I want to understand exactly what's going on. thanks

@CyberShadow
Copy link
Author

I've noticed that jupyter notebooks tend not to show my SVG images except the first time you run it, not when you reload it. You think that could be because of this unique identifier thing?

Hmm, I don't think so. The symptoms for ID collisions (which I also encountered elsewhere) is things such as styling applied to the wrong element. In this case it manifested as a wrong font in some of the SVGs embedded later in the document.

Can you give me a link to the StackOverflow post? I want to understand exactly what's going on. thanks

Sorry, I misremembered. Though I did run into dtreeviz on StackOverflow while researching my SVG troubles, the actual link to this file I found on this GitHub comment:
ellson/MOTHBALLED-graphviz#1294 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants