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.2.tar.gz (8.7 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.2-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for slackify_markdown-0.2.2.tar.gz
Algorithm Hash digest
SHA256 f24185fca7775edc547ba5aca560af603e8af7cab1262a2e0a421cbe3831fd0d
MD5 9f1d9dc368c171f9f111ffc7889bd500
BLAKE2b-256 53c7bf20dba3e51af1e27c0f2ee94cc3f4c0716fbbda3fe3aa087f8318c04af2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for slackify_markdown-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ff63c41004c39135db17f682b0d0864268f29132992ea987063150d8162b9e70
MD5 47b5d8069e8334549310d0fe1f47a0d9
BLAKE2b-256 b312ef80548ce2a87cb239909f615cfdef224d165c3d6c2cdf226c833fa1784e

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