I followed this Railscast to try to incorporate syntax highlighting and markdown in my Rails app:
http://railscasts.com/episodes/207-syntax-highlighting-revised?view=asciicast
But for some reason, it's only applying formatting to single line snippets. For example, this works:
` `` test ``` (quotes separated to avoid github markup formatting here)
But this does not work
```
test
```
How do I enable multi-line code snippets?
Here is what I have in application.rb:
module ApplicationHelper
class HTMLwithPygments < Redcarpet::Render::HTML
def block_code(code, language)
Pygments.highlight(code, lexer:language)
end
end
def markdown(text)
renderer = HTMLwithPygments.new(hard_wrap: true, filter_html: true)
options = {
autolink: true,
no_intra_emphasis: true,
fenced_code_blocks: true,
strikethrough: true,
superscript: true
}
Redcarpet::Markdown.new(renderer, options).render(text).html_safe
end
end
and my view is simply:
<%= markdown step.description %>
Note: I'm trying to do this all within a CKEditor