AdfKit makes it easy to convert Markdown, HTML, and text documents to Atlassian Document Format (ADF). Ideal for developers, content teams, and technical writers, it simplifies document transformations for Jira, Confluence, and other Atlassian products.
$ dotnet add package AdfKitAdfKit is a powerful .NET library for converting HTML to Atlassian Document Format (ADF). Perfect for integrating rich content into Confluence, Jira, and other Atlassian products with precise formatting preservation.
Install AdfKit via NuGet Package Manager:
dotnet add package AdfKit
Or via Package Manager Console in Visual Studio:
Install-Package AdfKit
** Important: AdfKit requires a valid license key to operate without restrictions.**
The trial license includes:
# Option 1: Environment variable (recommended)
export ADFKIT_LICENSE_FILE="/path/to/your/license.key"
# Option 2: License content directly
export ADFKIT_LICENSE_CONTENT="your-license-key-content"
using AdfKit;
using AdfKit.Licensing;
try
{
// Create converter (license loaded from environment)
var converter = new HtmlToAdfConverter();
// Convert HTML to ADF
var html = """
<h1>Welcome to AdfKit</h1>
<p>This is a <strong>powerful</strong> HTML to ADF converter.</p>
<ul>
<li>Easy to use</li>
<li>High performance</li>
<li>Production ready</li>
</ul>
""";
var adfDocument = converter.ConvertHtml(html);
// Use the ADF document with Atlassian APIs
Console.WriteLine($" Conversion successful! Licensed to: {converter.LicenseData.User}");
}
catch (LicenseValidationException ex)
{
Console.WriteLine($" License error: {ex.Message}");
}
using AdfKit;
// Convert with license file path
var adfDoc = HtmlToAdfConverter.Convert(htmlContent, "./license.key");
using AdfKit;
// Pass license file directly to constructor
var converter = new HtmlToAdfConverter("./license.key");
var adfDocument = converter.ConvertHtml(htmlContent);
// Access license information
var license = converter.LicenseData;
Console.WriteLine($"Licensed to: {license.User}");
Console.WriteLine($"Expires: {license.ExpiresAt.ToString("yyyy-MM-dd") "Never"}");
// In Program.cs or Startup.cs
builder.Services.AddScoped<HtmlToAdfConverter>(provider =>
{
var config = provider.GetRequiredService<IConfiguration>();
var licensePath = config["AdfKit:LicensePath"];
return new HtmlToAdfConverter(licensePath);
});
// In your controller or service
public class DocumentController : ControllerBase
{
private readonly HtmlToAdfConverter _converter;
public DocumentController(HtmlToAdfConverter converter)
{
_converter = converter;
}
[HttpPost("convert")]
public IActionResult ConvertToAdf([FromBody] string html)
{
try
{
var adf = _converter.ConvertHtml(html);
return Ok(adf);
}
catch (LicenseValidationException ex)
{
return BadRequest($"License error: {ex.Message}");
}
}
}
| Element | Support | Notes |
|---|---|---|
| Headers | <h1> through <h6> | |
| Paragraphs | <p> with inline formatting | |
| Lists | Ordered (<ol>) and unordered (<ul>) | |
| Tables | Basic tables with headers and cells | |
| Links | <a href=""> elements | |
| Images | <img> converted to media elements | |
| Formatting | Bold, italic, underline, strikethrough | |
| Code | Inline <code> and <pre> blocks | |
| Blockquotes | <blockquote> elements | |
| Line Breaks | <br> and <hr> elements |
// 1. Environment variable (recommended for production)
Environment.SetEnvironmentVariable("ADFKIT_LICENSE_FILE", "./license.key");
var converter = new HtmlToAdfConverter();
// 2. Direct file path
var converter = new HtmlToAdfConverter("./license.key");
// 3. License content as environment variable
Environment.SetEnvironmentVariable("ADFKIT_LICENSE_CONTENT", licenseContent);
var converter = new HtmlToAdfConverter();
using AdfKit;
using AdfKit.Licensing;
try
{
var converter = new HtmlToAdfConverter("./license.key");
var result = converter.ConvertHtml(html);
}
catch (LicenseValidationException ex) when (ex.Message.Contains("expired"))
{
// Handle expired license
Console.WriteLine("License has expired. Please renew your license.");
}
catch (LicenseValidationException ex) when (ex.Message.Contains("not found"))
{
// Handle missing license
Console.WriteLine("License file not found. Please check the file path.");
}
catch (LicenseValidationException ex)
{
// Handle other license issues
Console.WriteLine($"License validation failed: {ex.Message}");
}
Atlassian Document Format (ADF) is a JSON-based format used by Atlassian products like Confluence and Jira to represent rich content. It's the standard format for:
AdfKit makes it easy to convert your existing HTML content into ADF format with high fidelity.
Ready to get started Get your free trial license and start converting HTML to ADF in minutes!
AdfKit is developed by Vilalta Ventures LLC. All rights reserved.