Skip to main content

Bidirectional converter between GitHub Flavored Markdown and Atlassian Document Format

Project description

Marklas

CI PyPI Python License

MarkdownADF

Installation

pip install marklas

Usage

Markdown → ADF

from marklas import to_adf

adf = to_adf("**Hello** world")

# {
#   "type": "doc",
#   "version": 1,
#   "content": [
#     {
#       "type": "paragraph",
#       "content": [
#         {"type": "text", "text": "Hello", "marks": [{"type": "strong"}]},
#         {"type": "text", "text": " world"}
#       ]
#     }
#   ]
# }

ADF → Markdown

from marklas import to_md

md = to_md(adf)

# "**Hello** world\n"

Conversion Rules

Block

ADF Markdown
paragraph inline content
heading (level 1-6) # ~ ######
codeBlock (language?) ```lang\ncode\n```
blockquote > text
bulletList > listItem - item
orderedList > listItem 1. item
taskList > taskItem - [x] / - [ ]
decisionList > decisionItem - [x] / - [ ]
rule ---
table > tableRow > tableHeader/tableCell GFM table (merged cells are split, only paragraph content)
mediaSingle > media (external) ![alt](url)
mediaSingle > media (non-external) [Image: id]
mediaGroup > media ![alt](url) / [Image: id]
panel > text
expand / nestedExpand (title?) > title\n> text
layoutSection > layoutColumn columns flattened
blockCard (url) [url](url)
embedCard (url) [url](url)

Inline

ADF Markdown
text plain text
text + strong mark **text**
text + em mark *text*
text + strike mark ~~text~~
text + code mark `code`
text + link mark [text](url)
hardBreak \ + newline
mention `@user`
emoji :shortName:
date `2024-01-01`
status `status text`
inlineCard (url) [url](url)

Not Supported

Element Behavior
ADF marks: underline, textColor, backgroundColor, subsup silently ignored
ADF blocks: extension, bodiedExtension, syncBlock, bodiedSyncBlock [type] placeholder
ADF inlines: placeholder, inlineExtension, mediaInline [type] placeholder
Markdown: raw HTML (block, inline) silently ignored

Development

uv sync --extra dev
uv run pytest -v
uv run black src/ tests/

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.2.1.tar.gz (11.4 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.2.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for marklas-0.2.1.tar.gz
Algorithm Hash digest
SHA256 c0f896d8c1369710306e529de62c19e31f57d8d3161bec0532b3faa3556dad15
MD5 a7022841741fcc91700283a8649b25bf
BLAKE2b-256 8841668c471449bdf92fb66d0c891196394b8c55c1c98141ad69f89a6feb7e59

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: marklas-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 15.7 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfd421f6700558044c974893f35dd9efbfedcf345ff70270cc7bc70a8044b603
MD5 b75b84ad58d41bb4014ffb77e11cb5e5
BLAKE2b-256 a4b315eab1f3bb17ece10d3913ff86103656a81446fe04f2b5052868d03943a5

See more details on using hashes here.

Provenance

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