slack 发送html,slack-hawk-down

Render Slack flavored markdown as HTML

slack_hawk_down.png Slack Hawk Down

The current up-to-date repo for Slack-flavored markdown as HTML

Installation

npm install --save slack-hawk-down

Usage

Render universal Slack markdown as HTML

import { escapeForSlack, escapeForSlackWithMarkdown } from 'slack-hawk-down'

escapeForSlack(':wave:') // => 'Ґ'

escapeForSlackWithMarkdown('`this is a code block`) // => 'this is a code block'

You can view the rest of the markdown styles here

Replace Slack user IDs with user names

escapeForSlack(' did you see my pull request?', { users: { 'U123': 'david', ... } }) // => '@david did you see my pull request?'

You can get a list of the users in your Slack team by requesting this endpoint with a users:read scope

Replace Slack channel IDs with channel names

escapeForSlack(' please fill out this poll', { channels : { '#C123': 'general', ... } }) // => '#general please fill out this poll'

You can get a list of the users in your Slack team by requesting this endpoint with a channels:read scope

Replace Custom Slack emojis

escapeForSlack(':facepalm:', { customEmoji: { facepalm: 'http://emojis.slackmojis.com/emojis/images/1450319441/51/facepalm.png', ... } }) // => 'facepalm'

You can get a list of custom emoji for your Slack team by requesting this endpoint with a emoji:read scope

Replace subteam names (for paid accounts)

escapeForSlack('', { usergroups: { 'S123': 'swiftype-eng', ...} }) // => 'swiftype-eng'

You can get a list of user groups for your Slack team by requesting this endpoint with a usergroups:read scope

Testing

yarn test

Upcoming

Customizeable element and class names for markdown elements

Contribution

Please open a pull request or issue

License

MIT

HomePage

Repository

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值