xen3r0/adf-converter

A PHP toolkit to parse the Atlassian Document Format (ADF) and export it to HTML or Markdown

Maintainers

Package info

github.com/Xen3r0/adf-converter

pkg:composer/xen3r0/adf-converter

Transparency log

Statistics

Installs: 11

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-17 18:03 UTC

This package is auto-updated.

Last update: 2026-07-17 18:04:25 UTC


README

CI Latest Version License PHP Version

A PHP toolkit to parse the Atlassian Document Format (ADF) — the rich-text format used by Jira and Confluence — and convert it to and from HTML and Markdown.

It parses any of the three formats into a typed node tree (an AST) and exports that tree back out, so every combination below is supported:

From ↓ / To → ADF (JSON) HTML Markdown
ADF
HTML
Markdown

Requirements

  • PHP >= 8.2
  • Extensions: ext-dom, ext-json

Installation

composer require xen3r0/adf-converter

Quick start

Convert an ADF document (for example the body you get back from the Jira API) to HTML:

use Xen3r0\Adf\Parser\Adf\AdfParser;
use Xen3r0\Adf\Exporter\Html\HtmlExporter;

$adf = '{"version":1,"type":"doc","content":[
    {"type":"heading","attrs":{"level":1},"content":[{"type":"text","text":"Hello"}]},
    {"type":"paragraph","content":[{"type":"text","text":"world"}]}
]}';

$document = (new AdfParser())->parse($adf);
echo (new HtmlExporter())->export($document);
// <h1>Hello</h1><p>world</p>

Turn user-written Markdown into an ADF document ready to send to Jira:

use Xen3r0\Adf\Parser\Markdown\MarkdownParser;

$document = (new MarkdownParser())->parse("# Title\n\nsome **bold** text");

echo json_encode($document); // valid ADF JSON

Documentation

Security

All exported HTML and Markdown is hardened against XSS: dangerous URL schemes (javascript:, data:, …) are stripped from links, and text content is escaped. See docs/security.md for details. To report a vulnerability, please open a security advisory.

License

Released under the MIT License. Copyright © Manuel Santisteban.