diff --git a/d2layouts/d2layouts.go b/d2layouts/d2layouts.go index be9f281f7..f96e234c0 100644 --- a/d2layouts/d2layouts.go +++ b/d2layouts/d2layouts.go @@ -274,9 +274,10 @@ func InjectNested(container *d2graph.Object, nestedGraph *d2graph.Graph) { g.Objects = append(g.Objects, nestedGraph.Objects...) g.Edges = append(g.Edges, nestedGraph.Edges...) - if g.Root.LabelPosition != nil { - container.LabelPosition = g.Root.LabelPosition + if nestedGraph.Root.LabelPosition != nil { + container.LabelPosition = nestedGraph.Root.LabelPosition } + container.Attributes = nestedGraph.Root.Attributes } func PositionNested(container *d2graph.Object, nestedGraph *d2graph.Graph) {