Class: Crosstest::Psychic::CodeHelper::MarkdownHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/crosstest/psychic/code_helper.rb

Class Method Summary collapse

Class Method Details

.code_block(source, language) ⇒ Object


35
36
37
38
39
40
41
42
43
# File 'lib/crosstest/psychic/code_helper.rb', line 35

def self.code_block(source, language)
  buffer = StringIO.new
  buffer.puts # I've seen lots of rendering issues without a dividing newline
  buffer.puts "```#{language}"
  buffer.puts source
  buffer.puts '```'
  buffer.puts # Put a dividing newline after as well, to be safe...
  buffer.string
end