【发布时间】:2015-08-02 18:22:22
【问题描述】:
我已经使用 CodeRay gem 安装并设置 Redcarpet gem 用于 Markdown 以进行语法突出显示。
我的问题是
```红宝石
```
在markdown中会提供一个代码块,它已加载但样式不正确,实际上pre标签上没有样式。
这是我的 application_helper.rb
中的代码 class CodeRayify < Redcarpet::Render::HTML
def block_code(code, language)
CodeRay.scan(code, language).div(:line_numbers => :table)
end
end
def markdown(text)
coderayified = CodeRayify.new(:filter_html => true, :hard_wrap => true)
options = {
fenced_code_blocks: true,
no_intra_emphasis: true,
autolink: true,
strikethrough: true,
lax_spacing: true,
superscript: true
}
markdown_to_html = Redcarpet::Markdown.new(coderayified,options)
markdown_to_html.render(text).html_safe
end
那么我要做的就是这个
换句话说,在我的情况下,stackoverflows 在按 ctrl+K 时所做的样式不存在。
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 ruby-on-rails-4 rubygems