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") @options = options.dup super options end # If project has issue number 39, apostrophe will be linked in # regular text to the issue as Redcarpet will convert apostrophe to # #39; # We replace apostrophe with right single quote before Redcarpet # does the processing and put the apostrophe back in postprocessing. # This only influences regular text, code blocks are untouched. def normal_text(text) return text unless text.present? text.gsub("'", "’") end def block_code(code, language) # New lines are placed to fix an rendering issue # with code wrapped inside
#{h.send(:html_escape, code)}