rubys / nokogumbo

A Nokogiri interface to the Gumbo HTML5 parser.
Apache License 2.0
186 stars 114 forks source link

Change layout and API of Nokogumbo to match Nokogiri #90

Closed stevecheckoway closed 6 years ago

stevecheckoway commented 6 years ago

This changes the top-level API to more closely match Nokogiri's while maintaining backwards compatibility. The new APIs are

In all cases, html can be a string or an IO object (something that responds to #read). The url parameter is entirely for error reporting, as in Nokogiri. The encoding parameter only signals what encoding html should have on input; the output Document or DocumentFragment will be in UTF-8. Currently, the only options supported is :max_errors which controls the maximum number of reported by #errors.

The goal is to eventually implement proper serialization and XML namespaces on foreign elements.