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

Uploaded Python 3

File details

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

File metadata

  • Download URL: slackify_markdown-0.2.1.tar.gz
  • Upload date:
  • Size: 8.6 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.1.tar.gz
Algorithm Hash digest
SHA256 c79354bbacf1daa793f1538d40ce8b3df5df271c557eb468fce90e937ff37fd4
MD5 de3115d16c36efbe884ba4f8a8dcd53c
BLAKE2b-256 76c485361d18b5f643d35d9f1977c6656857934315301ef86aaf2c0aff175318

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for slackify_markdown-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb991d6c4a03fb121df990ae94265c80aab811e0b37af2b0409e615611634eeb
MD5 4f3df9676ee970a3078dc5739a24c53d
BLAKE2b-256 e4b4388889d5ecf37cde7bc74320a82b0b8924fc520c528f23a0a865b4dc87d5

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