Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I'm using redcarpet with the HTML renderer and
When I create a code block like so:
Should I be expecting to see syntax highlighting? Or does redcarpet just assign a class equal to whatever language I specified, leaving me to style the class myself?
Redcarpet doesn't come with syntax highlighting out of the box because people have different needs or sometimes don't need it at all. You can easily highlight code with Rouge. Once it's installed, you can do something like:
require 'redcarpet' require 'rouge' require 'rouge/plugins/redcarpet' class CustomRender < Redcarpet::Render::HTML include Rouge::Plugins::Redcarpet end parser = Redcarpet::Markdown.new(CustomRender, fenced_code_blocks: true) parser.render("Your Markdown ...")
And then include a style-sheet provided by Rouge to properly show syntax highlighting on your page.
I hope this answers your question, feel free to ask if something isn't clear ! :-)