Metadata-Version: 2.4
Name: adf_lib
Version: 0.3.1
Summary: A Python library for creating and manipulating ADF (Atlassian Document Format) documents
Author-email: Dimuthu Lakmal <info@lakmal.dev>
License: MIT License
        
        Copyright (c) 2024 ADF Library
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/lakmal98/adf-lib
Project-URL: Bug Tracker, https://github.com/lakmal98/adf-lib/issues
Project-URL: Documentation, https://github.com/lakmal98/adf-lib
Keywords: adf,atlassian,document,format,markup
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: Markup
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# ADF Library

ADF Library is a Python package for creating and exporting Atlassian Document Format (ADF) content for Jira, Confluence, and other Atlassian Cloud products.

## Overview

The library provides:

- high-level helpers for headings, paragraphs, tables, and links
- generic `Node` and `Mark` builders for the latest published ADF node and mark types
- plain Python dictionaries that can be sent directly to Atlassian APIs

## Installation

```bash
pip install adf_lib
```

## Quick Start

```python
from adf_lib import ADF, Link, Mark, Node, NodeType, Table, Text
from adf_lib.constants.enums import HeadingLevel

doc = ADF()
doc.add(Text("My Document").heading(HeadingLevel.H1))
doc.add(Text("This is a formatted paragraph", "strong", "em").paragraph())

link = Link(href="https://example.com", title="Example")
doc.add(Text("Open example", link.to_mark()).paragraph())

doc.add(
    Node(
        NodeType.PANEL,
        attrs={"panelType": "info"},
        content=[Text("This uses a latest-schema node").paragraph()],
    )
)

doc.add(
    Node(
        NodeType.PARAGRAPH,
        content=[
            Node(
                NodeType.TEXT,
                text="Highlighted text",
                marks=[Mark("backgroundColor", {"color": "#FFF0B3"})],
            )
        ],
    )
)

adf_dict = doc.to_dict()
```

## Latest ADF Node Coverage

Use `Text`, `Table`, and `Link` for common authoring flows. Use `Node`, `NodeType`, and `Mark` for newer ADF structures such as:

- lists: `bulletList`, `orderedList`, `listItem`
- rich blocks: `codeBlock`, `panel`, `blockquote`, `rule`, `expand`, `nestedExpand`
- smart content: `inlineCard`, `blockCard`, `embedCard`, `status`, `date`, `mention`, `emoji`
- layout and media: `layoutSection`, `layoutColumn`, `media`, `mediaGroup`, `mediaSingle`

This keeps the public API small while allowing the library to emit the latest published ADF node names.

## API Summary

### Core helpers

- `ADF`: document container
- `Text`: heading and paragraph helper
- `Table`: table helper
- `Link`: link mark helper

### Generic schema helpers

- `Node`: generic ADF node builder
- `NodeType`: enum of latest published node names
- `Mark`: generic ADF mark builder
- `MarkType`: enum of latest published mark names

## Documentation

Project documentation is available in `/docs` and published at:

- https://docs.py-adf.apps.lakmal.dev/

## References
- https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/
- http://go.atlassian.com/adf-json-schema
