diff --git a/d2layouts/d2dagrelayout/layout.go b/d2layouts/d2dagrelayout/layout.go index 3b6885bf8..c984dc2e2 100644 --- a/d2layouts/d2dagrelayout/layout.go +++ b/d2layouts/d2dagrelayout/layout.go @@ -136,6 +136,9 @@ func Layout(ctx context.Context, g *d2graph.Graph) (err error) { if err := json.Unmarshal([]byte(val.String()), &dn); err != nil { return err } + // ID "ninety\nnine" is set in dagre with backticks: g.setNode(`"ninety\nnine"`, ...) + // but unmarshal converts \n into an actual newline, so we need to replace these to get the AbsID string and lookup the node + dn.ID = strings.ReplaceAll(dn.ID, "\n", "\\n") if debugJS { log.Debug(ctx, "graph", slog.F("json", dn)) }