Sha256: 7f7c5979c562d1608a972886de8e53d3e1f6af2243e687de825c44091b70c1c4
Contents?: true
Size: 563 Bytes
Versions: 14
Compression:
Stored size: 563 Bytes
Contents
# encoding: utf-8 require "ace/filters" require "nokogiri" require "albino" module Ace class PygmentsFilter < Filter def call(item, content) doc = Nokogiri::HTML(content) doc.css("pre[lang]").each do |pre| unless pre['lang'].nil? || pre['lang'].empty? # Set $VERBOSE to nil if you don't want to see this message. warn "~ Syntax highlight in '#{item.original_path}' using '#{pre['lang']}' lexer." pre.replace Albino.colorize(pre.content, pre['lang']) end end doc.to_s end end end
Version data entries
14 entries across 14 versions & 1 rubygems