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.1.tar.gz (29.2 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.1-py3-none-any.whl (33.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: marklas-0.5.1.tar.gz
  • Upload date:
  • Size: 29.2 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.1.tar.gz
Algorithm Hash digest
SHA256 bf105307ef4624f058fe925198311ddc3375854c085e3f24540213136005e7e1
MD5 d2f64751b0ac023442a1d9bb30713c22
BLAKE2b-256 56822d7980fa3c66701e0c92358faae37808914cc7dc2d1735c12b8f68cefdb5

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: marklas-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 33.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d792a1c45c6d3c6a5ecfe2e700af85649800fe4deba245025a58a835923dc6f
MD5 4d6ad4423d49de47ac113c390624fafe
BLAKE2b-256 e575aa4f708ed1d0a57a8c5d99f35bd6d03d90dbf5c2b8226eb7eb7fcf102bdc

See more details on using hashes here.

Provenance

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