Struct mdxt::RenderOption
source · [−]pub struct RenderOption {
pub link_handler: fn(_: &str) -> String,
pub header_anchor: bool,
pub parse_metadata: bool,
pub javascript: bool,
pub class_prefix: String,
}Fields
link_handler: fn(_: &str) -> Stringwhen 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
header_anchor: boolgive id attributes to header tags
parse_metadata: booljavascript: boolJavascript is required to render collapsible tables and math formulas. If this option is true, the engine will add javascript codes when needed. If you want to use your own script, turn this option off.
class_prefix: StringIt prefixes all the html classes.
Implementations
sourceimpl RenderOption
impl RenderOption
pub fn set_link_handler(
&mut self,
link_handler: fn(_: &str) -> String
) -> &mut Self
pub fn set_header_anchor(&mut self, header_anchor: bool) -> &mut Self
pub fn set_class_prefix(&mut self, class_prefix: String) -> &mut Self
pub fn enable_metadata(&mut self, parse_metadata: bool) -> &mut Self
pub fn enable_javascript(&mut self, javascript: bool) -> &mut Self
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 more
Auto 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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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