d2: Add trailing newline to svg output

The convention. Also makes log messages clearer when input/output is -
as without the newline, you get this occasionally:

</style><style type="text/css"><![CDATA[]]></style></svg>success: successfully compiled - to -
This commit is contained in:
Anmol Sethi 2022-12-18 10:48:57 -08:00
parent 1eeedb7fd8
commit cffb29c919
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA

View file

@ -243,6 +243,10 @@ func compile(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, pad,
if err != nil { if err != nil {
return svg, false, err return svg, false, err
} }
} else {
if len(out) > 0 && out[len(out)-1] != '\n' {
out = append(out, '\n')
}
} }
err = ms.WritePath(outputPath, out) err = ms.WritePath(outputPath, out)