-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Don't inherit SVG style properties from the environment. #1089
Conversation
We don't want to inherit styles that affect SVG painting unless those styles also affect regular text rendering. This patch adds styles to the stylesheet so that every svg element in KaTeX output starts off with a known set of basic fill and stroke attributes. This should resolve issue #1088
This screenshot was created by using the element that contains the KaTeX output. It demonstrates that with this patch applied, we inherit color, font-size and transform, but we are not affected by things like fill-opacity and stroke-width.
Compare this screenshot to the one in issue #1088 Note also that previously we inherited fill color for elements, but not the stroke color, so it was possible for the environment to add a colored outline to our svg paths. Now we inherit both fill and stroke on the svg element itself, so setting the stroke style does not give a colored outline. |
Okay, still need to make tests pass, but I'm hoping that the fix can be basically as simple as this. |
@davidflanagan maybe add a screenshot test for this. It should be possible using the
|
That's a great idea, Kevin. I'll do it. |
Actually, the pre and post attributes on the screenshot tests set the content of spans before and after the math, but they're both siblings of the math element, not ancestors, so I can't use them to set styles that would affect the math... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
We don't want to inherit styles that affect SVG painting unless those
styles also affect regular text rendering. This patch adds styles
to the stylesheet so that every svg element in KaTeX output starts
off with a known set of basic fill and stroke attributes.
This should resolve issue #1088