@clearfeed-ai/slack-to-html 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +3 -0
- package/.nvmrc +1 -0
- package/README.md +64 -0
- package/config/emoji_pretty.json +57334 -0
- package/dist/.gitkeep +0 -0
- package/dist/bundle.js +4656 -0
- package/dist/emoji.js +1 -0
- package/dist/index.js +1 -0
- package/package.json +116 -0
- package/printBuiltSlackHawkDownRegExps.js +11 -0
- package/slack_hawk_down.png +0 -0
- package/src/emoji.js +1 -0
- package/src/index.js +507 -0
- package/test/common.js +8 -0
- package/test/controlSequenceTest.js +117 -0
- package/test/datesTest.js +4 -0
- package/test/emojiTest.js +33 -0
- package/test/fixtures/long_negative_input.txt +1 -0
- package/test/fixtures/long_positive_input.txt +100 -0
- package/test/fixtures/long_repetitive_block_quotes.txt +8001 -0
- package/test/markdownTest.js +85 -0
- package/test/mocha.opts +3 -0
- package/test/nullTest.js +9 -0
- package/test/performanceTest.js +44 -0
- package/updateEmoji.js +15 -0
package/.babelrc
ADDED
package/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6.5.0
|
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Slack to HTML
|
|
2
|
+
|
|
3
|
+
Forked originally from https://github.com/swiftype/slack-hawk-down
|
|
4
|
+
|
|
5
|
+
Slack markdown to HTML
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
```
|
|
9
|
+
npm install --save slack-to-html
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
### Render universal Slack markdown as HTML
|
|
15
|
+
```
|
|
16
|
+
import { escapeForSlack, escapeForSlackWithMarkdown } from 'slack-hawk-down'
|
|
17
|
+
|
|
18
|
+
escapeForSlack(':wave:') // => 'Ґ'
|
|
19
|
+
escapeForSlackWithMarkdown('`this is a code block`) // => '<span class="slack_code">this is a code block</span>'
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
You can view the rest of the markdown styles [here](https://get.slack.help/hc/en-us/articles/202288908-Format-your-messages)
|
|
23
|
+
|
|
24
|
+
### Replace Slack user IDs with user names
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
escapeForSlack('<@U123|david> did you see my pull request?', { users: { 'U123': 'david', ... } }) // => '@david did you see my pull request?'
|
|
28
|
+
```
|
|
29
|
+
You can get a list of the users in your Slack team by requesting [this endpoint](https://api.slack.com/methods/users.list) with a `users:read` scope
|
|
30
|
+
|
|
31
|
+
### Replace Slack channel IDs with channel names
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
escapeForSlack('<#C123> please fill out this poll', { channels : { '#C123': 'general', ... } }) // => '#general please fill out this poll'
|
|
35
|
+
```
|
|
36
|
+
You can get a list of the users in your Slack team by requesting [this endpoint](https://api.slack.com/methods/channels.list) with a `channels:read` scope
|
|
37
|
+
|
|
38
|
+
### Replace Custom Slack emojis
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
escapeForSlack(':facepalm:', { customEmoji: { facepalm: 'http://emojis.slackmojis.com/emojis/images/1450319441/51/facepalm.png', ... } }) // => '<img alt="facepalm" src="http://emojis.slackmojis.com/emojis/images/1450319441/51/facepalm.png" />'
|
|
42
|
+
```
|
|
43
|
+
You can get a list of custom emoji for your Slack team by requesting [this endpoint](https://api.slack.com/methods/emoji.list) with a `emoji:read` scope
|
|
44
|
+
|
|
45
|
+
### Replace subteam names (for paid accounts)
|
|
46
|
+
```
|
|
47
|
+
escapeForSlack('<!subteam^S123>', { usergroups: { 'S123': 'swiftype-eng', ...} }) // => 'swiftype-eng'
|
|
48
|
+
```
|
|
49
|
+
You can get a list of user groups for your Slack team by requesting [this endpoint](https://api.slack.com/methods/usergroups.list) with a `usergroups:read` scope
|
|
50
|
+
|
|
51
|
+
## Testing
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
npm test
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Upcoming
|
|
58
|
+
- Customizeable element and class names for markdown elements
|
|
59
|
+
|
|
60
|
+
## Contribution
|
|
61
|
+
Please open a pull request or issue
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
MIT
|