# File lib/nanoc/filters/colorize_syntax.rb, line 248 def simon_highlight(code, language, params={}) require 'systemu' check_availability('highlight', '--version') # Build command cmd = [ 'highlight', '--syntax', language, '--fragment' ] params.each do |key, value| if SIMON_HIGHLIGHT_OPT_MAP[key] cmd << SIMON_HIGHLIGHT_OPT_MAP[key] else # TODO allow passing other options case key when :style cmd << '--style' << params[:style] end end end # Run command stdout = StringIO.new systemu cmd, 'stdin' => code, 'stdout' => stdout # Get result stdout.rewind stdout.read end