Sha256: 91a61dbc289e1915ffa5d7d64519698f07253eb8a6f4b5058fd6d4afdb256875
Contents?: true
Size: 602 Bytes
Versions: 9
Compression:
Stored size: 602 Bytes
Contents
require 'redcarpet' require 'rouge' require 'rouge/plugins/redcarpet' module Exposition module MarkdownHelper # Create a Redcarpet Renderer with Rouge code formatting. # See: https://github.com/jneen/rouge#you-can-even-use-it-with-redcarpet class HTMLwithHighlighting < Redcarpet::Render::HTML include Rouge::Plugins::Redcarpet end def markdown_to_html(markdown) @renderer ||= Redcarpet::Markdown.new(HTMLwithHighlighting, extensions = {fenced_code_blocks: true}) @renderer.render(markdown).html_safe end end end
Version data entries
9 entries across 9 versions & 1 rubygems