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

minify makes mermaid subgraphs and diamonds black #260

Closed
pocc opened this issue Jun 30, 2019 · 3 comments · Fixed by #267
Closed

minify makes mermaid subgraphs and diamonds black #260

pocc opened this issue Jun 30, 2019 · 3 comments · Fixed by #267

Comments

@pocc
Copy link

pocc commented Jun 30, 2019

May be related to #256 and #19

Mermaid is a diagram creation tool that can save as svg.

Mermaid subgraphs and diamonds come out black. Source mermaid:

graph TD
subgraph one
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[fa:fa-car Car]
end
Loading

Source and svgs included in mermaid.zip

Separately, is there some way to make minify ignore an HTML div or file?

@tdewolff
Copy link
Owner

tdewolff commented Jul 1, 2019

The problem is that the CSS is referencing the rectangle and giving it colors, but the minifier converted it into a <path> object. I think the SVG minifier should not convert rect/polypath to path, at least not when it is referenced by CSS.

@pocc
Copy link
Author

pocc commented Jul 1, 2019

I figured it had something to do with path conversions. Looks like adding a conditional testing for related css could be added to the elseifs:

minify/svg/svg.go

Lines 118 to 122 in 579ccef

} else if tag == svg.Rect {
o.shortenRect(tb, &t, p)
} else if tag == svg.Polygon || tag == svg.Polyline {
o.shortenPoly(tb, &t, p)
}

@tdewolff
Copy link
Owner

Fixed in c05f24e

anthonyfok added a commit to anthonyfok/hugo that referenced this issue Oct 9, 2019
- v2.5.1 removes import comments, solving a build error with Go 1.13
  in GOPATH mode (used Debian packaging for example)
- v2.5.2 no longer converts polyline/rect/polygon/line to path
  as it has been reported to break a SVG referenced by CSS,
  see tdewolff/minify#260

The test case for Min SVG in TestResourceChains is updated accordingly.

Fixes pocc/tshark.dev#33
bep pushed a commit to gohugoio/hugo that referenced this issue Oct 9, 2019
- v2.5.1 removes import comments, solving a build error with Go 1.13
  in GOPATH mode (used Debian packaging for example)
- v2.5.2 no longer converts polyline/rect/polygon/line to path
  as it has been reported to break a SVG referenced by CSS,
  see tdewolff/minify#260

The test case for Min SVG in TestResourceChains is updated accordingly.

Fixes pocc/tshark.dev#33
pocc added a commit to pocc/tshark.dev that referenced this issue Feb 26, 2020
Minify made a fix in tdewolff/minify#260, which is then upstreamed as
gohugoio/hugo#6403 (v0.59.0)
pocc added a commit to pocc/tshark.dev that referenced this issue Feb 26, 2020
Minify made a fix in tdewolff/minify#260, which is then upstreamed as
gohugoio/hugo#6403 (v0.59.0)
pocc added a commit to pocc/tshark.dev that referenced this issue Feb 26, 2020
Minify made a fix in tdewolff/minify#260, which is then upstreamed as
gohugoio/hugo#6403 (v0.59.0)
pocc added a commit to pocc/tshark.dev that referenced this issue Feb 26, 2020
Minify made a fix in tdewolff/minify#260, which is then upstreamed as
gohugoio/hugo#6403 (v0.59.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants