Skip to main content

md-adf

Typed Python implementation of the Markdown-ADF converter.

Install

pip install md-adf

Requires Python 3.10 or newer.

API

from md_adf import (
    adf_to_markdown,
    markdown_to_adf,
    parse_adf,
    validate_adf,
)

markdown_result = adf_to_markdown(adf_document)
print(markdown_result.value)
print(markdown_result.diagnostics)

adf_result = markdown_to_adf("## Hello\n\nThis is **ADF**.")
print(adf_result.value)

Results have this shape:

@dataclass(frozen=True)
class ConversionResult(Generic[T]):
    value: T
    diagnostics: list[Diagnostic]

Current ConversionOptions support:

  • markdown_dialect: only gfm is supported; other values are rejected. Dict options may also use markdownDialect.
  • profile: jira, confluence, and portableMarkdown are accepted for API and CLI parity, but do not change Phase 1 conversion behavior yet.
  • validate_adf: defaults to True; set to False to skip pinned schema validation for ADF-to-Markdown input. Dict options may also use validateAdf.
  • normalize_adf: accepted for future normalization controls. It is currently a no-op because Phase 1 Markdown-to-ADF output is already normalized where supported. Dict options may also use normalizeAdf.

ADF-to-Markdown returns a string with trailing whitespace trimmed and no final newline. The CLI writes that string exactly.

CLI

md-adf to-md input.adf.json --output output.md
md-adf to-adf input.md --output output.adf.json
md-adf validate-adf input.adf.json
cat input.md | md-adf to-adf --profile jira

Supported profiles are jira, confluence, and portableMarkdown. Diagnostics are emitted as JSON lines to stderr.

Current Support

  • ADF validation/parsing against a pinned ADF schema.
  • ADF to Markdown for doc, paragraph, heading, blockquote, bulletList, orderedList, listItem, codeBlock, rule, simple GFM tables, task lists, panel blockquotes, expand flattening, card link/text fallback, media link/text fallback, rich inline text fallback for mention, emoji, date, and status, text, and hardBreak.
  • Markdown to ADF for paragraphs, headings, block quotes, lists, GFM task lists, code blocks, thematic breaks, GFM tables, simple <details> / <summary> blocks as expands, text, hard breaks, soft breaks, links, images as link text fallback, and raw HTML as text fallback.
  • Marks for strong, em, strike, code, and link.
  • Structured diagnostics for invalid ADF roots, unsupported ADF nodes/marks, invalid containers, invalid link marks, complex table omission, task-list fallback, malformed details fallback, panel/expand/card fallback, image/media fallback, rich inline fallback, and dropped rich inline attributes.

Known Limitations

  • ADF to Markdown only renders simple rectangular tables as GFM pipe tables; complex tables are omitted with diagnostics.
  • Media is represented as Markdown link/text fallback; no media URL resolver or image emission exists yet.
  • Markdown to ADF maps images to linked text fallback instead of ADF media nodes.
  • Mixed or complex GFM task lists may fall back to ordinary list items with diagnostics.
  • ADF to Markdown renders mentions, emoji, dates, and statuses as text fallbacks; Markdown to ADF keeps that text as normal text and does not recreate rich inline node IDs.
  • ADF to Markdown renders panels, expands, nested expands, and cards as conservative Markdown fallbacks; Markdown to ADF supports simple raw HTML <details> / <summary> blocks as ADF expands but keeps other fallback blockquotes, headings, text, and links as ordinary Markdown structures.
  • ADF to Markdown does not yet render layout nodes, extensions, or color/underline/subscript/superscript marks.
  • Markdown raw HTML is preserved as text fallback except for simple supported <details> / <summary> expand blocks; general raw HTML preservation is not available.
  • Unsupported ADF nodes are omitted with diagnostics.
  • Markdown parser AST access is not exposed as public API yet; conversion uses real Markdown parsers internally.

Development

poetry -C packages/python run python ../../tools/conformance/run-python.py
poetry -C packages/python run pytest
poetry -C packages/python run ruff check --config ../../pyproject.toml src tests ../../tools/conformance/run-python.py
poetry -C packages/python run mypy --config-file ../../pyproject.toml src tests ../../tools/conformance/run-python.py
npm run test:packages

Shared conformance fixtures live in ../../fixtures and are run by the root just test-python command.

Metadata

Release files for md-adf 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for md-adf 0.3.0
File Size Uploaded Provenance Actions
md_adf-0.3.0.tar.gz 32.6 kB Without provenance Details for md_adf-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for md-adf 0.3.0
File Interpreter ABI Platform Actions
md_adf-0.3.0-py3-none-any.whl Python 3 none any Details for md_adf-0.3.0-py3-none-any.whl

Total release size: 88.4 kB

Release files / md_adf-0.3.0.tar.gz

Download URL md_adf-0.3.0.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4d0cd6c6a551c5e4ade416a8394be7d49bfd2518ce655fa633ca57791a1626ac
BLAKE2b-256 checksum
How to use checksums
348f6b8001e68ef23d8a742316e318760a918d4cbacdb520e40ea7eaee8c43c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.11.4 Darwin/25.6.0

Release files / md_adf-0.3.0-py3-none-any.whl

Download URL md_adf-0.3.0-py3-none-any.whl
Size 55.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a3bf7cc25ca070f5e657ca4b9c83928e1f8fb7b24fa9695d6f733ac5ece556a
BLAKE2b-256 checksum
How to use checksums
0379c82237b7a2c14ce561d2cdcacd288f1f9c4998534348ea0a771df29b090d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.11.4 Darwin/25.6.0

Security for md-adf 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page