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 81,246 41,734
Reduction 3.0x 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.2.tar.gz (30.0 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.2-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: marklas-0.5.2.tar.gz
  • Upload date:
  • Size: 30.0 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.2.tar.gz
Algorithm Hash digest
SHA256 819a81b7ca225d186e04a19fedea8ff31987b9b19bf6f41f8192c0d486f2b248
MD5 45ba15d5fefe5ed79fa684f06515731e
BLAKE2b-256 2a0c29b63886e0df822dc9f0b14c265c87dc6fd29ca7cb7c0f72bc7c6442bd60

See more details on using hashes here.

Provenance

The following attestation bundles were made for marklas-0.5.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: marklas-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 34.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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a94a875130fcb83fa9c36bd54d506ed0944d9cc55e1cccbbd04086c0ebf0119b
MD5 29529c07d2f158f32dd7dcb48c8e7030
BLAKE2b-256 f90132752b02ad0d4dd0b744a6499a3fc47becd0120fbf35f20abe9ebe2bda95

See more details on using hashes here.

Provenance

The following attestation bundles were made for marklas-0.5.2-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