Skip to content

Add configurable D2 SVG output with bundling support - #3

Merged
mnowotnik merged 1 commit into
feature/svg-supportfrom
claude/fix-d2-bundle-flag-Nkf7o
Apr 19, 2026
Merged

Add configurable D2 SVG output with bundling support#3
mnowotnik merged 1 commit into
feature/svg-supportfrom
claude/fix-d2-bundle-flag-Nkf7o

Conversation

@mnowotnik

Copy link
Copy Markdown
Owner

Changes:

  • d2/d2.go: add SVG bundling via imgbundler, scale-aware dimensions, and adapter logger
  • renderer/fencedcodeblock.go: pass file path, bundle flag, and scale through SVG code path
  • markdown/markdown.go: wire new fenced-code renderer signature
  • util/flags.go, util/cli.go, types/types.go: introduce d2-output/d2-bundle config and propagate to MarkConfig
  • d2/d2_test.go: cover SVG path and checksum expectations
  • README.md: document new d2-output and d2-bundle options
  • go.mod/go.sum: pull in new indirect deps
  • main.go: remove stray blank line

Why:

  • Allow uploading original D2 SVGs with optional bundled assets and respect scaling to avoid manual resizing.

The flag's behavior diverged from its documentation in two ways: local
assets were inlined unconditionally, and the flag was a no-op for the
default --d2-output png path (PNG is rendered by snapshotting the SVG
in headless Chrome, which already resolves all references). Drop the
flag and always call BundleLocal+BundleRemote for SVG output to bring
mark in line with `d2 --bundle` semantics by default.

https://claude.ai/code/session_01LTUkaxrBbN61TQXf6DDgdz
@mnowotnik
mnowotnik changed the base branch from master to feature/svg-support April 19, 2026 12:32
@mnowotnik
mnowotnik merged commit a46281f into feature/svg-support Apr 19, 2026
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