3.4.1 • Published 4 years ago

amo-html-to-mrkdwn v3.4.1

Weekly downloads
23
License
ISC
Repository
github
Last release
4 years ago

html-to-mrkdwn Actions Status

Convert HTML to Slack's mrkdwn format.

screenshots

Usage

const mrkdwn = require('amo-html-to-mrkdwn')

const html = `
<p><strong>Hello</strong> <a href="https://example.com">cruel</a> <em>world</em>!</p>

<p><img src="https://media.giphy.com/media/5xtDarEbygs3Pu7p3jO/giphy.gif"></p>
`

mrkdwn(html)
{
  "text": "*Hello* <https://example.com|cruel> _world_!\n\n<https://media.giphy.com/media/5xtDarEbygs3Pu7p3jO/giphy.gif>",
  "image": "https://media.giphy.com/media/5xtDarEbygs3Pu7p3jO/giphy.gif",
}

Parameters

The module exports a function that takes the following parameters:

ParameterTypeDescription
htmlstringRequired HTML string
flavorstringOptional application-specific HTML flavor
optionsobjectOptional flavor options

Flavors

Application-specific HTML flavors are supported by including an optional second argument. Supported flavors include:

github

per GitHub Flavored Markdown

jira

per rendered Jira comments

Options

OptionTypeExampleDescription
jiraBaseUrlstringhttps://subdomain.atlassian.comJira base URL used to generate absolute attachment links
3.4.1

4 years ago

3.4.0

5 years ago

3.3.1

6 years ago

3.3.0

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago