Struct mdxt::RenderOption
source · [−]pub struct RenderOption {
pub link_handler: fn(_: &str) -> String,
pub header_anchor: bool,
pub parse_metadata: bool,
pub javascript_collapsible_tables: bool,
pub javascript_copy_buttons: bool,
pub class_prefix: String,
pub xml: bool,
}Fields
link_handler: fn(_: &str) -> Stringheader_anchor: boolparse_metadata: booljavascript_collapsible_tables: boolclass_prefix: Stringxml: boolImplementations
sourceimpl RenderOption
impl RenderOption
sourcepub fn set_link_handler(
&mut self,
link_handler: fn(_: &str) -> String
) -> &mut Self
pub fn set_link_handler(
&mut self,
link_handler: fn(_: &str) -> String
) -> &mut Self
when rendering [Lable](Link) to html, Link goes through this function.
The link first goes through the default handler then the given function.
If you don’t give any function, it’ll only go through the default handler.
The default handler does two things
- reject links with invalid characters
- normalize anchors
- make alphabets lowercase
- replace whitespaces with dashes
sourcepub fn set_header_anchor(&mut self, header_anchor: bool) -> &mut Self
pub fn set_header_anchor(&mut self, header_anchor: bool) -> &mut Self
give id attributes to header tags
sourcepub fn set_class_prefix(&mut self, class_prefix: String) -> &mut Self
pub fn set_class_prefix(&mut self, class_prefix: String) -> &mut Self
It prefixes all the html classes.
sourcepub fn well_formed_xml(&mut self, well_formed_xml: bool) -> &mut Self
pub fn well_formed_xml(&mut self, well_formed_xml: bool) -> &mut Self
If you want the output to be a well-formed xml, turn it on. It’s not a polyglot markup, though.
pub fn parse_metadata(&mut self, parse_metadata: bool) -> &mut Self
sourcepub fn embed_js_for_collapsible_tables(&mut self, javascript: bool) -> &mut Self
pub fn embed_js_for_collapsible_tables(&mut self, javascript: bool) -> &mut Self
It embeds javascript for collapsible tables in a <script>.
It embeds javascript for copy buttons of fenced code blocks in a <script>.
sourcepub fn handle_link(&self, link: &str) -> String
pub fn handle_link(&self, link: &str) -> String
it’s used internally by the engine
Trait Implementations
sourceimpl Clone for RenderOption
impl Clone for RenderOption
sourcefn clone(&self) -> RenderOption
fn clone(&self) -> RenderOption
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations
impl RefUnwindSafe for RenderOption
impl Send for RenderOption
impl Sync for RenderOption
impl Unpin for RenderOption
impl UnwindSafe for RenderOption
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more