npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

markdown-to-slack-mrkdwn

v1.1.2

Published

Convert standard Markdown to Slack mrkdwn format. Handles tables, bold/italic, code blocks, links, lists, headings, and more.

Downloads

680

Readme

markdown-to-slack-mrkdwn

Convert standard Markdown to Slack mrkdwn format.

Why?

Slack uses its own markup syntax (mrkdwn) that differs from standard Markdown. This converter handles the tricky edge cases that simpler converters miss:

  • Tables — converted to aligned, preformatted code blocks
  • Bold/italic conflicts**bold** and *italic* coexist without breaking
  • Code blocks — protected from formatting, language specifiers removed
  • Inline code — preserved inside text, stripped inside tables
  • Links & images[text](url) becomes <url|text>
  • Lists- and * become bullet points
  • Headings# Title becomes *Title* (bold)
  • Strikethrough~~text~~ becomes ~text~
  • Horizontal rules--- becomes ———

Zero dependencies. Works with Node.js 18+.

Install

npm install markdown-to-slack-mrkdwn

Usage

As a module (ESM)

import { markdownToSlack } from 'markdown-to-slack-mrkdwn';

const slack = markdownToSlack('# Hello **world**');
// → '*Hello world*'

As a CLI

echo "# Hello **world**" | npx markdown-to-slack-mrkdwn
# → *Hello world*

Or install globally:

npm install -g markdown-to-slack-mrkdwn
echo "**bold** and *italic*" | md-to-slack
# → *bold* and _italic_

Use --split to get a JSON array of chunks safe for Slack's message limit:

cat report.md | md-to-slack --split
# → ["chunk1...", "chunk2...", ...]

TypeScript

Types are included out of the box:

import { markdownToSlack, splitForSlack } from 'markdown-to-slack-mrkdwn';
// markdownToSlack(text: string): string
// splitForSlack(text: string, options?: { maxLength?: number }): string[]

Splitting long messages

Slack truncates messages over ~4000 characters, which can break code blocks mid-table. Use splitForSlack to split the output into safe chunks:

import { markdownToSlack, splitForSlack } from 'markdown-to-slack-mrkdwn';

const mrkdwn = markdownToSlack(longMarkdown);
const messages = splitForSlack(mrkdwn); // default: 3500 chars per chunk

for (const msg of messages) {
  await slack.chat.postMessage({ channel, text: msg });
}

Custom limit:

const messages = splitForSlack(mrkdwn, { maxLength: 2000 });

Code blocks are never split — each chunk has properly paired ``` markers.

Examples

| Markdown | Slack mrkdwn | |----------|-------------| | **bold** | *bold* | | *italic* | _italic_ | | ~~strike~~ | ~strike~ | | [link](url) | <url\|link> | | # Heading | *Heading* | | - item | \u2022 item | | `code` | `code` | | --- | \u2014\u2014\u2014 |

Markdown tables are converted to aligned preformatted blocks:

| Name  | Score |        ```
|-------|-------|  →     Name    Score
| Alice | 95    |        Alice   95
| Bob   | 87    |        Bob     87
                         ```

License

MIT