New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@instantish/mack

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instantish/mack

Converts Markdown to Slack BlockKit Blocks

  • 1.2.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
949
decreased by-36.52%
Maintainers
2
Weekly downloads
 
Created
Source

Mack: Markdown to Slack Message Blocks

Convert Markdown and GitHub Flavoured Markdown to Slack BlockKit Blocks

Node.js CI Code Style: Google

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_

![cat](https://images.unsplash.com/photo-1574158622682-e40e69881006)
`);

The blocks object now results in this payload.

API

function markdownToBlocks(text: string, options: ParsingOptions): KnownBlock[]

  • text: the content to parse
  • options: the options to use when parsing.

Parsing Options

interface ParsingOptions {
  // Configure how lists are displayed
  lists?: ListOptions;
}

interface ListOptions {
  // Configure how checkbox list items are displayed. By default, they are prefixed with '* '
  checkboxPrefix?: (checked: boolean) => string;
}

Keywords

FAQs

Package last updated on 29 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc