mdto-messages for Python
Convert a Markdown draft into text for a chat composer, safe HTML for email, or JSON-ready request bodies for messaging APIs. Conversion runs locally. Python 3.10 or newer is required.
Install
For a published PyPI version, install with:
python -m pip install mdto-messages
PyPI versions · Source repository
To install directly from GitHub:
python -m pip install "mdto-messages @ git+https://github.com/jmeinke/mdto-messages.git#subdirectory=packages/python"
To install from a local checkout, run python -m pip install ./packages/python at the repository root.
Convert a draft
from mdto_messages import convert, to_messages
draft = convert("Please **review**.", "whatsapp")
assert draft.text == "Please *review*."
message = to_messages("😀 **Ready**", "telegram").messages[0]
assert message["entities"] == [{"type": "bold", "offset": 3, "length": 5}]
convert(markdown, target="plaintext") returns text, optional html, format, target, and diagnostics. Draft targets are plaintext, html, email, whatsapp, threema, viber, google-chat, signal, discord, telegram, slack, and teams.
to_messages(markdown, target) returns an ordered list of bodies in messages, plus diagnostics. API targets are whatsapp, threema, viber, google-chat, discord, telegram, slack, and teams. Each body can be passed to json.dumps. The caller provides delivery, credentials and recipient information.
Both functions accept keyword-only policy and max_input_length. The default readable policy preserves paragraph spacing. compact reduces spacing, and strict raises an error when formatting must be simplified. Diagnostics describe each adjustment with a stable code, severity, and suggested action. The default limit is 32,768 UTF-16 code units. Set a value from 1 through 131,072 to adjust it. Rendering and platform-specific size limits also apply.
Catch ConversionError and check exc.code: INVALID_INPUT denotes invalid Markdown input or options, UNKNOWN_TARGET an unsupported target, LIMIT an exceeded resource or payload bound, and LOSS an adjustment that strict policy rejects.
Try the browser tools for chat drafts, email, and plain text.
Metadata
Release files for mdto-messages 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mdto_messages-0.1.0.tar.gz | 15.3 kB | With provenance | Details for mdto_messages-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mdto_messages-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mdto_messages-0.1.0-py3-none-any.whl |
Total release size: 34.1 kB
Release files / mdto_messages-0.1.0.tar.gz
| Download URL | mdto_messages-0.1.0.tar.gz |
|---|---|
| Size | 15.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5462e10363d36eef5a7f1119d584b144ba243cf3f4b8e4a3b3b08f597e53000d
|
|
BLAKE2b-256 checksum How to use checksums |
cc9a0c6b1f016e1ea9ea18667430c6acf5dd211cc8fdf9235334c7841139272b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / mdto_messages-0.1.0-py3-none-any.whl
| Download URL | mdto_messages-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6fe1ffce0e068c723bdf5e3e09fdc49b0fbe655488a6d0b6c030ace2826055a0
|
|
BLAKE2b-256 checksum How to use checksums |
77591372944a17af15ded947f6c3ffda479e21ac9b7893c54099b24167273d89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for mdto-messages 0.1.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mdto_messages-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA 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.