Merge pull request #2360 from x-delfino/d2-config-center

compiler: support center in d2-config
This commit is contained in:
Alexander Wang 2025-02-19 08:03:16 -08:00 committed by GitHub
commit 7741382f92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 1 deletions

View file

@ -6,4 +6,6 @@
#### Bugfixes ⛑️
- Compiler: fixes panic when `sql_shape` shape value had mixed casing [#2349](https://github.com/terrastruct/d2/pull/2349)
- Compiler:
- fixes panic when `sql_shape` shape value had mixed casing [#2349](https://github.com/terrastruct/d2/pull/2349)
- fixes support for `center` in `d2-config` [#2360](https://github.com/terrastruct/d2/pull/2360)

View file

@ -1455,6 +1455,12 @@ func compileConfig(ir *d2ir.Map) (*d2target.Config, error) {
config.LayoutEngine = go2.Pointer(f.Primary().Value.ScalarString())
}
f = configMap.GetField(d2ast.FlatUnquotedString("center"))
if f != nil {
val, _ := strconv.ParseBool(f.Primary().Value.ScalarString())
config.Center = &val
}
f = configMap.GetField(d2ast.FlatUnquotedString("theme-overrides"))
if f != nil {
overrides, err := compileThemeOverrides(f.Map())