Skip to content

Commit 7aac962

Browse files
dmullisdmullis
authored andcommitted
Bug #17: Add viewBox to the output svg
1 parent 177de93 commit 7aac962

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

svg.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,15 @@ svg {
3030
svgColorDarkScheme)
3131

3232
return fmt.Sprintf(
33-
"<svg xmlns='%s' version='%s' height='%d' width='%d' font-family='Menlo,Lucida Console,monospace'>\n" +
34-
"%s\n" +
35-
"%s</svg>\n",
36-
"http://www.w3.org/2000/svg",
37-
"1.1", s.Height, s.Width, style, s.Body)
33+
`<svg xmlns="%s" version="%s" width="%d" height="%d" viewBox="0 0 %d %d" font-family="Menlo,Lucida Console,monospace">
34+
%s
35+
%s
36+
</svg>
37+
`,
38+
39+
"http://www.w3.org/2000/svg", "1.1", s.Width, s.Height, s.Width, s.Height,
40+
style,
41+
s.Body)
3842
}
3943

4044
func writeBytes(out io.Writer, format string, args ...interface{}) {

0 commit comments

Comments
 (0)