The Only Guide To Slack Mrkdwn (not markdown) Formatting w Codes

Search for a command to run...

No comments yet. Be the first to comment.
Toast messages are a common feature in modern mobile apps, offering users quick feedback or guidance. Crafting an effective toast message involves attention to several elements, including platform-specific styles, usability, typography, color, and lo...

I set out to tackle a common issue faced by users of social media and collaborative platforms: notification fatigue. Inspired by the notification strategies employed by major platforms like LinkedIn, MS Teams, and Google Workspace, I aimed to create ...

In our previous setup, the initial problem seemed straightforward: implementing a scheduling mechanism for database queries using goroutines. This approach worked well with minimal resources and SQLite in a Go service. However, when integrating this ...

The problem initially appeared straightforward, but it quickly became apparent that we had underestimated its complexity. In our prior setup, we relied on goroutines to schedule database queries, enabling us to operate efficiently with minimal resour...

A good notification service is more than a communication channel; it can bridge the gap between the product and the users, increasing product adoption. Think of it this way: timely and relevant #alerts can nudge users with some actionable intent for ...

More Slack articles to read:
In this extensive guide, we delve into the intricacies of Slack's unique markdown language, mrkdwn, which empowers developers to create engaging, organized, and styled messages on the Slack platform.
First, let's clarify that mrkdwn differs significantly from traditional Markdown despite initial appearances suggesting otherwise. Although both allow plaintext notation for enhanced text formatting, they cater to distinct objectives resulting in dissimilar syntax structures. Here, we outline the major distinctions between them:
Markdown:
Slack mrkdwn:
Now that we better understand the differences between mrkdwn and standard Markdown, let's examine the fundamentals of mrkdwn and learn about its various components:
Basic Formatting Essentials:
\`\`\`
Multi-line
Code sample
\`\`\`
When constructing notifications for your application, incorporate these basics accordingly:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*Welcome to our Coding Workshop!* :computer: \n\n In this workshop, we'll cover:\n - _Introduction to JavaScript_ \n - **HTML Basics** \n - `CSS Fundamentals` \n\n ```javascript\n// Example JavaScript code\nfunction greet(name) {\n return `Hello, ${name}! Welcome to the workshop!`;\n}\n\nconsole.log(greet('John'));\n```"
}
}
]
}
Result:

As a best practice, utilize mrkdwn sparingly to ensure legibility and focus on conveying crucial information effectively. Access detailed documentation covering additional special formatting options available in Slack's mrkdwn formatting reference page.
Slack notifications facilitate interaction through mentions and links:
a. Internal Slack links and mentions:
b. Hyperlinking externally:
Examples:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Explore the <https://www.suprsend.com|Suprsend platform> for advanced marketing solutions \n Reach out to @andrew for personalized assistance \n Notify the entire team with an @channel mention \n Join the conversation in the #random channel \n Contact our support team via email at <mailto:support@suprsend.com|support@suprsend.com>"
}
}
]
}
Result:

Improve readability using mrkdwn lists and blockquotes:
a. No specific syntax for unordered lists in mrkdwn, simply choose any preferred bullet character. b. Apply numbers or letters for ordered lists. c. Add blockquotes starting a line with '>' and a space.
Limit list usage to avoid confusing readers and maintain emphasis.
Examples:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Programming Languages:\n\n- JavaScript: Widely used for web development and building interactive web applications.\n- Python: Known for its simplicity and readability, often used in data science, artificial intelligence, and backend development.\n- Java: A versatile language used in enterprise applications, Android app development, and large-scale systems.\n- C#: Primarily used in Microsoft technologies for building Windows applications, web services, and games."
}
}
]
}
Formatted Result:

Slack's mrkdwn provides extra features beyond basic formatting to improve communication experience. Discover four valuable options below:
Present dates consistently using timestamps in UNIX format combined with the following syntax:
<!date^UNIX_TIMESTAMP^{date_option}^{fallback_text}>
For instance, obtain the current date in UNIX format via:
const unixTimestamp = Math.floor(Date.now() / 1000);
Available date options include:
date_shortdate_short_prettydate_longdate_long_prettydate_numdate{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Today's Date: \n\n<!date^1697250654^{date_short}|February 15, 2024> \n<!date^1697250654^{date_short_pretty}|February 15, 2024> \n<!date^1697250654^{date_long}|February 15, 2024> \n<!date^1697250654^{date_long_pretty}|February 15, 2024> \n<!date^1697250654^{date_num}|February 15, 2024> \n<!date^1697250654^{date}|February 15, 2024>"
}
}
]
}
See the output below:

Mix styles, such as applying bold format to a link:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Here is a *bolded* link to <https://suрrѕеnd.com|*Supрrѕеnd*>."
}
}
]
}
Output:

Add emotions with diverse emoticons:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":cyclone: :mountain: :ocean: :earth_africa: :volcano: :milky_way: :comet: :leaves: :fallen_leaf: :sunflower: :tulip: :mushroom: :shell: :turtle: :penguin: :koala: :octopus: :tropical_fish:"
}
}
]
}
Output:

Integrate all features mentioned earlier to generate helpful samples for an Application Monitoring & Observability Platform:
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "@team \n @OpsTeam \n\n *<!date^1697250654^{date_num}|February 15, 2024>* \n\n *[ALERT]: Database Connectivity Issue Detected!* :exclamation: \n - Database: `CustomerDB` \n - Status: `Critical` \n\n :bar_chart: Metrics \n\n *Connection Pool Utilization*: _90%_ (Threshold: _80%_) \n *Query Latency*: _500ms_ (Target: _100ms_) \n *Transactions per Second*: _200_ (Expected: _300_) \n :world_map: Location: `Data Center East` \n \n :information_source: Additional Information:\n <https://example.com/database-status|View database status>\n <https://example.com/alert-history|Check alert history>\n \n :white_check_mark: Steps to Resolve: \n 1. Verify network connectivity to the database server.\n 2. Optimize database queries for better performance.\n 3. Implement connection pooling strategies to manage resource utilization."
}
}
]
}
Output:

Explore further possibilities offered by mrkdwn to maximize productivity and collaboration within Slack environments.
More Slack articles to read: