Metadata-Version: 2.4
Name: adf-parse
Version: 0.2.0
Summary: Convert Atlassian Document Format (ADF) from Jira/Confluence into plain text or Markdown
Keywords: adf,atlassian,jira,confluence,markdown,parser
Author: Abhishek Hazra
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Text Processing :: Markup :: Markdown
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/hazra1991/adf-parse
Project-URL: Repository, https://github.com/hazra1991/adf-parse
Description-Content-Type: text/markdown

# adf-parse

Convert [Atlassian Document Format (ADF)](https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/) — the JSON format used by Jira and Confluence — into plain text / Markdown.

Zero dependencies. Supports paragraphs, headings, bullet/ordered lists (with nesting), code blocks, tables (with header detection), blockquotes, panels, expands, task lists, mentions, emoji, dates, statuses, inline cards, hard breaks, rules, and media references. Inline marks render as real Markdown: links `[text](url)`, **bold**, *italic*, ~~strikethrough~~, and `code`.

## Installation

```bash
pip install adf-parse
```

Requires Python 3.11+.

## Usage

```python
from adf_parse import create_md_doc, parse_doc

adf = {
    "type": "doc",
    "version": 1,
    "content": [
        {"type": "heading", "attrs": {"level": 2},
         "content": [{"type": "text", "text": "Release notes"}]},
        {"type": "paragraph",
         "content": [{"type": "text", "text": "See the docs",
                      "marks": [{"type": "link", "attrs": {"href": "https://example.com"}}]}]},
    ],
}

print(create_md_doc(adf))
# ## Release notes
#
# [See the docs](https://example.com)
```

For search indexes, RAG, and LLM/agent pipelines, use plain mode — it drops emoji and all Markdown decoration (`**`, `*`, `~~`, backticks, `[text](url)`), giving clean text while links and media are still collected as data:

```python
from adf_parse import create_text_doc

create_text_doc(adf)          # clean plain text
parse_doc(adf, plain=True)    # same, with .links and .media_ref
```

To also get the extracted links and media references, use `parse_doc`:

```python
result = parse_doc(adf)
result.collected_text  # list of rendered blocks
result.links           # list of (text, href) tuples
result.media_ref       # list of MediaRef(ref_type, ref)
```

## License

MIT
