embed d2 version in svg
This commit is contained in:
parent
e656cf75d1
commit
2f2056da2a
2 changed files with 4 additions and 2 deletions
|
|
@ -35,6 +35,7 @@ import (
|
||||||
"oss.terrastruct.com/d2/lib/shape"
|
"oss.terrastruct.com/d2/lib/shape"
|
||||||
"oss.terrastruct.com/d2/lib/svg"
|
"oss.terrastruct.com/d2/lib/svg"
|
||||||
"oss.terrastruct.com/d2/lib/textmeasure"
|
"oss.terrastruct.com/d2/lib/textmeasure"
|
||||||
|
"oss.terrastruct.com/d2/lib/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -1779,8 +1780,9 @@ func Render(diagram *d2target.Diagram, opts *RenderOpts) ([]byte, error) {
|
||||||
dimensions = fmt.Sprintf(` width="%d" height="%d"`, w, h)
|
dimensions = fmt.Sprintf(` width="%d" height="%d"`, w, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
fitToScreenWrapper := fmt.Sprintf(`<svg %s preserveAspectRatio="xMinYMin meet" viewBox="0 0 %d %d"%s>`,
|
fitToScreenWrapper := fmt.Sprintf(`<svg %s d2:version="%s" preserveAspectRatio="xMinYMin meet" viewBox="0 0 %d %d"%s>`,
|
||||||
`xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"`,
|
`xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"`,
|
||||||
|
version.Version,
|
||||||
w, h,
|
w, h,
|
||||||
dimensions,
|
dimensions,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package version
|
package version
|
||||||
|
|
||||||
// Pre-built binaries will have version set correctly during build time.
|
// Pre-built binaries will have version set correctly during build time.
|
||||||
var Version = "v0.2.2-HEAD"
|
var Version = "v0.2.4-HEAD"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue