Add render context to markdown renderer

This commit is contained in:
Riyad Preukschas 2012-07-24 01:45:08 +02:00
parent 058b71edf3
commit e1b4e22e5c
2 changed files with 11 additions and 1 deletions

View file

@ -1,4 +1,14 @@
class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
attr_reader :template
alias_method :h, :template
def initialize(template, options = {})
@template = template
@project = @template.instance_variable_get("@project")
super options
end
def block_code(code, language)
if Pygments::Lexer.find(language)
Pygments.highlight(code, :lexer => language, :options => {:encoding => 'utf-8'})