module Octopress::Pygments

Constants

DEFAULTS
VERSION

Public Class Methods

clean_markup(input) click to toggle source
# File lib/octopress-pygments.rb, line 36
def self.clean_markup(input)
  OptionsParser.new(input).clean_markup
end
highlight(code, options = {}) click to toggle source
# File lib/octopress-pygments.rb, line 24
def self.highlight(code, options = {})
  Renderer.new(code, options).highlight
end
highlight_failed(error, syntax, markup, code, file = nil) click to toggle source
# File lib/octopress-pygments.rb, line 40
def self.highlight_failed(error, syntax, markup, code, file = nil)
  code_snippet = code.split("\n")[0..9].map{|l| "    #{l}" }.join("\n")
  fail_message  = "\nPygments Error while parsing the following markup#{" in #{file}" if file}:\n\n".red
  fail_message += "    #{markup}\n#{code_snippet}\n"
  fail_message += "#{"    ..." if code.split("\n").size > 10}\n"
  fail_message += "\nValid Syntax:\n\n#{syntax}\n".yellow
  fail_message += "\nPygments Error:\n\n#{error.message}".red
  $stderr.puts fail_message.chomp
  raise ArgumentError
end
parse_markup(input, defaults={}) click to toggle source
# File lib/octopress-pygments.rb, line 32
def self.parse_markup(input, defaults={})
  OptionsParser.new(input).parse_markup(defaults)
end
read_cache(code, options={}) click to toggle source
# File lib/octopress-pygments.rb, line 28
def self.read_cache(code, options={})
  Cache.read_cache(code, options)
end