Skip to content

elson/html-mrkdwn-lite

Repository files navigation

html-mrkdwn-lite

A lightweight HTML to Slack mrkdwn converter.

Uses the zero-dependency dom-parser package.

Installation

npm install html-mrkdwn-lite

Usage

import { convert } from 'html-mrkdwn-lite';

const html = `<p><strong>Hello</strong> <a href="https://example.com">world</a>!</p>
<p><img src="https://media.giphy.com/media/5xtDarEbygs3Pu7p3jO/giphy.gif"></p>`

const output = convert(html);
// {
//   text: "*Hello* <https://example.com|world>!",
//   image: "https://media.giphy.com/media/5xtDarEbygs3Pu7p3jO/giphy.gif",
// }

Contributing

Issues and pull requests are welcome!

About

A lightweight HTML to mrkdwn converter

Resources

Stars

Watchers

Forks

Packages

No packages published