Skip to content

Add --mermaid flag for diagram output in depends command#304

Merged
richlander merged 2 commits intomainfrom
feature/mermaid-output
Mar 31, 2026
Merged

Add --mermaid flag for diagram output in depends command#304
richlander merged 2 commits intomainfrom
feature/mermaid-output

Conversation

@richlander
Copy link
Copy Markdown
Owner

Summary

Add --mermaid flag to the depends command, enabling Mermaid diagram output for type hierarchies, library references, and package dependencies.

Two modes

Flags Output Use case
--mermaid Standalone mermaid (graph TD) Pipe to mmdc, embed in tooling
--markdown --mermaid Mermaid fenced blocks inside markdown Render in GitHub, VS Code, etc.

Examples

# Standalone mermaid
dotnet-inspect depends 'INumber<TSelf>' --mermaid

# Embedded in markdown
dotnet-inspect depends 'INumber<TSelf>' --markdown --mermaid

# Package dependencies as mermaid
dotnet-inspect depends --package System.Text.Json --mermaid

Changes

  • OutputFormat.cs — Added Mermaid enum value, IsEmbeddedMermaid() helper, env var support (DOTNET_INSPECT_FORMAT=mermaid)
  • SharedOptions.cs — Added --mermaid CLI option, wired into format resolution
  • DependsOptions.cs — Added MermaidOutput and EmbeddedMermaid properties
  • SearchCommandDefinitions.cs — Wired flags into all 3 depends subcommands (type/library/package)
  • DependsCommand.cs — Added WriteMermaidTree() and WriteEmbeddedMermaidTree() helpers, mermaid branches in all 3 Execute methods
  • Directory.Packages.props — Updated Markout to 0.12.0 (adds MermaidFormatter)

Dependencies

Requires Markout 0.12.0 which adds MermaidFormatter.

richlander and others added 2 commits March 27, 2026 16:30
Two modes:
- --mermaid: standalone mermaid output via MermaidFormatter (graph TD)
- --markdown --mermaid: mermaid embedded as fenced code blocks in markdown

Wired through OutputFormat enum, OutputFormatResolver, SharedOptions,
DependsOptions, and SearchCommandDefinitions. Supports type hierarchy,
library reference, and package dependency modes.

Requires Markout with MermaidFormatter (not yet published; validated
via ProjectReference).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@richlander
Copy link
Copy Markdown
Owner Author

FYI: @StephenCleary

@richlander richlander merged commit b88427d into main Mar 31, 2026
10 checks passed
@richlander richlander deleted the feature/mermaid-output branch March 31, 2026 18:18
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.

1 participant