Class: Redmine::WikiFormatting::Markdown::HTML
- Inherits:
-
Redcarpet::Render::HTML
- Object
- Redcarpet::Render::HTML
- Redmine::WikiFormatting::Markdown::HTML
- Includes:
- ActionView::Helpers::TagHelper, Helpers::URL
- Defined in:
- lib/redmine/wiki_formatting/markdown/formatter.rb
Instance Method Summary collapse
- #block_code(code, language) ⇒ Object
- #image(link, title, alt_text) ⇒ Object
- #link(link, title, content) ⇒ Object
Methods included from Helpers::URL
Instance Method Details
#block_code(code, language) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/redmine/wiki_formatting/markdown/formatter.rb', line 39 def block_code(code, language) if language.present? && Redmine::SyntaxHighlighting.language_supported?(language) "<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
49 50 51 52 53 |
# File 'lib/redmine/wiki_formatting/markdown/formatter.rb', line 49 def image(link, title, alt_text) return unless uri_with_safe_scheme?(link) tag('img', :src => link, :alt => alt_text || "", :title => title) end |
#link(link, title, content) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/redmine/wiki_formatting/markdown/formatter.rb', line 29 def link(link, title, content) return nil unless uri_with_safe_scheme?(link) css = nil unless link && link.starts_with?('/') css = 'external' end content_tag('a', content.to_s.html_safe, :href => link, :title => title, :class => css) end |