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 🙏

© 2025 – Pkg Stats / Ryan Hefner

md-to-slack

v1.0.0

Published

Converts Markdown to Slack-compatible text

Downloads

274

Readme

Markdown to Slack

Converts Markdown to Slack-compatible text.

All Contributors

Features

✨ Usage

npm i md-to-slack

You can then use markdownToSlack() to convert Markdown to Slack-compatible text:

import { markdownToSlack } from "md-to-slack";

const slackText = markdownToSlack("Hello **world**!");

So text like:

Hello **World**! How are you _today_?

Gets transformed into the proper syntax for rendering it on Slack:

Hello *World*! How are you _today_?

☑️ Supported syntax

All of the basic Markdown syntax is supported and translated into Slack-compatible mrkdwn syntax.

A few remarks though:

  • Headings (#, ##, etc.) are not supported by mrkdwn, so they are stripped out
  • Same with images
  • GitHub Flavored Markdown checkboxes are converted into an equivalent emoji (☐ or ☒)

🔭 Next features

  1. Support Markdown extended syntax (e.g. tables)
  2. Generate Slack BlockKit-compatible objects, as an opt-in parameter

We want to support the extended syntax, in particular things like tables and GitHub Flavored Markdown niceties.

mrkdwn syntax has limited capabilities, so we intend to do a "best possble conversion" like we do for checkboxes.

But the real deal will be to add the option for generating a Slack BlockKit-compatible output to render rich elements, such as images, checkboxes, tables, and other HTML elements in Slack.

🦺 Security consideration

md-to-slack doesn't sanitize your text, it only converts the syntax.

If your Markdown input was generated from an external source, consider sanitizing it before sending it to Slack to avoid cross-site scripting XSS attacks.

🤹 Alternatives

As of February 2025, the most popular solution to do a similar job is mack. But it has pitfalls:

  1. It only converts the output to Slack BlockKit block objects, it doesn't handle simple mrkdwn
  2. Types are out-of-date with the latest Slack API, so you can't use it in TypeScript with SDK like bolt
  3. CI is not passing and the code has not been changed since 2022

md-to-slack was built to provide a simple, up-to-date alternative that converts a Markdown input into a Slack-compatible one (mrkdwn).

🧑‍💻 Development

The project uses Node.js and pnpm. These are versioned in .tool-versions for easy setup via asdf.

git clone https://github.com/nicoespeon/md-to-slack
cd md-to-slack
pnpm install

This repository includes a list of suggested VS Code extensions. It's a good idea to use VS Code and accept its suggestion to install them, as they'll help with development.

Pre-requisites

To run the project, you'll need:

The exact versions are listed in .tool-versions. To use them automatically, you can use asdf and run asdf install.

Building

Run tsup locally to build source files from src/ into output files in dist/:

pnpm build

Add --watch to run the builder in a watch mode that continuously cleans and recreates dist/ as you save files:

pnpm build --watch

Formatting

Prettier is used to format code. It should be applied automatically when you save files in VS Code or make a Git commit.

To manually reformat all files, you can run:

pnpm format --write

Linting

ESLint is used with with typescript-eslint) to lint JavaScript and TypeScript source files. You can run it locally on the command-line:

pnpm run lint

ESLint can be run with --fix to auto-fix some lint rule complaints:

pnpm run lint --fix

Note that you'll need to run pnpm build before pnpm lint so that lint rules which check the file system can pick up on any built files.

Type Checking

You should be able to see suggestions from TypeScript in your editor for all open files.

However, it can be useful to run the TypeScript command-line (tsc) to type check all files in src/:

pnpm tsc

Add --watch to keep the type checker running in a watch mode that updates the display as you save files:

pnpm tsc --watch

Testing

Vitest is used for tests. You can run it locally on the command-line:

pnpm test

It will run in watch mode by default and re-run tests when it detects changes to the file system.

Deployment

The project uses release-please to automatically create new releases and update the CHANGELOG.

To make this work, we need to follow the Conventional Commits specification.

The most important prefixes you should have in mind are:

  • fix: which represents bug fixes, and correlates to a SemVer patch.
  • feat: which represents a new feature, and correlates to a SemVer minor.
  • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.

It's fine if you don't follow the convention yourself for the commits. If you open a pull request, only its title matters. That's what will be used to create the merge commit for release-please to pick up.

Contributors