Class: Bk::AnnotationFormatter::Markdown
- Inherits:
-
Object
- Object
- Bk::AnnotationFormatter::Markdown
- Defined in:
- lib/bk/annotation_formatter/markdown.rb
Constant Summary
Constants included from Format
Format::HORIZONTAL_PIPE, Format::VERTICAL_PIPE
Instance Method Summary collapse
Methods included from Format
#annotation_colors, #build_colors, #build_header, #is_tty?, #job_colors, #pastel, #vertical_pipe
Methods included from Color
#colorize, #create_color_hash, #default_color, #error_color, #info_color, #success_color, #warning_color
Instance Method Details
#call(annotation) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/bk/annotation_formatter/markdown.rb', line 37 def call(annotation) io = StringIO.new style = annotation.style color = annotation_colors[style] context = annotation.context io.puts " #{color.call("#{vertical_pipe}#{context}")}" io.puts " #{color.call(vertical_pipe)}" output = TTY::Markdown.parse(annotation.body.text) output = CGI.unescape_html(output) output.each_line do |line| io.puts " #{color.call(vertical_pipe)} #{line}" end io.string end |