Markdown to Slack Mrkdwn Converter

0.3.2 · active · verified Sat Apr 11

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.

Warnings

Install

Imports

Quickstart

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!")
# ```

view raw JSON →