slackline/mrkdwn

Build text in Slack’s mrkdwn format, as described in https://docs.slack.dev/messaging/formatting-message-text.

mrkdwn.user("U123") <> " shipped " <> mrkdwn.link("https://example.com", "the thing")
// "<@U123> shipped <https://example.com|the thing>"

Values

pub fn bold(text: String) -> String

*bold*

pub fn channel(id: String) -> String

Links a channel: <#C123>.

pub const channel_mention: String

<!channel>: notifies every member of a channel.

pub fn code(text: String) -> String

`inline code`

pub fn code_block(text: String) -> String

A multi-line code block.

pub fn date(
  timestamp timestamp: Int,
  format format: String,
  link link: option.Option(String),
  fallback fallback: String,
) -> String

Formats a unix timestamp in each reader’s own timezone: <!date^timestamp^format^link|fallback>. format may use the tokens {date_num}, {date}, {date_short}, {date_long}, {date_pretty}, {date_short_pretty}, {date_long_pretty}, {time}, {time_secs} and {ago}.

pub fn email(address: String, text: String) -> String

An email link: <mailto:address|text>.

pub fn emoji(name: String) -> String

An emoji by name, without colons: emoji("tada") is :tada:.

pub fn escape(text: String) -> String

Escapes the three control characters (&, <, >) so user supplied text cannot inject mentions or links.

pub const everyone: String

<!everyone>: notifies every non-guest member of the workspace.

pub const here: String

<!here>: notifies the active members of a channel.

pub fn italic(text: String) -> String

_italic_

pub fn link(url: String, text: String) -> String

A link with custom text: <url|text>.

pub fn quote(text: String) -> String

Quotes every line of text.

pub fn strike(text: String) -> String

~strikethrough~

pub fn unescape(text: String) -> String

Reverses escape, for text read back from Slack.

pub fn url(url: String) -> String

A bare link: <url>.

pub fn user(id: String) -> String

Mentions a user: <@U123>.

pub fn usergroup(id: String) -> String

Mentions a user group: <!subteam^S123>.

✨ Search Document