Method: Slack::BlockKit::Formatting#escape

Defined in:
lib/slack/block_kit/formatting.rb

#escape(text) ⇒ Object

Escape special characters (<,>,&) with their HTML entity code so Slack’s text parsers knows to interpret them as literals.

See: api.slack.com/reference/surfaces/formatting#escaping



116
117
118
119
120
121
# File 'lib/slack/block_kit/formatting.rb', line 116

def escape(text)
  text
    .gsub('&', '&amp;')
    .gsub('>', '&gt;')
    .gsub('<', '&lt;')
end