Slack 是一种流行的团队消息传递和协作应用程序,支持 Markdown 语法的子集。界面的不同部分提供不同级别的 Markdown 支持。

消息

Slack 的消息界面是人们使用最多的界面。虽然明显缺乏对许多元素的支持,但提供了对一些基本语法的支持。

2019 年 11 月,Slack 推出了一个新的所见即所得的界面,如下所示。默认情况下,为所有用户启用此功能。最明显的变化是在界面控件中添加了格式按钮,但还有一个实时编辑器,可以在您键入后隐藏 Markdown 格式。您不必使用界面控件来格式化文本 — 您仍然可以使用下一节中描述的 Markdown 语法元素。

Slack markdown in the message interface

您可以在 Preferences > Advanced 中禁用所见即所得的界面。选择 Format messages with markup 设置,如下所示。启用此设置将隐藏所见即所得的格式按钮并禁用实时编辑器,以便您可以在键入时看到 Markdown 格式。

提示:如果你在 Slack 中打开了多个工作区,则需要为每个工作区启用此设置。

Enable Markdown in the Slack message interface

消息中的 Slack Markdown 支持

Slack 消息接口支持以下 Markdown 元素。

Element Support Notes
Headings No
Paragraphs No
Line Breaks No The Markdown syntax is not supported, but you can press the Shift and Return keys to go to the next line.
Bold No The Markdown syntax is not supported, but you can add bold styling with single asterisks, which is the standard Markdown syntax for italic. Very confusing!
Italic Partial Only underscores are supported.
Blockquotes Yes
Ordered Lists Partial Standard Markdown syntax is *only* supported if WYSIWIG editor is disabled.
Unordered Lists Partial Standard Markdown syntax is *only* supported if WYSIWIG editor is disabled. Only supports dash and asterisk for unordered list.
Code Partial Code blocks are not supported.
Horizontal Rules No
Links Partial Standard Markdown syntax is *only* supported if WYSIWIG editor is disabled.
Images No The Markdown syntax is not supported, but you can drag and drop images to share them.
Tables No
Fenced Code Blocks Yes
Syntax Highlighting No
Footnotes No
Heading IDs No
Definition Lists No
Strikethrough Partial Use only one tilde symbol before and after the phrase.
Task Lists No Is interpreted as an unordered list
Emoji (copy and paste) Yes
Emoji (shortcodes) Yes
Highlight No
Subscript No
Superscript No
Automatic URL Linking Yes
Disabling Automatic URL Linking Yes
HTML No
提示:此信息与 Slack 用户界面中的消息界面相关。用于消息的 Slack API 支持 Slack 用户界面中不支持的其他语法元素。有关更多信息,请参阅 Slack 的 API 文档

职位

Slack 帖子界面是一个编辑器,允许您创建用于在 Slack 中共享的文档。这是一个实时编辑器,这意味着您将在键入 Markdown 格式文本后立即看到实际格式。例如,如果键入 ,下划线将消失,并且您将看到斜体字 “test” 一词。_test_

要创建帖子,请单击快捷方式图标,然后选择 Create a Post,如下所示。

post 界面中的 Slack markdown

帖子中的 Slack Markdown 支持

Slack post 接口为以下 Markdown 元素提供支持。

Element Support Notes
Headings Partial Only heading levels one and two are supported. Only number signs are supported.
Paragraphs Yes
Line Breaks No
Bold No The Markdown syntax is not supported, but you can add bold styling with single asterisks, which is the standard Markdown syntax for italic. Very confusing!
Italic Partial Only underscores are supported.
Blockquotes Yes
Ordered Lists Yes
Unordered Lists Yes
Code Yes
Horizontal Rules No
Links No
Images No
Tables No
Fenced Code Blocks Yes
Syntax Highlighting No
Footnotes No
Heading IDs No
Definition Lists No
Strikethrough Partial Use only one tilde symbol before and after the phrase.
Task Lists No
Emoji (copy and paste) Yes
Emoji (shortcodes) Yes
Highlight No
Subscript No
Superscript No
Automatic URL Linking Yes
Disabling Automatic URL Linking Yes
HTML No

另请参阅

将您的 Markdown 技能提升到一个新的水平。

在 60 页中学习 Markdown。《Markdown 指南》专为新手和专家设计,是一本全面的参考书,包含您入门和掌握 Markdown 语法所需的一切。

获取书籍