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_copy_buttons: bool§javascript_tooltips: bool§link_handler: fn(_: &str) -> String§parse_metadata: bool§xml: bool

Implementations§

source§

impl RenderOption

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
source

pub fn set_header_anchor(&mut self, header_anchor: bool) -> &mut Self

give id attributes to header tags

source

pub fn set_class_prefix(&mut self, class_prefix: String) -> &mut Self

It prefixes all the html classes.

source

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.

source

pub fn parse_metadata(&mut self, parse_metadata: bool) -> &mut Self

source

pub fn embed_js_for_collapsible_tables(&mut self, javascript: bool) -> &mut Self

It embeds javascript for collapsible tables in a <script>.

source

pub fn embed_js_for_copy_buttons(&mut self, javascript: bool) -> &mut Self

It embeds javascript for copy buttons of fenced code blocks in a <script>.

source

pub fn embed_js_for_tooltips(&mut self, javascript: bool) -> &mut Self

It embeds javascript for tooltips in a <script>.

source

pub fn embed_js_all(&mut self, javascript: bool) -> &mut Self

source

pub fn set_footnote_tooltip(&mut self, footnote_tooltip: bool) -> &mut Self

Shows a tooltip message when hovering over a footnote ref.

it’s used internally by the engine

Trait Implementations§

source§

impl Clone for RenderOption

source§

fn clone(&self) -> RenderOption

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for RenderOption

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.