Registry / communication / markdown-to-mrkdwn

markdown-to-mrkdwn

JSON →
library0.3.3pypypi✓ verified 23d ago

A lightweight, efficient Python library (current version 0.3.2) for converting standard Markdown to Slack's custom mrkdwn format. It helps maintain consistent formatting when sending messages to Slack from applications. The library features comprehensive support for various Markdown elements and includes a plugin system for extended functionality. It has a moderate release cadence, with several minor releases and bug fixes in the past year.

pip install markdown-to-mrkdwn
INSTALL
IMPORT
SIG · MARKDOWN-TO-MRKDWN
M
markdown-to-mrkdwn
communicationpythonv0.3.3
Install
1.6s avg
Import
27ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.028s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.026s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SlackMarkdownConverter
from markdown_to_mrkdwn import SlackMarkdownConverter

Initialize the converter and pass your Markdown string to the `convert` method. The library will return the equivalent Slack mrkdwn string.

from markdown_to_mrkdwn import SlackMarkdownConverter converter = SlackMarkdownConverter() markdown_text = """ # Heading 1 **Bold text** - List item [Link](https://example.com) ~~Strikethrough text~~ ```python print("Hello, Slack!") ``` """ mrkdwn_text = converter.convert(markdown_text) print(mrkdwn_text) # Expected output in Slack's mrkdwn format (approximately): # *Heading 1* # *Bold text* # • List item # <https://example.com|Link> # ~Strikethrough text~ # ```python # print("Hello, Slack!") # ```
Debug
Known issues
breakingThe minimum required Python version has been updated from Python 3.6 to Python 3.8. Users on Python 3.6 or 3.7 will need to upgrade their Python environment to use versions 0.3.x and newer.
fix
Upgrade Python to version 3.8 or higher, or pin to an older `markdown-to-mrkdwn` version (e.g., `<0.3.0`) if Python upgrade is not feasible.
affects: >=0.3.0
gotchaSlack's 'mrkdwn' is a custom formatting syntax and is not identical to standard Markdown. While this library performs a conversion, some Markdown features (like multiple header levels beyond bolding, or complex tables) may be represented differently or have limitations due to mrkdwn's capabilities. Always test converted output in Slack's Block Kit Builder.
fix
Familiarize yourself with Slack's `mrkdwn` specifications (api.slack.com/reference/block-kit/composition-objects#mrkdwn_element) to understand potential differences and test the converted output thoroughly.
affects: All versions
gotchaThe plugin system, introduced in v0.2.0, allows for custom conversion logic. While powerful, incorrectly implemented plugins can lead to unexpected or erroneous output. Ensure custom plugins are thoroughly tested for edge cases.
fix
Refer to the library's documentation on plugin development. When creating custom plugins, write comprehensive unit tests to ensure they handle various Markdown inputs correctly and don't interfere with built-in conversions.
affects: >=0.2.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'markdown_to_mrkdwn'
The 'markdown-to-mrkdwn' library has not been installed, or the Python environment where the code is run does not have access to the installed package.
fix
Install the library using pip: `pip install markdown_to_mrkdwn`
from markdown-to-mrkdwn import SlackMarkdownConverter
Python import statements use underscores (_) instead of hyphens (-) for package names. Attempting to import with hyphens will result in a SyntaxError or ModuleNotFoundError.
fix
Use underscores in the import statement: `from markdown_to_mrkdwn import SlackMarkdownConverter`
AttributeError: 'module' object has no attribute 'SlackMarkdownConverter'
This usually occurs if you incorrectly try to access the `SlackMarkdownConverter` class directly from the module without importing it properly, or if an older version of the library with a different structure is present.
fix
Ensure the `SlackMarkdownConverter` class is explicitly imported: `from markdown_to_mrkdwn import SlackMarkdownConverter`
AttributeError: 'SlackMarkdownConverter' object has no attribute 'convert'
You are attempting to call a method named 'convert' on an instance of `SlackMarkdownConverter`, but either the method name is misspelled, or you're using an outdated version of the library where the primary conversion method might have a different name.
fix
Verify the method name is correctly spelled as 'convert' and ensure you are calling it on an instantiated object: `converter = SlackMarkdownConverter()
mrkdwn_text = converter.convert(markdown_text)`
Upgrade
Version history
0.3.3latest on PyPI · released May 27, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
8
Amazon
1
OpenAI (training)
1
Resources
markdown-to-mrkdwn — pip install markdown-to-mrkdwn · libregistry