Skip to main content

Convert CommonMark Markdown to Slack Markdown

Project description

CommonMark-Slack

CommonMark-Slack extends the commonmark.py library to add rendering of the Slack flavor of Markdown. This can be handy if you are already using standard Markdown for another purpose and would like to also produce Slack output from the same source. CommonMark-slack also allows for producing plaintext from standard Markdown, useful for the areas of Slack that use unadorned text.

Installation

You can install CommonMark-Slack from PyPI:

pip install commonmark-slack

The commonmark-slack package is supported by Python 3.6 and above.

Usage

import commonmarkslack
parser = commonmarkslack.Parser()
ast = parser.parse("Hello *World*")

renderer = commonmark.SlackRenderer()
slack_md = renderer.render(ast)
print(slack_md) # Hello _World_

renderer = commonmarkslack.PlainTextRenderer()
plain_text = renderer.render(ast)
print(plain_text) # Hello World

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

commonmark-slack-1.0.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

commonmark_slack-1.0.0-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

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