lib/docs/erb_environment.rb in docs-0.0.2 vs lib/docs/erb_environment.rb in docs-0.0.3

- old
+ new

@@ -12,10 +12,14 @@ raise ArgumentError, "Must specify :source or :output as first argument" unless [:source, :output].include?(source_or_output) @examples[source_or_output]["examples/#{name}"] end def pretty_print_json(json) - JSON.pretty_generate(JSON.parse(json)) + begin + JSON.pretty_generate(JSON.parse(json)) + rescue JSON::ParserError => e + e.inspect + end end def syntax_highlight(str, language) CodeRay.scan(str, language).div end