module CodeRay
def encode_tokens tokens, format, options = {}
puts CodeRay.encode_tokens(tokens, :span)
tokens = CodeRay.scan '1 + 2', :ruby
# Highlight a short Ruby code example in a HTML span
require 'coderay'
Use this together with CodeRay.scan:
Encode pre-scanned Tokens.
def encode_tokens tokens, format, options = {} encoder(format, options).encode_tokens tokens, options end