[][src]Function latex2mathml::convert_html

pub fn convert_html<P: AsRef<Path>>(path: P) -> Result<(), Box<dyn Error>>

Convert all LaTeX expressions for all HTMLs in a given directory.

The argument of this function can be a file name or a directory name. For the latter case, all HTML files in the directory is coneverted. If conversion is failed for a file, then this function does not change the file. The extension of HTML files must be ".html", and .htm files are ignored.

Note that this function uses latex2mathml::replace, so the dollar signs are not allowed except for ones enclosing a LaTeX expression.

Examples

This function is meant to replace all LaTeX equations in HTML files generated by cargo doc.

use latex2mathml::convert_html;
 
convert_html("./target/doc").unwrap();

Then all LaTeX equations in HTML files under the directory ./target/doc will be converted into MathML.