JSPM

html-to-mrkdwn-ts

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2637
  • Score
    100M100P100Q115274F
  • License MIT

Fast HTML to Slack flavored mrkdwn

Package Exports

  • html-to-mrkdwn-ts
  • html-to-mrkdwn-ts/lib/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (html-to-mrkdwn-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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