[−][src]Function latex2mathml::replace
pub fn replace(input: &str) -> Result<String, LatexError>
Find LaTeX equations and replace them to MathML.
- inline-math: `
- display-math:
$$..$$
.
Note that dollar signs that do not enclose a LaTeX equation (e.g. This apple is $3.
) must not appear
in the input string. For HTML, please use $
instead of $
.
let input = r#"$E = m c^2$ is the most famous equation derived by Einstein. In fact, this relation is a spacial case of the equation $$E = \sqrt{ m^2 c^4 + p^2 c^2 } ,$$ which describes the relation between energy and momentum."#; let output = latex2mathml::replace(input).unwrap(); println!("{}", output);
examples/document.rs
gives a sample code using this function.