Struct katex::OptsBuilder[][src]

pub struct OptsBuilder { /* fields omitted */ }

Builder for Opts.

Implementations

impl OptsBuilder[src]

pub fn display_mode<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self[src]

Whether to render the math in the display mode.

pub fn output_type<VALUE: Into<OutputType>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

KaTeX output type.

pub fn leqno<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self[src]

Whether to have \tags rendered on the left instead of the right.

pub fn fleqn<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self[src]

Whether to make display math flush left.

pub fn throw_on_error<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self[src]

Whether to let KaTeX throw a ParseError for invalid LaTeX.

pub fn error_color<VALUE: Into<String>>(&mut self, value: VALUE) -> &mut Self[src]

Color used for invalid LaTeX.

pub fn macros<VALUE: Into<HashMap<String, String>>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

Collection of custom macros. Read https://katex.org/docs/options.html for more information.

pub fn min_rule_thickness<VALUE: Into<f64>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

Specifies a minimum thickness, in ems. Read https://katex.org/docs/options.html for more information.

pub fn max_size<VALUE: Into<Option<f64>>>(&mut self, value: VALUE) -> &mut Self[src]

Max size for user-specified sizes. If set to None, users can make elements and spaces arbitrarily large. Read https://katex.org/docs/options.html for more information.

pub fn max_expand<VALUE: Into<Option<i32>>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

Limit the number of macro expansions to the specified number. If set to None, the macro expander will try to fully expand as in LaTeX. Read https://katex.org/docs/options.html for more information.

pub fn trust<VALUE: Into<bool>>(&mut self, value: VALUE) -> &mut Self[src]

Whether to trust users' input. Cannot be assigned at the same time with OptsBuilder::trust_callback. Read https://katex.org/docs/options.html for more information.

pub fn trust_callback<VALUE: Into<TrustCallback>>(
    &mut self,
    value: VALUE
) -> &mut Self
[src]

A callback function to determine whether to trust users' input. Cannot be assigned at the same time with OptsBuilder::trust. Read https://katex.org/docs/options.html for more information.

Examples

let opts = katex::Opts::builder()
    .trust_callback(|ctx: katex::TrustContext| -> bool {
        ctx.command == r#"\url"#
    })
    .build()
    .unwrap();

pub fn build(&self) -> Result<Opts, String>[src]

Builds a new Opts.

Errors

If a required field has not been initialized.

impl OptsBuilder[src]

pub fn add_macro(mut self: Self, entry_name: String, entry_data: String) -> Self[src]

Add an entry to macros.

Examples

let opts = katex::Opts::builder()
    .add_macro(r#"\RR"#.to_owned(), r#"\mathbb{R}"#.to_owned())
    .build()
    .unwrap();
let html = katex::render_with_opts(r#"\RR"#, &opts).unwrap();

Trait Implementations

impl Clone for OptsBuilder[src]

impl Default for OptsBuilder[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.