Expand description
Construct and manipulate an HTML element represented using Rust types.
Conceptually, an element has a tag, optional attributes, and optional children. A child can consist of non-HTML text, or be an element of its own.
This crate aims to follow the WhatWG specification at https://html.spec.whatwg.org/.
§Example
use html_page::{Element, Tag};
let e = Element::new(Tag::P)
.with_text("hello ")
.with_child(Element::new(Tag::Strong).with_text("world"));
assert_eq!(e.serialize(), "<P>hello <STRONG>world</STRONG></P>");
assert_eq!(e.plain_text(), "hello world");
Structs§
- An HTML element.
- An HTML document (“page’),consisting of a head and a body element.
- A visitor to extract the text of an element and its children.
Enums§
- The value of an element attribute.
- Represent content in HTML.
- The tag of an HTML5 element.
Traits§
- A read-only visitor for an HTML element.