Ark::Slack::Mrkdwn
Constants
BACKTICK_RE = /`([^`]+)`/
BLANK_LINES_RE = /\n{3,}/
BOLD_RE = /\*\*(.+?)\*\*/
BROADCAST_RE = /<![^>]*>/
Slack control tokens that could trigger mass notifications or impersonate mentions.
CODE_FENCE_RE = /```[\s\S]*?```/
HEADING_RE = Regex.new("^\\\#{1,6}\\s+([^\\n]+)$", Regex::Options::MULTILINE)
ITALIC_RE = /(?<!\*)\*([^*]+)\*(?!\*)/
LINK_RE = /\[([^\]]+)\]\(([^)]+)\)/
LINK_SCHEME_RE = /\A(?:https?:\/\/|mailto:)/i
MENTION_CAPTURE_RE = /<@(\w+)>/
STRIKE_RE = /~~(.+?)~~/
USER_MENTION_RE = /<@[^>]*>/
Class methods
Converts common markdown to Slack mrkdwn format, preserving code blocks. Neutralizes Slack control tokens to prevent mention/broadcast injection.
Replaces <@USERID> mentions with @Name using the provided resolver.
Escapes Slack control tokens that could trigger notifications or impersonate users.
Splits text at paragraph boundaries if it exceeds max_len.