Struct katex::opts::OptsBuilder

source ·
pub struct OptsBuilder { /* private fields */ }
Expand description

Builder for Opts.

Implementations§

source§

impl OptsBuilder

source

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

Whether to render the math in the display mode.

source

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

KaTeX output type.

source

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

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

source

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

Whether to make display math flush left.

source

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

Whether to let KaTeX throw a ParseError for invalid LaTeX.

source

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

Color used for invalid LaTeX.

source

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

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

source

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

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

source

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

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.

source

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

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.

source

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

Whether to trust users’ input. Read https://katex.org/docs/options.html for more information.

source

pub fn build(&self) -> Result<Opts, OptsBuilderError>

Builds a new Opts.

Errors

If a required field has not been initialized.

source§

impl OptsBuilder

source

pub fn add_macro(self, entry_name: String, entry_data: String) -> Self

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§

source§

impl Clone for OptsBuilder

source§

fn clone(&self) -> OptsBuilder

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 OptsBuilder

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,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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.
const: unstable · 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.
const: unstable · source§

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

Performs the conversion.