Skip to main content

Crate quarb_html

Crate quarb_html 

Source
Expand description

HTML adapter for Quarb.

Maps an HTML document onto the arbor model, parsing with html5ever (via scraper) so malformed markup is handled per the HTML5 standard.

  • Elements are the nodes; text and comment nodes are not navigated (text is exposed as a projection instead).
  • A node’s name is its tag (html, body, div, h1, a), so /html/body//p navigates by element type. The document root is unnamed; the <html> element is its single child.
  • A node’s traits are structural classes: <block> or <inline>, plus <heading> for h1h6 and <link> for an anchor with an href.
  • Attributes are properties: ::href, ::class, ::id. The default projection (::) and ::text are the element’s text content; ;;;tag, ;;;id, ;;;classes, and any ;;;attr expose metadata.
  • An anchor’s fragment href resolves: ::href~> follows #section to the element with id="section".

Structs§

HtmlAdapter
A Quarb adapter over a parsed HTML document.