All Projects → datadesk → slackdown

datadesk / slackdown

Licence: MIT license
A simple Slack message text formatting to HTML code converter.

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to slackdown

Breakdance
It's time for your markup to get down! HTML to markdown converter. Breakdance is a highly pluggable, flexible and easy to use.
Stars: ✭ 418 (+1448.15%)
Mutual labels:  converter, markup
unicode-formatter
Convert portions of text to fancy text using unicode fonts for use on Twitter and other sites that don't support rich text
Stars: ✭ 31 (+14.81%)
Mutual labels:  converter, formatting
awesome-kramdown
A collection of awesome kramdown goodies for the converter for (structured) text with formatting markup in markdown conventions
Stars: ✭ 36 (+33.33%)
Mutual labels:  formatting, markup
Pandoc
Universal markup converter
Stars: ✭ 24,250 (+89714.81%)
Mutual labels:  converter, markup
leveldb-cli
CLI for LevelDB
Stars: ✭ 86 (+218.52%)
Mutual labels:  formatting
Density Converter
A multi platform image density converting tool converting single or batches of images to Android, iOS, Windows or CSS specific formats and density versions given the source scale factor or width/height in dp. It has a graphical and command line interface and supports many image types (svg, psd, 9-patch, etc.) aswell as some lossless compressors like pngcrush.
Stars: ✭ 222 (+722.22%)
Mutual labels:  converter
Dataset Serialize
JSON to DataSet and DataSet to JSON converter for Delphi and Lazarus (FPC)
Stars: ✭ 213 (+688.89%)
Mutual labels:  converter
Nn Transfer
Convert trained PyTorch models to Keras, and the other way around
Stars: ✭ 205 (+659.26%)
Mutual labels:  converter
java-xml-to-json
👾 convert XML to a structure-preserving JSON representation
Stars: ✭ 15 (-44.44%)
Mutual labels:  converter
objectify-css
CLI for converting CSS rules to JavaScript style objects
Stars: ✭ 46 (+70.37%)
Mutual labels:  converter
BatchEncoder
BatchEncoder is an audio files conversion software.
Stars: ✭ 145 (+437.04%)
Mutual labels:  converter
Retrofit Logansquare
A Converter implementation using LoganSquare JSON serialization for Retrofit 2.
Stars: ✭ 224 (+729.63%)
Mutual labels:  converter
cpc
Text calculator with support for units and conversion
Stars: ✭ 89 (+229.63%)
Mutual labels:  converter
Jpsxdec
jPSXdec: cross-platform PlayStation 1 audio and video converter
Stars: ✭ 219 (+711.11%)
Mutual labels:  converter
guepard
flash to html5 converter, as3 to javascript translator
Stars: ✭ 58 (+114.81%)
Mutual labels:  converter
Htmr
Simple and lightweight (< 2kB) HTML string to React element conversion library
Stars: ✭ 214 (+692.59%)
Mutual labels:  converter
rentry
Markdown pastebin from command line
Stars: ✭ 252 (+833.33%)
Mutual labels:  markup
mdconv
A tool to convert markdown to html.
Stars: ✭ 38 (+40.74%)
Mutual labels:  converter
Mpv Webm
Simple WebM maker for mpv, with no external dependencies.
Stars: ✭ 234 (+766.67%)
Mutual labels:  converter
Bigbash
A converter that generates a bash one-liner from an SQL Select query (no DB necessary)
Stars: ✭ 230 (+751.85%)
Mutual labels:  converter

slackdown

A simple Slack message text formatting to HTML code converter.

Build Status PyPI version Coverage Status

Installation

pip install slackdown

Basic usage

Import the library.

import slackdown

Convert a Slack message to HTML using the render function.

>>> slackdown.render('*bold*')
'<p><b>bold</b></p>'
>>> slackdown.render('_italics_')
'<p><i>italics</i></p>'

All inline elements will be rendered inside <p> tags unless they are already wrapped in another block element like <pre>,<blockquote>,<ul>, or <ol> tags.

Features

slackdown includes multiple features of Slack messages including all the one's highlighted in Slack's message formatting documentation.

Emphasis

  • Text surrounded by _underscores_ will be rendered inside <i> tags.
  • Text surrounded by *asterisks* will be rendered inside <b> tags.

Strikethrough

  • Text surrounded by ~tildes~ will be rendered inside <s> tags.

Lists

  • Lines of text that begin with a bullet(), hyphen(-), or digit followed by a period(1.) will be rendered inside <li> tags.
  • Bulleted and hyphened lists are rendered inside <ul> tags.
  • Numbered lists are rendered inside <ol> tags.
    • Note that the numbers used in the original text will be ignored and they will instead be rendered using your CSS list style.
  • To include multiple lists add an extra line break between them. This line break will not be rendered in the final HTML.
- item 1
- item 2
- item 3

1. item 1
2. item 2
3. item 3

is rendered as

<ul>
   <li>item 1</li>
   <li>item 2</li>
   <li>item 3</li>
</ul>
<ol>
   <li>item 1</li>
   <li>item 2</li>
   <li>item 3</li>
</ol>

Blockquotes

  • Lines of text that start with a &gt;s are rendered inside <blockquote> tags.
  • Text blocks that include a line starting with three &gt;s will render the message from that point on inside <blockquote> tags. Note: the Slack API returns all > as &gt; because angle brackets are used for links in Slack text formatting See the documentation for more.
> A blockquote line
>>> Multiple lines
of a
blockquote

is rendered as

<blockquote>A blockquote line</blockquote>
<blockquote>
    Multiple lines </br>
    of a </br>
    blockquote
</blockquote>

Code Blocks

  • Text surrounded in `backticks` will be rendered inside <code> tags.
  • Text surrounded by ```three backticks``` will be rendered inside <pre> tags.

Hyperlinks

  • Text surrounded by < angle brackets > will be rendered inside <a> tags with target="blank" and their contents as the href.

Line Breaks

  • Line breaks rendered inside <p> tags will close the tag and start a new paragraph. Line breaks in other block elements will be rendered as <br /> tags.
Multiple
lines of
paragraph text

` ` `
Multiple
lines of
pre text
` ` `

is rendered as

<p>Multiple</p>
<p>lines of</p>
<p>paragraph text</p>
<p></p>
<pre>
Multiple <br />
lines of <br />
pre text
</pre>

Spaces

  • Since extra whitespace is stripped in HTML, any extra space is rendered using &nbsp. Every two space characters are rendered as a space character and a &nbsp. This minimizes added characters while keeping the same amount of rendered whitespace as the original text.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].