html-to-mrkdwn-ts
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

npm version npm downloads Build Status

html-to-mrkdwn-ts

html-to-mrkdwn-ts is a fast HTML to Slack flavored markdown converter.

Install

<yarn|npm|pnpm> html-to-mrkdwn-ts

Usage

import htmlToMrkdwn from 'html-to-mrkdwn-ts'
const html = `
<div>
  <h1>A Title</h1>
  <a href="https://foo.bar">
    <img src="https://foo.bar/baz.jpg" alt="baz" />
  </a>
</div>`

htmlToMrkdwn(html)

// {
//   image: 'https://foo.bar/baz.jpg',
//   text: '*A Title*\n\n<https://foo.bar|baz>'
// }

Options

under the hood html-to-mrkdwn-ts uses node-html-markdown so you can pass an additional options as a second argument:

htmlToMrkdwn(html, { strongDelimiter: '**' })

see available options

Package Sidebar

Install

npm i html-to-mrkdwn-ts

Weekly Downloads

685

Version

1.1.0

License

MIT

Unpacked Size

14.3 kB

Total Files

13

Last publish

Collaborators

  • oferitz