Mistune Slack Renderer
Convert Markdown into Slack Block Kit format using Mistune. Useful for LLM-powered chatbots!
Kitchen sink demo
- View Kitchen Sink Markdown: test/testdata/kitchen_sink.md.txt
- View Output in Block Kit Builder: https://app.slack.com/block-kit-builder/#...
Features
- Produces Slack Block Kit JSON for posting messages to Slack
- Renders Slack users, channels, broadcasts, and emojis
- Supports strikethrough, task lists, URLs, and code blocks
- Headings, paragraphs, block quotes, and dividers
- Ordered and bullet lists (with nesting and task-list support)
- Inline code and fenced code-block rendering
- Link conversion into Slack link elements
- Note: images not supported. It should be easy to add by subclassing
mistune_slack.renderer.SlackRendererand adding your own logic (such as you may want to upload the image somewhere as well)
Install
uv add mistune-slack
Usage
from mistune_slack import render_slack_blocks_from_markdown
markdown = "# Hello, *world*!"
blocks = render_slack_blocks_from_markdown(markdown)
print(blocks) # post `blocks` to Slack
Advanced usage
import mistune
from mistune.plugins.formatting import strikethrough
from mistune.plugins.task_lists import task_lists
from mistune.plugins.url import url
from mistune_slack import SlackRenderer, slack_pluginSlackRenderer
markdown = "# Hello, *world*!"
renderer = mistune.create_markdown(renderer=SlackRenderer(), plugins=[slack_plugin, strikethrough, url, task_lists])
blocks: list[dict] = renderer(markdown) # type: ignore
print(blocks) # post `blocks` to Slack
Testing
uv run test
License
MIT
Metadata
Release files for mistune-slack 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mistune_slack-0.1.4.tar.gz | 71.4 kB | Without provenance | Details for mistune_slack-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mistune_slack-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for mistune_slack-0.1.4-py3-none-any.whl |
Total release size: 81.8 kB
Release files / mistune_slack-0.1.4.tar.gz
| Download URL | mistune_slack-0.1.4.tar.gz |
|---|---|
| Size | 71.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae0f2690868328645fc5ca0a7642159e150f342f274046071bfc7fb480f2fea6
|
|
BLAKE2b-256 checksum How to use checksums |
813608b5c3ef1757a9638789a2bc03346a612f75fb837ca008b124b2c721df8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.1
|
Release files / mistune_slack-0.1.4-py3-none-any.whl
| Download URL | mistune_slack-0.1.4-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66b3f0ea3ef034049493c7dafd47f67870804b35a0352fd4ab952e077ca3a5a6
|
|
BLAKE2b-256 checksum How to use checksums |
0bbf2f1eb4f250d754994d1671a03b34fecf7ae6023427594ea02fcd394697e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.1
|
Security for mistune-slack 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.