dimanche 2 août 2015

Redcarpet gem not working properly? - Rails 4

i have installed and setup Redcarpet gem for markdown with CodeRay gem for syntax highlighting.

My problem is that the

``` ruby

```

which in markdown would provide a code block,its loaded but not styled properly,actually there is no style on the pre tags.

here is the code in my 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

then all i do is this

in other words this styling that stackoverflows does when pressing ctrl+K is not there in my case.

Aucun commentaire:

Enregistrer un commentaire