6
Syntax Highlighting Revised의 RailsCast 에피소드를 따라 가고 있습니다. 그래서 같이 내 ApplicationHelper 업데이트 :Rails & Redcarpet : 초기화되지 않은 상수 Redcarpet :: ApplicationHelper에서 사용하면 렌더링
require 'redcarpet'
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,
lax_html_blocks: true,
strikethrough: true,
superscript: true
}
Redcarpet::Markdown.new(renderer, options).render(text).html_safe
end
end
하지만, 내 웹 응용 프로그램은
Routing Error
uninitialized constant Redcarpet::Render
Try running rake routes for more information on available routes.
을 반환 나는 레일 3.2.11을 사용하고 있는데 Redcarpet 레일 콘솔에 잘 반응한다. 나는 원래 require 'redcarpet'
을 포함하지 않았지만 here에 대한 지침을 따라 갔지만 도움이되지 않았습니다.
지금까지 서버를 다시 시작해야 할 수도 있습니다. 이것은 나를위한 경우입니다. – callum
나는 그것을 몇 번 시도했지만 도움이되지 않았지만 나는 미래의 이상함을 염두에두고 조언 할 것이다. :) – sunnyrjuneja