Sha256: 96924eb363886fe1c995258411c91ceed015b1fe12c329af70f4fedad1069dc9
Contents?: true
Size: 698 Bytes
Versions: 10
Compression:
Stored size: 698 Bytes
Contents
require 'rouge' module Jazzy # This module helps highlight code module Highlighter class Formatter < Rouge::Formatters::HTML def initialize(language) @language = language super() end def stream(tokens, &b) yield "<pre class=\"highlight #{@language}\"><code>" super yield "</code></pre>\n" end end # What Rouge calls the language def self.default_language if Config.instance.objc_mode 'objective_c' else 'swift' end end def self.highlight(source, language = default_language) source && Rouge.highlight(source, language, Formatter.new(language)) end end end
Version data entries
10 entries across 10 versions & 1 rubygems