instance method escape_markdown_text

Ruby on Rails edge

Since edge

Signature

escape_markdown_text(text)

Backslash-escapes CommonMark metacharacters in text so they are treated as literal characters by Markdown renderers.

MarkdownConversion.escape_markdown_text("**Important**")
# => "\\*\\*Important\\*\\*"

Parameters

text req
Source
# File actiontext/lib/action_text/markdown_conversion.rb, line 92
    def escape_markdown_text(text)
      text.gsub(MARKDOWN_METACHARACTERS) { |c| "\\#{c}" }
    end

Defined in actiontext/lib/action_text/markdown_conversion.rb line 92 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionText::MarkdownConversion

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close