Convert GitHub markdown to Slack markdown format
Project description
markdown-to-slack-mkdown
Convert GitHub markdown to Slack markdown format.
This is a Python port of githubmarkdownconvertergo (Go package).
Installation
pip install markdown-to-slack-mkdown
Usage
from markdown_to_slack_mkdown import slack_convert, SlackConvertOptions
# Basic conversion
markdown_text = "**bold** and ~~strikethrough~~ with [link](https://example.com)"
slack_text = slack_convert(markdown_text)
print(slack_text) # *bold* and ~strikethrough~ with <https://example.com|link>
# With options
options = SlackConvertOptions(
headlines=True, # Convert markdown headers to bold text
repo_name="owner/repo", # Link issue references to GitHub
github_url="https://github.com", # Custom GitHub URL
custom_ref_patterns={ # Custom reference patterns
r'JIRA-(?P<ID>\d+)': "https://jira.example.com/browse/JIRA-${ID}"
}
)
markdown_text = "## Features\n- Fix #123\n- JIRA-456"
slack_text = slack_convert(markdown_text, options)
Features
- Bold text:
**text**→*text* - Strikethrough:
~~text~~→~text~ - Links:
[text](url)→<url|text> - User mentions:
@username→<https://github.com/username|@username> - Issue/PR references:
#123→<https://github.com/owner/repo/pull/123|#123>(when repo_name is set) - Lists:
* item→• item - Headlines:
## Header→*Header*(when headlines option is enabled) - Custom patterns: Define your own pattern replacements (e.g., JIRA tickets)
Development
Prerequisites
Install uv package manager:
curl -LsSf https://astral.sh/uv/install.sh | sh
Makefile Commands
# Show available commands
make help
# Install development dependencies
make install
# Run linting (flake8 and mypy)
make lint
# Format code with black
make format
# Run tests
make test
# Run tests with coverage
make coverage
# Build the package
make build
# Clean build artifacts
make clean
Manual Commands
If you prefer to run commands directly:
# Install dependencies
uv sync --group dev
# Run tests
uv run pytest
# Format code
uv run black .
# Lint code
uv run flake8 markdown_to_slack_mkdown tests
uv run mypy markdown_to_slack_mkdown
License
MIT
Project details
Release history Release notifications | RSS feed
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 markdown_to_slack_mkdown-0.1.3.tar.gz.
File metadata
- Download URL: markdown_to_slack_mkdown-0.1.3.tar.gz
- Upload date:
- Size: 36.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce371003731bc40ce37b148362831b9c8bcd356dd983c2c1a1f5791bf1713d19
|
|
| MD5 |
81509e40c2e90c3f34847ee54a68e476
|
|
| BLAKE2b-256 |
87b59287db8fd5e83ac14621a7666680adc73ddc47672468622b466db49958e2
|
File details
Details for the file markdown_to_slack_mkdown-0.1.3-py3-none-any.whl.
File metadata
- Download URL: markdown_to_slack_mkdown-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.8 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 |
a3286cee44cefbc290d08e820f10e43287c9c03052ff6345fd3ffd3252993c4f
|
|
| MD5 |
c55d3da0c5f1f688083df11d8ec6945d
|
|
| BLAKE2b-256 |
e14b230c12a1ac2dff820a66e0fec7efb15c915a7310b5e47b9c4b9c5d2f6284
|