Class: Nanoc::Toolbox::Filters::HtmlTidy

Inherits:
Filter
  • Object
show all
Defined in:
lib/nanoc/toolbox/filters/html_tidy.rb

Overview

NANOC Filter for html output tidy

Author:

Instance Method Summary collapse

Instance Method Details

#run(content, params = {}) ⇒ String

Tidy the HTML output Runs the content through Nokogiry document parser, and request the html output, which is tidied by default.

Parameters:

  • content (String)

    The content to filter

  • params (String) (defaults to: {})

    This method takes no options.

Returns:

  • (String)

    The filtered content


16
17
18
19
# File 'lib/nanoc/toolbox/filters/html_tidy.rb', line 16

def run(content, params = {})
  require 'nokogiri'
  Nokogiri::HTML::Document.parse(content).to_html
end