D2Sharp 0.1.0-alpha.6
This is a prerelease version of D2Sharp.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package D2Sharp --version 0.1.0-alpha.6
NuGet\Install-Package D2Sharp -Version 0.1.0-alpha.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="D2Sharp" Version="0.1.0-alpha.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add D2Sharp --version 0.1.0-alpha.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: D2Sharp, 0.1.0-alpha.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install D2Sharp as a Cake Addin #addin nuget:?package=D2Sharp&version=0.1.0-alpha.6&prerelease // Install D2Sharp as a Cake Tool #tool nuget:?package=D2Sharp&version=0.1.0-alpha.6&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
D2Sharp
D2Sharp is a .NET wrapper for the D2 diagramming library, allowing you to create diagrams programmatically in your .NET applications.
Installation
You can install D2Sharp via NuGet Package Manager:
Install-Package D2Sharp
Or via .NET CLI:
dotnet add package D2Sharp
Usage
Here's a basic example of how to use D2Sharp:
using D2Sharp;
using Microsoft.Extensions.Logging;
// Create a logger (optional)
var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole());
var logger = loggerFactory.CreateLogger<D2Wrapper>();
// Create an instance of D2Wrapper
var wrapper = new D2Wrapper(logger);
// Define your D2 script
var script = @"
direction: right
A -> B -> C
";
// Render the diagram
try
{
string svg = wrapper.RenderDiagram(script);
// Use the SVG string as needed (e.g., save to file, display in a web page)
}
catch (Exception ex)
{
Console.WriteLine($"Error rendering diagram: {ex.Message}");
}
Features
- Render D2 diagrams as SVG
- Cross-platform support (Windows, macOS, Linux)
- Integration with .NET logging
Requirements
- .NET 8.0 or later
Acknowledgements
D2Sharp is built on top of the following open-source projects:
Issues and Contributions
For issues, feature requests, or contributions, please visit the GitHub repository.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Extensions.Logging (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.0-alpha.7 | 82 | 8/6/2024 |
0.1.0-alpha.6 | 46 | 8/5/2024 |