Code Syntax Highlighting with coderay

477 Views Asked by At

enter image description here

hey, i am using Coderay and Redcarpet for Syntax highlighting and parsing markup.

Pls. suggest a way to get rid of the indicated leading spaces in the div (Ref Image)

class CodeRayify < Redcarpet::Render::HTML
 def block_code(code, language)
  CodeRay.scan(code, language).div
 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,
 :superscript => true,
 :strikethrough => true,
 :no_styles => true
 }   
 markdown_to_html = Redcarpet::Markdown.new(coderayified, options)
 markdown_to_html.render(text).html_safe
end 
0

There are 0 best solutions below