You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fmt from stdout should always output the formatted diagram #1577
I want to use d2 to format on save in helix but as it outputs nothing if the doc is already formatted it can completely delete the diagram if I am not careful.
Reacted by Gustavo Balduino, Sittymin, Akira Komamura, Alexandru Ungur, Shahriar Heidrich, Tom Alexander and Jean-Sébastien Dominique
Just to get us started into a discussion around this, I've committed SignalWhisperer@67608bd to explore how this could be done. I'm not a go developer, so please bear with me here.
One issue I'm noticing is that we don't have contextual arguments, i.e. the arguments are global rather than applicable only to d2 fmt. Trying to align closer to gofmt, I couldn't just reuse -w since that's for --watch currently, which is unrelated to fmt. I went with -W instead for now.
Activity
alixander commentedon Sep 7, 2023
oh true
alixander commentedon Oct 5, 2024
We should just conform to what https://pkg.go.dev/cmd/gofmt does.
fmt: always output results when reading from stdio
fmt: align closer to gofmt
SignalWhisperer commentedon Dec 11, 2025
Just to get us started into a discussion around this, I've committed SignalWhisperer@67608bd to explore how this could be done. I'm not a
godeveloper, so please bear with me here.One issue I'm noticing is that we don't have contextual arguments, i.e. the arguments are global rather than applicable only to
d2 fmt. Trying to align closer togofmt, I couldn't just reuse-wsince that's for--watchcurrently, which is unrelated tofmt. I went with-Winstead for now.fmt: always output content when formatting stdin
oliverpool commentedon Feb 4, 2026
I opened a PR with the simplest solution I could find: #2718
I am using it successfully with helix.