1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Parsing, filtering, selecting and serializing HTML/XML markup.
//!
//! See the project [../README] for a feature overview.
//!
//! [../README]: https://github.com/dekellum/marked#readme

#![warn(rust_2018_idioms)]

#[macro_use] extern crate html5ever;

/// Initial parse buffer size in which encoding hints are considered, possibly
/// triggering reparse.
pub const INITIAL_BUFFER_SIZE: u32 = 4 * 1024;

/// Subsequent parse buffer size used for reading and parsing, after
/// [`INITIAL_BUFFER_SIZE`].
pub const READ_BUFFER_SIZE: u32 = 16 * 1024;

/// Recommended confidence for an initial default encoding.
///
/// Used as a necessary starting encoding, such as UTF-8 (recommended
/// based on current adoption) or `Windows-1252" (for backward compatibility).
pub const DEFAULT_CONF: f32       = 0.01;

/// Recommended confidence for a hint from an HTTP Content-Type header with
/// charset.
pub const HTTP_CTYPE_CONF: f32    = 0.09;

/// Recommended confidence for the sum of all hints from within an HTML head,
/// in meta elements.
pub const HTML_META_CONF: f32     = 0.20;

/// Recommended confidence for hints based on a leading Byte-Order-Mark (BOM)
/// at the start of a document stream.
pub const BOM_CONF: f32           = 0.31;

mod chars;

mod decode;
pub use decode::{
    Decoder, EncodingHint, SharedEncodingHint,
};

mod dom;
pub use dom::{
    html,
    Document, DocumentType, Element,
    Node, NodeData, NodeId, NodeRef, ProcessingInstruction, Selector,
    Attribute, LocalName, Namespace, QualName, StrTendril,
};

pub use dom::filter;

#[cfg(feature = "xml")]
pub use dom::xml;

#[doc(hideen)]
pub mod logger;