Introduction
📖 Official ADF Documentation: Atlassian Document Format Structure
A bidirectional parser for converting between Atlassian Document Format (ADF) and Extended Markdown.
Complete Documentation - Full guide with examples, API reference, and advanced usage patterns.
What is ADF? Atlassian Document Format (ADF) is a JSON-based document format used by Atlassian products like Jira and Confluence to represent rich content including text formatting, tables, panels, media, and other structured elements.
Features
Bidirectional Conversion: Convert ADF to Extended Markdown and back Seamlessly transform content between Atlassian Document Format and Extended Markdown with complete round-trip fidelity.
Extended Markdown Syntax: Support for ADF-specific elements like
panels,expands, andmediaBeyond standard Markdown, includes ADF extensions such asinfo panels,expandable sections, andmedia placeholderswith full nested structure support.Advanced Nested Processing ✨ New in v2.2.0: Multi-pass parsing for complex nested ADF structures Comprehensive nested ADF fence block processing enables complex document hierarchies with panels containing media, expandable sections with sub-panels, and unlimited nesting depth.
Full Fidelity: Preserves all ADF attributes through metadata annotations Custom attributes and styling information are maintained using HTML comment metadata, ensuring no data loss during conversion.
Universal Module Support: True dual package with zero configuration Supports CommonJS
require(), ESMimport, and dynamicimport()with automatic format selection, bundled dependencies, and complete TypeScript compatibility.Type Safe: Written in TypeScript with complete type definitions Full TypeScript support with comprehensive type definitions for all ADF nodes, ensuring compile-time safety and excellent IDE support.
Comprehensive Test Coverage: 100% test coverage with 399 tests across 29 test suites Thoroughly tested with integration tests, unit tests, and fixture validation covering all ADF node types and conversion scenarios.
Zero Runtime Dependencies: Lightweight and portable (uses well-established libraries) Built on proven libraries like
unified/remarkecosystem, with no additional runtime dependencies for your applications.
Supported Elements
This parser provides bidirectional conversion support between Markdown and ADF. The table below shows all supported elements and their conversion capabilities:
DOCUMENT STRUCTURE
Document
doc
Root document container
✓
✓
Paragraph
paragraph
Text paragraphs with attributes
✓
✓
Hard Break
hardBreak
Explicit line breaks
✓
✓
Text
text
Raw text content
✓
✓
HEADINGS
Heading L1
heading
Level 1 heading
✓
✓
Heading L2
heading
Level 2 heading
✓
✓
Heading L3
heading
Level 3 heading
✓
✓
Heading L4
heading
Level 4 heading
✓
✓
Heading L5
heading
Level 5 heading
✓
✓
Heading L6
heading
Level 6 heading
✓
✓
TEXT FORMATTING
Bold
mark:strong
Bold text formatting
✓
✓
Italic
mark:em
Italic text formatting
✓
✓
Inline Code
mark:code
Inline code spans
✓
✓
Strikethrough
mark:strike
Crossed out text
✓
✓
Underline
mark:underline
Underlined text
✓
✓
Text Color
mark:textColor
Custom text colors
✓
✓
Background Color
mark:backgroundColor
Text background colors
✓
✓
Link
mark:link
Hyperlinks with titles
✓
✓
Subscript/Superscript
mark:subsup
Sub/superscript text
✓
✓
LISTS
Bullet List
bulletList
Unordered lists
✓
✓
Ordered List
orderedList
Numbered lists
✓
✓
List Item
listItem
Individual list items
✓
✓
TABLES
Table
table
Complete table structures
✓
✓
Table Row
tableRow
Individual table rows
✓
✓
Table Header
tableHeader
Table header cells
✓
✓
Table Cell
tableCell
Regular table cells
✓
✓
QUOTES & CODE
Blockquote
blockquote
Quote blocks with nesting
✓
✓
Code Block
codeBlock
Fenced code blocks
✓
✓
Horizontal Rule
rule
Document dividers
✓
✓
ADF PANELS
Info Panel
panel
Information panels
✓
✓
Warning Panel
panel
Warning panels
✓
✓
Error Panel
panel
Error panels
✓
✓
Success Panel
panel
Success panels
✓
✓
Note Panel
panel
Note panels
✓
✓
MEDIA ELEMENTS
Media
media
Individual media items
✓
✓
Media Single
mediaSingle
Single media with layout
✓
✓
Media Group
mediaGroup
Multiple media grouped
✓
✓
INTERACTIVE ELEMENTS
Expand
expand
Collapsible content sections
✓
✓
Inline Card
inlineCard
Embedded link previews
✓
✓
SOCIAL ELEMENTS
Mention
mention
User mentions
✓
✓
Emoji
emoji
Emoji characters
✓
✓
Date
date
Date stamps
✓
✓
Status
status
Status indicators
✓
✓
Installation
Module Support
This package provides full dual package support for both CommonJS and ES Modules (ESM) with automatic format detection and zero configuration required.
✅ CommonJS Support
Works in Node.js projects, TypeScript projects compiling to CommonJS, and any environment expecting CommonJS modules:
✅ ES Modules (ESM) Support
Works in modern Node.js projects, browsers, and TypeScript projects using ES modules:
✅ Dynamic Import (Universal)
Works in both CommonJS and ESM environments:
✅ TypeScript Support
Full type definitions for all module systems:
Module Resolution Details
Package Type: Dual package with proper
exportsconfigurationCommonJS Output: Bundled
.cjsfiles with all dependencies includedESM Output: Tree-shakable
.mjsfiles with external dependenciesAutomatic Selection: Node.js automatically selects the correct format
Zero Configuration: No build tools or configuration changes required
Usage
Simple Example
Complex Example with ADF Extensions
Extended Markdown Syntax
Metadata Comments
Apply custom attributes to any element:
ADF Fence Blocks
Nested ADF Fence Blocks ✨ New in v2.2.0
ADF fence blocks can now be nested within each other, enabling complex document structures:
Supported nested patterns:
~~~expandcontaining panels, media, and other expandable sections~~~panelwith nested media blocks and sub-panelsComplex multi-level nesting with full content parsing
All ADF fence types:
panel,expand,nestedExpand,mediaSingle,mediaGroup
Media References
Frontmatter Support
Architecture
Unified Parser Architecture (v2.1.6+)
The library has been completely refactored with a unified architecture that eliminates duplication and ensures consistent, high-quality conversions across all parser interfaces:
Core Components
Unified Parser Class - The main
Parserclass now uses shared conversion engines internallyMarkdownToAdfEngine - Dedicated engine for markdown → ADF conversion
AdfToMarkdownEngine - Dedicated engine for ADF → markdown conversion
Backward Compatibility -
EnhancedMarkdownParsernow simply extendsParser
Key Improvements
🎯 Consistent Results: All parsing approaches now produce identical, high-quality results
✨ No Configuration Required: ADF extensions are enabled by default (no more
enableAdfExtensionsflag)🔧 Social Elements: Proper parsing of
{user:mention},:emoji:,{status:text}, and{date:YYYY-MM-DD}in all contexts⚡ Performance: Shared engines eliminate code duplication and improve maintainability
🛡️ Error Recovery: Built-in error recovery with configurable retry strategies
Usage Patterns
All these approaches now produce identical results:
Migration Guide
Before (v2.1.5 and earlier):
After (v2.1.6+):
Testing
This library includes a comprehensive test suite with 399 tests across 29 test suites, ensuring reliability and correctness across all supported features.
Test Categories
Integration Tests - End-to-end conversion and validation
Markdown to ADF conversion with all supported elements
Bidirectional round-trip conversion fidelity
Enhanced parser with metadata comments support
Media placeholders and ADF URL resolution
Whitespace resilience and error handling
Performance validation (avg <2ms per conversion)
Unit Tests - Individual component testing
Parser classes (unified
Parser,MarkdownToAdfEngine,AdfToMarkdownEngine)Node converters (panels, tables, media, lists, etc.)
Mark converters (formatting, links, colors, etc.)
Core components (converter registry, validators)
Remark plugins and micromark extensions
Fixture Validation - Comprehensive markup coverage
17 markdown fixture files covering all ADF elements
11 corresponding ADF fixtures for validation
30+ ADF node types with complete attribute support
Complex nested structures and edge cases
Malformed input handling and recovery
Running Tests
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT
Last updated