blob: 44170626553a6005ec88ff7bb916b9a8208a4765 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# frozen_string_literal: true
module CommandTag::Commands::TextTools
def handle_code_at_start(args)
name = args.count > 1 ? args[0] : 'code'
value = args.last.presence || ''
@vars[name] = case @status.content_type
when 'text/markdown'
["```\n#{value}\n```"]
when 'text/html'
["<pre><code>#{html_encode(value).gsub("\n", '<br/>')}</code></pre>"]
else
["----------\n#{value}\n----------"]
end
end
end
|