Struct mdxt::RenderOption
source · pub struct RenderOption {
pub class_prefix: String,
pub enable_youtube: bool,
pub footnote_tooltip: bool,
pub header_anchor: bool,
pub javascript_collapsible_tables: bool,
pub javascript_copy_buttons: bool,
pub javascript_tooltips: bool,
pub link_handler: fn(_: &str) -> String,
pub parse_metadata: bool,
pub xml: bool,
}Fields§
§class_prefix: String§enable_youtube: bool§footnote_tooltip: bool§header_anchor: bool§javascript_collapsible_tables: bool§javascript_tooltips: bool§link_handler: fn(_: &str) -> String§parse_metadata: bool§xml: boolImplementations§
source§impl 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 embed_js_for_tooltips(&mut self, javascript: bool) -> &mut Self
pub fn embed_js_for_tooltips(&mut self, javascript: bool) -> &mut Self
It embeds javascript for tooltips in a <script>.
pub fn embed_js_all(&mut self, javascript: bool) -> &mut Self
sourcepub fn set_footnote_tooltip(&mut self, footnote_tooltip: bool) -> &mut Self
pub fn set_footnote_tooltip(&mut self, footnote_tooltip: bool) -> &mut Self
Shows a tooltip message when hovering over a footnote ref.
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§
source§impl Clone for RenderOption
impl Clone for RenderOption
source§fn clone(&self) -> RenderOption
fn clone(&self) -> RenderOption
Returns a copy of the value. Read more
1.0.0 · source§fn 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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more