Class: Redmine::WikiFormatting::Markdown::HTML

Inherits:
Redcarpet::Render::HTML
  • Object
show all
Includes:
ActionView::Helpers::TagHelper, Helpers::URL
Defined in:
lib/redmine/wiki_formatting/markdown/formatter.rb

Instance Method Summary collapse

Methods included from Helpers::URL

#uri_with_safe_scheme?

Instance Method Details

#block_code(code, language) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/redmine/wiki_formatting/markdown/formatter.rb', line 37

def block_code(code, language)
  if language.present?
    "<pre><code class=\"#{CGI.escapeHTML language} syntaxhl\">" +
      Redmine::SyntaxHighlighting.highlight_by_language(code, language) +
      "</code></pre>"
  else
    "<pre>" + CGI.escapeHTML(code) + "</pre>"
  end
end

#image(link, title, alt_text) ⇒ Object



47
48
49
50
51
# File 'lib/redmine/wiki_formatting/markdown/formatter.rb', line 47

def image(link, title, alt_text)
  return unless uri_with_safe_scheme?(link)

  tag('img', :src => link, :alt => alt_text || "", :title => title)
end


27
28
29
30
31
32
33
34
35
# File 'lib/redmine/wiki_formatting/markdown/formatter.rb', line 27

def link(link, title, content)
  return nil unless uri_with_safe_scheme?(link)

  css = nil
  unless link && link.starts_with?('/')
    css = 'external'
  end
  ('a', content.to_s.html_safe, :href => link, :title => title, :class => css)
end