func StripSvgXmlDecl(svg []byte) ([]byte, error) {
	i := bytes.Index(svg, []byte("<svg"))
	if i < 0 {
		return []byte{}, fmt.Errorf("Svg tag not found in bytes")
	}
	svg = svg[i:]
	return svg, nil
}
StripSvgXmlDecl is for stripping the xml declaration tag from svg file contents.
It's available as a helper command in case you're embedding an svg file in an HTML document.
package soterutil
import (
	"bytes"
	"fmt"
	"html/template"
	"os/exec"
)
func DotToSvg(dot []byte) ([]byte, error) {
	var in, out, stderr bytes.Buffer
	cmdName := "dot"
	args := []string{"-Tsvg"}
	cmdPath, found := Which(cmdName)
	if !found {
		return out.Bytes(), fmt.Errorf("Couldn't find %s command in path. Is graphviz installed?", cmdName)
	}
	_, err := in.Write(dot)
	if err != nil {
		return out.Bytes(), err
	}
	cmd := exec.Command(cmdPath, args...)
	cmd.Stdin = &in
	cmd.Stdout = &out
	cmd.Stderr = &stderr
	err = cmd.Run()
	if err != nil {
		return out.Bytes(), fmt.Errorf("%s\n%s", stderr.String(), err)
	}
	return out.Bytes(), nil
}
func RenderSvgHTML(svg []byte, title string) ([]byte, error) {
       var render []byte
       var err error
       render, err = RenderSvgHTMLFigure(svg)
       if err != nil {
               return []byte{}, err
       }
       return (RenderHTML(render, title))
}
func RenderSvgHTMLFigure(svg []byte) ([]byte, error) {
       var render bytes.Buffer
       tmpl := `
<figure>
{{ .svg }}
</figure>
`
       t := template.New("dag")
       t, err := t.Parse(tmpl)
       data := map[string]interface{}{
               "svg": template.HTML(svg),
       }
       err = t.Execute(&render, data)
       if err != nil {
               return []byte{}, err
       }
       return render.Bytes(), nil
}
func RenderHTML(body []byte, title string) ([]byte, error) {
	var render bytes.Buffer
	tmpl := `
<html>
	<head>
		<title>{{ .title }}</title>
	</head>
	<body>
		{{ .body }}
	</body>
</html>
`
	t := template.New("dag")
	t, err := t.Parse(tmpl)
	data := map[string]interface{}{
		"title": title,
		"body": template.HTML(body),
	}
	err = t.Execute(&render, data)
	if err != nil {
		return []byte{}, err
	}
	return render.Bytes(), nil
}
func RenderSteppingHTML(body []byte, title string, prev int, next int) ([]byte, error) {
       var render bytes.Buffer
       tmpl := `
<html> 
       <head>
               <title>{{ .title }}</title>
       </head>
       <body>
           <a href="dag_{{ .prev}}.html">prev</a>
           <a href="dag_{{ .next}}.html">next</a>
               {{ .body }}
               <a href="dag_{{ .prev}}.html">prev</a>
           <a href="dag_{{ .next}}.html">next</a>
       </body>
</html>
`
       t := template.New("dag")
       t, err := t.Parse(tmpl)
       data := map[string]interface{}{
               "title": title,
               "body": template.HTML(body),
               "prev": prev,
               "next": next,
       }
       err = t.Execute(&render, data)
       if err != nil {
               return []byte{}, err
       }
       return render.Bytes(), nil
}