Skip to content

Conversation

@Maricaya
Copy link
Contributor

Add --format flag to enable PNG output to stdout, allowing users to pipe D2 diagram output in PNG format to other tools.

Changes:

  • Add format flag support for PNG output to stdout
  • Add test cases for format flag handling
  • Update getOutputFormat to handle format flags properly

Example usage:

d2 input.d2 --stdout-format png -

Test: ./make.sh test

image

@Maricaya Maricaya changed the title cli: add format flag to support PNG output to stdout (same as https://github.com/terrastruct/d2/pull/2257) cli: add format flag to support PNG output to stdout Jan 14, 2025
@Maricaya
Copy link
Contributor Author

Maricaya commented Jan 14, 2025

hi @alixander I am so sorry. I accidentally messed up the last PR during the git rebase, so I created a new PR to fix it. the last one is
#2257

Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 lgtm. Thank you for doing this!

@alixander alixander merged commit 6f0287d into terrastruct:master Jan 17, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants