# @clearfeed-ai/slack-to-html 中文文档

规范地址：https://npmcn.com/package/%40clearfeed-ai/slack-to-html/

版本：1\.2\.8
npm 元数据更新时间：2026-10-21T04:21:53.858Z
中文译文更新时间：2026-11-10T00:51:27.336Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40clearfeed-ai/slack-to-html
原文对照：https://npmcn.com/package/%40clearfeed-ai/slack-to-html/?lang=original
项目主页：https://github.com/clearfeed/slack-to-html#readme
源码仓库：https://github.com/clearfeed/slack-to-html

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：2.7 MB，25 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：1 个
- 首次发布：2022-01-12T05:38:11.178Z
- 最新版本发布：2026-10-21T04:21:52.151Z
- 近 30 天下载量：3088（2026-10-10 至 2026-11-08，npm 官方下载统计）
- 已发布版本数：27（近 12 个月 10 个）

## 中文简介

显示为 HTML 的下行标记

## 安装

```sh
npm install @clearfeed-ai/slack-to-html
```

也可以使用：`pnpm add @clearfeed-ai/slack-to-html`、`yarn add @clearfeed-ai/slack-to-html`、`bun add @clearfeed-ai/slack-to-html`

## README

# 锁定到 HTML

原产地 [https://github.com/swiftype/slack-hawk-下行 (中文(简体) )](https://github.com/swiftype/slack-hawk-down) 打开 [https://github.com/hectorbenitez/slack-to-html 页面存档备份,存于互联网档案馆](https://github.com/hectorbenitez/slack-to-html)

黑标记到 HTML

## 安装

```
npm install --save slack-to-html
```

## 使用量

### 作为 HTML 的通用Slack 标记

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

escapeForSlack(':wave:') // => '&#1168;'
escapeForSlackWithMarkdown('`this is a code block`) // => '<span class="slack_code">this is a code block</span>'
```

你可以查看其余的减分样式 [这里](https://get.slack.help/hc/en-us/articles/202288908-Format-your-messages)

### 用用户名替换 Slack 用户ID

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

您可以通过请求获取您的 Slack 团队中的用户列表 [此终点](https://api.slack.com/methods/users.list) 带有 `users:read` 范围

### 以频道名称替换 Slack 频道ID

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

您可以通过请求获取您的 Slack 团队中的用户列表 [此终点](https://api.slack.com/methods/channels.list) 带有 `channels:read` 范围

### 替换自定义的slack emojis

```
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" />'
```

您可以通过请求获取您的 Slack 团队自定义的 emoji 列表 [此终点](https://api.slack.com/methods/emoji.list) 带有 `emoji:read` 范围

### 替换子小组名称(用于支付账户)

```
escapeForSlack('<!subteam^S123>', { usergroups: { 'S123': 'swiftype-eng', ...} }) // => 'swiftype-eng'
```

您可以通过请求获取您的 Slack 团队的用户组列表 [此终点](https://api.slack.com/methods/usergroups.list) 带有 `usergroups:read` 范围

## 测试

```
npm test
```

## 即将

-   标记下元素的自定义元素和类名

## 捐款

请打开拉出请求或问题

## 许可证

麻省理工学院

## 常见问题

### @clearfeed-ai/slack-to-html 是什么？

显示为 HTML 的下行标记

### 如何安装 @clearfeed-ai/slack-to-html？

在项目目录运行 npm install @clearfeed-ai/slack-to-html，或使用 pnpm add / yarn add / bun add。

### @clearfeed-ai/slack-to-html 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/clearfeed-ai\_\_slack-to-html 是否存在。

### @clearfeed-ai/slack-to-html 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @clearfeed-ai/slack-to-html 可以商用吗？

@clearfeed-ai/slack-to-html 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @clearfeed-ai/slack-to-html 的下载量有多少？

根据 npm 官方下载统计，@clearfeed-ai/slack-to-html 在 2026/10/10 – 2026/11/08 这 30 天内被下载 3,088 次，日均约 103 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @clearfeed-ai/slack-to-html 还在维护吗？

最新版本 1\.2\.8 发布于 2026/10/21（19 天前）；至今共发布 27 个版本，其中过去 12 个月发布了 10 个；首次发布于 2022/01/12。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

