Convert markdown to Slack-compatible formatting
Project description
Slackify Markdown
A Python library for converting Markdown to slack specific markdown. This is inspired from existing npm package slackify-markdown
Overview
This library converts regular Markdown to Slack-specific markdown, making it easy to use and display correctly in Slack messages.
Installation
pip install slackify-markdown
Usage
from slackify_markdown import slackify
# Convert markdown to Slack mrkdwn
from 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>
"""
Features
- 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
Example Conversions
| Markdown | Slack mrkdwn |
|---|---|
# Heading |
*Heading* |
**Bold** |
*Bold* |
*Italic* |
_Italic_ |
`code` |
`code` |
[Link](https://example.com) |
<https://example.com|Link> |
Contributing
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
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgements
Shoutout to jsarafaj, his JS library has inspired the code and tests for this package.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slackify_markdown-0.1.4.tar.gz.
File metadata
- Download URL: slackify_markdown-0.1.4.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea047469df49220b83a4c107946b8058089f6762975dcd60ccdbaf38283187f6
|
|
| MD5 |
f782b33b277ae18d5b5c79908253aabe
|
|
| BLAKE2b-256 |
fd013060d4a691937dd6c3532d6eaf8509fa4d1f5172ca1a9c868e4e44506deb
|
File details
Details for the file slackify_markdown-0.1.4-py3-none-any.whl.
File metadata
- Download URL: slackify_markdown-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf6d19a88558dad3e730e36fde8c31e196ceb73789e5bb57a6681b935ab8409d
|
|
| MD5 |
16b8493d9df0682d36f3ccb51c66aee9
|
|
| BLAKE2b-256 |
ed8b0d3795ec04f4eae781a62337dd7c4dd0c6b755768d56be8e1134efecfa0d
|