Skip to main content

Bidirectional converter between GitHub Flavored Markdown and Atlassian Document Format

Project description

Marklas

CI PyPI Python License

Bidirectional converter between Markdown and Atlassian Document Format (ADF).


Why Marklas?

Confluence and Jira store documents in ADF — a verbose JSON structure. Marklas converts it to readable Markdown and back through a union AST:

Markdown ⇄ Union AST ⇄ ADF

ADF-only features (panels, mentions, colored text, etc.) are preserved as invisible HTML comment annotations, so the full structure survives a roundtrip:

<!-- adf:panel {"panelType": "info"} -->
This is an info panel — readable as plain Markdown.
<!-- /adf:panel -->

User <!-- adf:mention {"id": "abc123", "text": "@John"} -->`@John`<!-- /adf:mention --> approved this.

Pass annotate=False to strip annotations and get clean Markdown.

Installation

pip install marklas

Usage

from marklas import to_adf, to_md

# Markdown → ADF
adf = to_adf("## Hello\n\nThis is **bold**.")

# ADF → Markdown (with annotations for lossless roundtrip)
md = to_md(adf_document)

# ADF → Markdown (clean, no annotations)
clean_md = to_md(adf_document, annotate=False)

# Roundtrip
original_adf = fetch_confluence_page()
markdown = to_md(original_adf)          # edit in any Markdown editor
restored_adf = to_adf(markdown)         # push back — structure preserved

Token Efficiency

Markdown is significantly more compact than ADF JSON — critical for LLM-based workflows where every token counts.

ADF JSON Markdown (annotated) Markdown (plain)
Tokens 243,217 76,541 41,744
Reduction 3.2x 5.8x

Measured on 7 real Confluence pages (pretty-printed JSON) using GPT-4o tokenizer (tiktoken).

Documentation

Note: Table cells use inline HTML (<ul>, <code>, <br>) for block-level content. Raw HTML and other Markdown-only constructs are dropped during ADF conversion. See the mapping reference for details.

Development

uv sync --extra dev
uv run pytest -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marklas-0.5.0.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marklas-0.5.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file marklas-0.5.0.tar.gz.

File metadata

  • Download URL: marklas-0.5.0.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for marklas-0.5.0.tar.gz
Algorithm Hash digest
SHA256 88c693e54b4830c4eb916393a9528c22eabaeef51d2cdbc31d4ba4b70cbd3e5b
MD5 71cc0b5460477028f6c952f92f1c8c87
BLAKE2b-256 6e8adaa88cff902dff42862fc992c2d709088903022740e19610db92d44bd70f

See more details on using hashes here.

Provenance

The following attestation bundles were made for marklas-0.5.0.tar.gz:

Publisher: publish.yml on byExist/marklas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marklas-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: marklas-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 30.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for marklas-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f17b6a58c4ed9b70ec83d39628aa1aedb9af9898cef07ab1ab9c6c1e0775b0fa
MD5 28269f82e2cf4a712cb6193758bea397
BLAKE2b-256 26ff6070f9b53be291652a4e5fef66aa39b35ea714fadad457ef59a5fe46907f

See more details on using hashes here.

Provenance

The following attestation bundles were made for marklas-0.5.0-py3-none-any.whl:

Publisher: publish.yml on byExist/marklas

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page