0.5.0 • Published 4 months ago

mathml2omml v0.5.0

Weekly downloads
-
License
LGPL-3.0-or-later
Repository
github
Last release
4 months ago

mathml2omml

Convert MathML to the OOML format used in DOCX files without XSLT.

Usage

You can use it like this:

import {mml2omml} from "mathml2omml"

const mml = '<math xmlns="http://www.w3.org/1998/Math/MathML">
  <semantics>
    <mrow>
      <mn>2</mn>
      <mo>+</mo>
      <mn>2</mn>
      <mo>=</mo>
      <mn>4</mn>
    </mrow>
  </semantics>
</math>'

const omml = mml2omml(mml)

console.log(omml)

> <m:oMath xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">
>    <m:r>
>        <m:t xml:space="preserve">2+2=4</m:t>
>    </m:r>
> </m:oMath>

TypeScript Support

This library includes TypeScript definitions:

import { mml2omml } from "mathml2omml";

// Simple usage
const omml = mml2omml(mathmlString);

// With options
const omml = mml2omml(mathmlString, { disableDecode: true });

// Using the class directly
import { MML2OMML } from "mathml2omml";
const converter = new MML2OMML(mathmlString);
converter.run();
const result = converter.getResult();

License

LGPL v.3.0 or later.

The xml parser/stringifier in the parse-stringify-folder is based upon html-parse-stringify (MIT).

License of test files depends on source of files.

Some test fixtures fall under other licenses/copyrights. See the LICENSE and copyright.txt files in the different test fixture folders.

Remaining test fixtures fall under the same license and copyright as the source code.

0.5.0

4 months ago

0.3.0

3 years ago

0.3.2

3 years ago

0.4.0

3 years ago

0.3.1

3 years ago

0.3.3

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago