Robust-skills slack-mrkdwn
Proactively apply when generating any Slack text content, chat.postMessage text fields, or text objects with type "mrkdwn". Triggers on mrkdwn, Slack formatting, Slack markdown, Slack bold, Slack italic, Slack link syntax, Slack mentions, Slack date formatting, Slack escaping, Slack text object, verbatim, plain_text, Slack mrkdwn vs markdown, Slack blockquote, Slack code block, Slack strikethrough, Slack user mention, Slack channel mention, Slack emoji, link_names, auto-parsing. Use when formatting Slack message text, writing mrkdwn strings, constructing text objects, escaping user content for Slack, adding mentions or date formatting to messages, or debugging text rendering issues. Slack mrkdwn text formatting syntax for messages, text objects, and attachments.
git clone https://github.com/ccheney/robust-skills
T=$(mktemp -d) && git clone --depth=1 https://github.com/ccheney/robust-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/slack-mrkdwn" ~/.claude/skills/ccheney-robust-skills-slack-mrkdwn && rm -rf "$T"
skills/slack-mrkdwn/SKILL.mdSlack mrkdwn
Slack's custom text formatting syntax for messages and text objects. Not standard Markdown.
CRITICAL: Two Markup Systems
Slack has two completely different markup syntaxes. Using the wrong one is the most common formatting mistake.
| System | Used In | Bold | Link | Heading |
|---|---|---|---|---|
| Slack mrkdwn | field, text objects (), section fields | | | Not supported |
| Standard Markdown | block only | | | |
Standard Markdown syntax (
**bold**, [text](url), # Heading) renders as literal text in mrkdwn contexts. Slack mrkdwn syntax (*bold*, <url|text>) renders as literal text in markdown blocks. Never mix them.
The
markdown block (type: "markdown") accepts standard Markdown and translates it for Slack rendering. Supports: headings, bold, italic, strikethrough, lists, links, blockquotes, code blocks, images (rendered as link text). Does not support: syntax-highlighted code blocks, horizontal rules, tables, task lists. A single input block may produce multiple output blocks. Cumulative limit across all markdown blocks in one payload: 12,000 characters.
mrkdwn Syntax
| Format | Syntax | Notes |
|---|---|---|
| Bold | | Not |
| Italic | | Not |
| Strikethrough | | Not |
| Inline code | | Same as standard Markdown |
| Code block | | No syntax highlighting |
| Blockquote | | Prefix each line |
| Link | | Not |
| Emoji | | Standard or custom. Direct Unicode also works |
| Newline | | Literal newline in string |
| Ordered list | | Plain text, no special rendering |
| Bullet list | | Rendered properly in blocks only |
Inline code disables all other formatting within it — use it to display literal text like
*not bold*.
Nested Formatting
Combining adjacent format markers without spaces (e.g.,
*bold*_italic_) is unreliable and may not render correctly. Always add a space between differently-formatted segments:
*bold* _italic_ ← works reliably *bold*_italic_ ← may fail to render
For reliable combined formatting on a single word, use
rich_text blocks with explicit style objects ({"bold": true, "italic": true}).
Links
<https://example.com> Auto-detected URL <https://example.com|Display Text> URL with custom text <mailto:user@example.com|Email Link> Email link
URLs posted in text are auto-linked by Slack. Use
<url|text> for custom display text. Spaces in URLs will break parsing — remove them. mrkdwn formatting inside link labels (e.g., <url|*bold*>) works for basic styles.
Link Unfurling
Slack previews ("unfurls") linked content. Control this per message:
| Parameter | Controls | Default (API) |
|---|---|---|
| Text-based content previews | |
| Media (images, video, audio) previews | |
Set both to
false to suppress all previews. These are chat.postMessage parameters, not mrkdwn syntax.
Mentions and References
User Mentions
<@U0123ABC456>
Triggers a notification for the mentioned user. Auto-converts to display name.
Channel References
<#C0123ABC456>
Auto-converts to channel name. Users without access see "private channel".
User Group Mentions
<!subteam^SAZ94GDB8>
Notifies all members of the user group.
Special Mentions
| Syntax | Scope | Caution |
|---|---|---|
| Active members in channel | Use sparingly |
| All channel members | Triggers push notifications for everyone |
| All non-guest workspace members | Very disruptive |
Best Practice
Always use IDs, not names. IDs are stable; names change:
<@U0123ABC456> (user ID) @chris (name — may not resolve) <#C0123ABC456> (channel ID) #general (name — may not resolve)
To enable name-based parsing, set
link_names: 1 in the API call. This is fragile and discouraged.
Date Formatting
Displays dates/times localized to the reader's device timezone (not their Slack preference timezone).
Syntax
<!date^{unix_timestamp}^{token_string}^{optional_link}|{fallback_text}>
Tokens
| Token | Example Output |
|---|---|
| 2014-02-18 |
| February 18th, 2014 (omits year if within ~6 months) |
| Feb 18, 2014 |
| Tuesday, February 18th, 2014 |
| Yesterday / February 18th, 2014 |
| Yesterday / Feb 18, 2014 |
| Yesterday / Tuesday, February 18th, 2014 |
| 6:39 AM (12h) or 06:39 (24h) |
| 6:39:42 AM |
| 3 minutes ago / 4 hours ago |
_pretty variants use relative terms ("yesterday", "today", "tomorrow") when applicable.
Examples
<!date^1392734382^{date} at {time}|February 18th, 2014 at 6:39 AM PST> <!date^1392734382^{date_short_pretty} {time}|Feb 18, 2014 6:39 AM> <!date^1392734382^{ago}|February 18th, 2014>
Tokens can be mixed with literal text in the token string. The optional link (third
^-separated parameter) makes the date a clickable hyperlink. Fallback text (after |) displays for clients that cannot render date formatting.
Escaping
Only three characters require escaping in mrkdwn:
| Character | Escape Sequence |
|---|---|
| |
| |
| |
Do NOT encode other characters as HTML entities. Only these three are control characters in Slack's markup system.
When displaying user-generated content that may contain these characters, always escape them to prevent unintended formatting or link injection.
Text Object
The text object is the most common composition object in Block Kit. It determines how text is rendered.
{ "type": "mrkdwn", "text": "*bold* and _italic_", "verbatim": false } { "type": "plain_text", "text": "No formatting", "emoji": true }
mrkdwn supports Slack mrkdwn syntax. plain_text renders literally. emoji: true converts :emoji: to rendered emoji (plain_text only). Min 1 char, max 3000 chars (section fields max 2000 chars each, max 10 fields).
Where Each Type Is Allowed
| Context | Allowed Types |
|---|---|
| Header block text | only |
| Section text / fields | or |
| Context elements | or |
| Button text | only |
| Placeholder | only |
| Input label / hint | only |
| Modal title / submit / close | only |
| Option text | only |
| Option description | or |
Verbatim Behavior
When
verbatim: false (default):
- URLs auto-convert to clickable links
- Channel names auto-convert to channel links
- Mentions auto-parse
When
verbatim: true:
- Markdown formatting still processes
- No auto-linking or mention parsing
- Useful for displaying raw URLs or text containing
or@
that aren't mentions#
{ "type": "mrkdwn", "text": "Check the log at http://example.com/debug", "verbatim": true }
Auto-Parsing Behavior
The parse
Parameter (chat.postMessage)
parse| Value | Effect |
|---|---|
(default) | mrkdwn formatting enabled; minimal auto-parsing of names/URLs |
| Disables mrkdwn formatting; auto-parses URLs, channel names, user mentions |
Disabling Auto-Parsing
In text objects: Set
verbatim: true (see above).
In message payloads:
- Omit
argument (or set tolink_names
)0 - Set
to disable all auto-parsingparse: "none"
Disabling Formatting Entirely
| Context | Method |
|---|---|
| Text objects | Set to |
Top-level message | Set |
| Attachments | Exclude field from array |
Anti-Patterns
| Anti-Pattern | Problem | Fix |
|---|---|---|
in mrkdwn | Renders literally | Use |
in mrkdwn | Renders literally | Use |
in mrkdwn | Renders as plain text | Use block or block |
in markdown block | Renders as italic | Use |
for mentions | Fragile — names change, IDs don't | Use directly |
HTML-encoding beyond | Renders literally | Only escape , , |
| Spaces in URLs | Breaks link parsing | URL-encode spaces as |
Combining without space | Rendering unreliable | Add space: |
Secondary Attachments (Legacy)
The
attachments array adds secondary content below the main message. One of fallback or text is required (unless using blocks).
| Field | Description |
|---|---|
| Plain-text summary for limited clients (always plain text) |
| Hex color or / / |
| Text above the attachment block |
, , | Small author line (16px icon) |
, | Large heading with optional hyperlink |
| Main body (auto-collapses at 700+ chars) |
| Array of objects |
| Full-width image (GIF, JPEG, PNG, BMP) |
| Thumbnail (75px max) |
, , | Footer metadata (footer max 300 chars) |
| Array of fields to format with mrkdwn: , , |
Only
"text", "pretext", and "fields" are accepted values in mrkdwn_in. Fields not listed render as plain text. fallback is always plain text.
Prefer Block Kit blocks over attachments for new development.
Reference Documentation
| File | Purpose |
|---|---|
| references/CHEATSHEET.md | Quick reference: mrkdwn syntax, mentions, dates, escaping at a glance |
Sources
- Formatting Message Text — Slack
- Block Kit Composition Objects — Text Object — Slack
- Markdown Block — Slack
- Legacy Secondary Message Attachments — Slack
- Messaging Overview — Slack