Repository navigation
Format D2 fences in Markdown and make stdin formatting safe - #3052
Merged
Merged
Conversation
Support read-only unified diffs for CI. Return the full formatted source on successful stdin formatting, including unchanged input, following the behavior proposed in #2718. - sent from alixander's Codex
- sent from alixander's Codex
- sent from alixander's Codex
alixander
added a commit
that referenced
this pull request
Nov 26, 2026
Master formats D2 fences in Markdown and stdin safely (#3052), adding github.com/aymanbagabas/go-udiff. go.mod keeps it and this branch's replacement of andybalholm/brotli by d2lang/brotli. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human
AI
d2blocks in.mdand.markdownfiles. Preserve surrounding Markdown, fence markers and line endings, including within lists and blockquotes.d2 fmt --difffor a read-only unified diff. Combine it with--checkto fail CI when formatting is needed.d2 fmt -, including unchanged input. Syntax errors leave stdout empty. This follows the behavior proposed in cli: fmt: always output content when formatting stdin #2718 by oliverpool.Verified with formatter, parser and CLI tests, targeted race and CLI end-to-end tests, and process-level checks of stdout, stderr and patch application. Markdown diagnostics point to the original file and do not write a partial update.
Closes #1577.