Mack: Markdown to Slack Message Blocks
Convert Markdown and GitHub Flavoured Markdown to Slack BlockKit Blocks

Mack is a Markdown parser to convert any Markdown content to Slack BlockKit block objects. It
uses unified to create a Markdown AST, then converts the AST into Slack
objects.
Text is truncated to fit within the Slack API's limits.
Supported Markdown Elements
- All inline elements (italics, bold, strikethrough, inline code, hyperlinks)
- Lists (ordered, unordered, checkboxes)
- All headers
- Code blocks
- Block quotes (with some limitations)
- Images
- Thematic Breaks / Dividers
- Tables (alignment not preserved)
Not Yet Supported Markdown Elements
- Block quotes (limited functionality; does not support lists, headings, or images within the block quote)
Installation
npm install @instantish/mack
Usage
import {markdownToBlocks} from '@instantish/mack';
const blocks = markdownToBlocks(`
# Hello world
* bulleted item 1
* bulleted item 2
abc _123_

`);
The blocks
object now results in this payload.
API
function markdownToBlocks(text: string, options: ParsingOptions): KnownBlock[]
text
: the content to parseoptions
: the options to use when parsing.
Parsing Options
interface ParsingOptions {
lists?: ListOptions;
}
interface ListOptions {
checkboxPrefix?: (checked: boolean) => string;
}