A Python library for converting Markdown to slack specific markdown. This is inspired from existing npm package slackify-markdown
This library converts regular Markdown to Slack-specific markdown, making it easy to use and display correctly in Slack messages.
pip install slackify-markdownfrom slackify_markdown import slackify_markdown
markdown = """
# Title
This is **bold text** and this is *italic text*.
## Subtitle
1. **Item 1**
2. *Item 2*
## Another Subtitle
* **Element 1** - *Description 1*
* **Element 2** - *Description 2*
[Link](https://example.com)
"""
slack_output = slackify_markdown(markdown)
"""
*Title*
This is *bold text* and this is _italic text_.
*Subtitle*
1. *Item 1*
2. _Item 2_
*Another Subtitle*
• *Element 1* - _Description 1_
• *Element 2* - _Description 2_
<https://example.com|Link>
"""- Converts headers to Slack-compatible bold text
- Preserves bold and italic formatting
- Handles code blocks and inline code
- Converts links to Slack's expected format
- Processes lists (ordered and unordered)
- Handles blockquotes
| Markdown | Slack mrkdwn |
|---|---|
# Heading |
*Heading* |
**Bold** |
*Bold* |
*Italic* |
_Italic_ |
`code` |
`code` |
[Link](https://example.com) |
<https://example.com|Link> |
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Shoutout to jsarafaj, his JS library has inspired the code and tests for this package.