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

@jczimm/slack-to-markdown

v1.1.2

Published

Convert Slack's clipboard format to Slack-compatible Markdown

Downloads

417

Readme

slack-to-markdown

Convert Slack's clipboard format to Slack-compatible Markdown.

What it does

When you copy formatted text from Slack, it stores the content in the slack/texty clipboard format. This library converts that content to Markdown that can be pasted into other applications (or back into Slack) and render correctly.

Usage

import { slackToMarkdown } from "@jczimm/slack-to-markdown";

// Pass the raw clipboard string - it handles parsing
const markdown = slackToMarkdown(clipboardData);

// Falls back to original string if not valid Slack format
slackToMarkdown("plain text") // => "plain text"

Browser clipboard example

document.addEventListener("paste", (e) => {
  const slackData = e.clipboardData?.getData("slack/texty");
  if (slackData) {
    e.preventDefault();
    const markdown = slackToMarkdown(slackData);
    // Insert markdown at cursor, or do whatever you want with it
  }
});

CLI

Reads Slack's clipboard format on stdin, writes Markdown to stdout. Input that isn't valid Slack clipboard data is passed through unchanged.

npx @jczimm/slack-to-markdown < clip.json

# installed globally
npm install -g @jczimm/slack-to-markdown
slack-to-markdown < clip.json

slack-paste (macOS)

The package also installs slack-paste, which reads Slack's clipboard format off the macOS pasteboard so you can pipe it straight in:

slack-paste | slack-to-markdown

Without a global install, hand npx a shell so both commands resolve from a single package install:

npx -p @jczimm/slack-to-markdown sh -c 'slack-paste | slack-to-markdown'

The pipe has to stay inside the quotes — outside them, your own shell takes it and pipes into a slack-to-markdown that isn't on PATH.

Copy the message, don't select the text. Open the message's overflow menu (the button) and press ⌘C. Slack writes the slack/texty delta this tool reads only for a whole-message copy; drag-selecting the text and copying seems to come out as slack/html instead, which this tool doesn't handle.

pbpaste can't be used here — it only reads the plain-text, RTF and PostScript flavors, so it hands you the flattened text with the formatting already gone. Slack's clipboard data lives in a custom flavor, which Chromium-based apps (both the desktop app and Slack in a browser) pack into an org.chromium.web-custom-data pasteboard blob. slack-paste reads that via osascript and unpacks it.

It defaults to the slack/texty flavor. If a copy didn't produce that flavor, pass one explicitly or see what's actually on the clipboard:

slack-paste --list
slack-paste slack/html

Running tests

Requires Node.js 22+:

npm test