module Lookbook class CodeFormatter < Rouge::Formatters::HTML def initialize(opts = {}) @opts = opts end def stream(tokens, &block) token_lines(tokens).each_with_index do |line_tokens, i| yield "
" yield "
#{i}
" if @opts[:line_numbers] yield "
" line_tokens.each do |token, value| yield span(token, value) end yield "
" yield "
" end end end end