pub struct HtmlOptions { /* private fields */ }Expand description
Markup options for to_html.
use smooth_reading::{HtmlOptions, Options, to_html};
let html = HtmlOptions::new()
.tag("span")
.class_name("sr-fixation")
.rest_tag("span")
.rest_class_name("sr-rest");
assert_eq!(
to_html("Smooth", &Options::new(), &html),
r#"<span class="sr-fixation">Smo</span><span class="sr-rest">oth</span>"#
);Implementations§
Source§impl HtmlOptions
impl HtmlOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
The defaults: <b> around the fixation, no class, no rest element,
existing markup preserved, DEFAULT_SKIP_TAGS skipped.
Sourcepub fn tag(self, tag: impl Into<String>) -> Self
pub fn tag(self, tag: impl Into<String>) -> Self
The element wrapped around each fixation. Default b.
Sourcepub fn class_name(self, class_name: impl Into<String>) -> Self
pub fn class_name(self, class_name: impl Into<String>) -> Self
A class attribute for the fixation element. Default none.
Sourcepub fn rest_tag(self, rest_tag: impl Into<String>) -> Self
pub fn rest_tag(self, rest_tag: impl Into<String>) -> Self
An element wrapped around the rest of each emphasised word. Default none (the rest is plain text).
Sourcepub fn rest_class_name(self, rest_class_name: impl Into<String>) -> Self
pub fn rest_class_name(self, rest_class_name: impl Into<String>) -> Self
A class attribute for the rest element. Default none.
Whether the input is HTML whose markup must pass through untouched
(true, the default) or plain text whose <, > and & are escaped
(false).
Elements whose content is left untouched (compared case-insensitively).
Replaces DEFAULT_SKIP_TAGS.
Sourcepub fn get_class_name(&self) -> Option<&str>
pub fn get_class_name(&self) -> Option<&str>
The fixation element’s class, if any.
Sourcepub fn get_rest_tag(&self) -> Option<&str>
pub fn get_rest_tag(&self) -> Option<&str>
The rest element name, if any.
Sourcepub fn get_rest_class_name(&self) -> Option<&str>
pub fn get_rest_class_name(&self) -> Option<&str>
The rest element’s class, if any.
Whether existing markup passes through untouched.
The elements whose content is left untouched.