pub struct HtmlConfig<'a> { /* private fields */ }
Expand description
A struct representing some properties to control the pretty_html
generation.
The insert_tag
, delete_tag
and equality_tag
represents the html
tag to wrap the part of the text being inserted, deleted or equality.
E.g. if insert_tag
is set to span
, the text to be inserted will be wrapped around with <span>some text to insert</span>
.
insert_tag
defaults to the ins
tag, delete_tag
defaults to the del
tag and equality_tag
defaults to span
.
nltobr
switch enables or disables replacing of \n
in the text with a <br>
element. Defaults to true
insert_class
, delete_class
or equality_class
if set will be added as a class="your css class"
. Defaults to None
insert_style
, delete_style
and equality_style
would add css style property to the output.
E.g. if insert_style: Some("background: yellow; color: purple")
is set the
insert
part of the pretty html would look like <ins style="background: yellow; color: purple">insert text</ins>
Implementations§
Source§impl<'a> HtmlConfig<'a>
impl<'a> HtmlConfig<'a>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new instance of the struct with some defaults.
insert_tag
defaults to “ins”.
delete_tag
defaults to “del”
equality_tag
defaults to “span”
nltobr
defaults to true
Other fields defaults to None
Sourcepub fn set_insert_tag(&mut self, tag: &'a str)
pub fn set_insert_tag(&mut self, tag: &'a str)
Set the HTML tag to be used for text inserted
Sourcepub fn set_delete_tag(&mut self, tag: &'a str)
pub fn set_delete_tag(&mut self, tag: &'a str)
Set the HTML tag to be used for text deleted
Sourcepub fn set_equality_tag(&mut self, tag: &'a str)
pub fn set_equality_tag(&mut self, tag: &'a str)
Set the HTML tag to be used for text that has not changed
Sourcepub fn set_nl_to_br(&mut self, nltobr: bool)
pub fn set_nl_to_br(&mut self, nltobr: bool)
Switch to control if \nl
should be replaced with <br>
Sourcepub fn set_insert_class(&mut self, class: Option<&'a str>)
pub fn set_insert_class(&mut self, class: Option<&'a str>)
Set the css class for the text inserted
Sourcepub fn set_delete_class(&mut self, class: Option<&'a str>)
pub fn set_delete_class(&mut self, class: Option<&'a str>)
Set the delete class for text deleted
Sourcepub fn set_equality_class(&mut self, class: Option<&'a str>)
pub fn set_equality_class(&mut self, class: Option<&'a str>)
Set the css class for text that has not changed
Sourcepub fn set_insert_style(&mut self, style: Option<&'a str>)
pub fn set_insert_style(&mut self, style: Option<&'a str>)
Set the css style property for text inserted
Sourcepub fn set_delete_style(&mut self, style: Option<&'a str>)
pub fn set_delete_style(&mut self, style: Option<&'a str>)
Set the css style property for text deleted
Sourcepub fn set_equality_style(&mut self, style: Option<&'a str>)
pub fn set_equality_style(&mut self, style: Option<&'a str>)
Set the css style for text that has not changed