Skip to main content

Convert markdown to Slack-compatible formatting

Project description

Slackify Markdown

PyPI Downloads

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_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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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

slackify_markdown-0.2.3.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slackify_markdown-0.2.3-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file slackify_markdown-0.2.3.tar.gz.

File metadata

  • Download URL: slackify_markdown-0.2.3.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for slackify_markdown-0.2.3.tar.gz
Algorithm Hash digest
SHA256 85a458356b0d717ffab10daa79c071ae7dc4f8fabc1fa07e08bfb68c7476fc93
MD5 0137f61c93b8e0cdf738556612a4147d
BLAKE2b-256 6ef164565b95f09f721f0ba7e828705b0011300945d47bf87ae4b725ea4dcd5c

See more details on using hashes here.

File details

Details for the file slackify_markdown-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for slackify_markdown-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c4b7827ace049f907271e8c9efeae4a3af83bc784bdf28e0cd41a849c3c9fb09
MD5 f812d17627886ad5532e2aaba34fb298
BLAKE2b-256 ffc1df6e43e413d48873d29fbe443fdfe22867d2b21ad1c60cd0c569125f9347

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page