Module: Jekyll::PrettyPrint

Defined in:
lib/starter_web/_plugins/prettify.rb

Instance Method Summary collapse

Instance Method Details

#pretty_print(input) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/starter_web/_plugins/prettify.rb', line 34

def pretty_print(input)
  # 1st_stage cleanup
  content = Nokogiri::HTML input
  parsed_content = content.to_html
  # 2nd_stage cleanup
  pretty = HtmlBeautifier.beautify(parsed_content)
  pretty = pretty.sub('\s*<!DOCTYPE html>.*','<!DOCTYPE html>')
end