I've written in a textarea:
```ruby
puts 'hello word!'
```
I won't get:
<pre lang='ruby'><code>puts hello word!</code></pre>
Instead I got:
<code>puts hello word!</code>
I tried different attributes. My helper:
def markdown(text)
renderer = Redcarpet::Render::HTML.new(
hard_wrap: true,
fenced_code_block: true,
no_intra_emphasis: true,
filter_html: true
)
markdown =
Redcarpet::Markdown.new(
renderer,
fenced_code_block: true,
no_intra_emphasis: true,
fenced_code: true,
gh_blockcode: true,
autolink: true,
hard_wrap: true,
filter_html: true
)
markdown.render(text).html_safe
end
Why? How can I detect code language?
The option you want is
fenced_code_blocks
, with ans
. You also seem to be mixing renderer and extension options. Try this: