ADF to Markdown

Convert Atlassian Document Format (ADF) to Extended Markdown with full fidelity and metadata preservation.

Overview

ADF to Markdown conversion uses a unified converter system with specialized converters to transform ADF node structures into Extended Markdown syntax. Unlike Markdown to ADF conversion (which has two parser types), ADF to Markdown uses a single, efficient converter architecture.

Basic Usage

Using the Main Parser

import { Parser } from 'extended-markdown-adf-parser';

const parser = new Parser();

// ADF document
const adf = {
  version: 1,
  type: 'doc',
  content: [
    {
      type: 'heading',
      attrs: { level: 1 },
      content: [{ type: 'text', text: 'Document Title' }]
    },
    {
      type: 'panel',
      attrs: { panelType: 'info', title: 'Information' },
      content: [
        {
          type: 'paragraph',
          content: [
            { type: 'text', text: 'This is an ' },
            { type: 'text', text: 'important', marks: [{ type: 'strong' }] },
            { type: 'text', text: ' information panel.' }
          ]
        }
      ]
    }
  ]
};

// Convert to markdown
const markdown = parser.adfToMarkdown(adf);
console.log(markdown);

// Output:
// # Document Title
//
// ~~~panel type=info title="Information"  
// This is an **important** information panel.
// ~~~

Using Enhanced Parser for Metadata

Available Methods

Synchronous Conversion

Enhanced Parser Methods

Conversion Options

Supported Elements

All ADF elements are supported through dedicated converters:

Document Structure

Headings

Text Formatting

Lists

Tables

Code Blocks

Expand Sections

Media Elements

Social Elements

Metadata Comments

When using the Enhanced parser, custom attributes are preserved as HTML comments:

Metadata Comment Formats

Next Steps

Last updated