lib/polytrix/documentation/helpers/code_helper.rb in polytrix-0.1.0.pre vs lib/polytrix/documentation/helpers/code_helper.rb in polytrix-0.1.0

- old
+ new

@@ -16,22 +16,24 @@ end end class MarkdownHelper 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 end def initialize(*args) @segmenter = Polytrix::Documentation::CodeSegmenter.new super end def source - File.read source_file + File.read absolute_source_file end def code_block(source_code, language, opts = { format: :markdown }) case opts[:format] when :rst