Code Monkey home page Code Monkey logo

omml2mathml's Introduction

omml2mathml

This is no longer maintained, use @scienceai/dedocx instead.


Small utility to convert from Microsoft's OMML to MathML.

This is by and large a port of the the omml2mathml.xsl XSLT that Microsoft ships with Office and that is in relatively wide use, with a few bugs fixed. This implementation does not require an XSLT processor (I built it because I became tired of XSLT processors that crash)

Installation

npm install omml2mathml

API

The API is very simple: there is only one function to know, it takes one input, runs synchronously, and returns one output.

import omml2mathml from 'omml2mathml';
let mathmlElement = omml2mathml(oMathElement);

The input should be an m:oMath or m:oMathPara element. Note that you can always use the former even if it has an m:oMathPara parent and the module will correctly set display="block" all the same. The object does not need to belong to any specific DOM implementation, it just needs to support some basic DOM operations (roughyl DOM 2, and then again not all of it). For instance the xmldom module will work fine.

It returns an instance of a math element as an HTML DOM object, as produced through the get-dom module, which is to say that if you are running this in the browser it will be the browser's implementation; if in Node it will be jsdom.

omml2mathml's People

Contributors

darobin avatar sballesteros avatar adamdonahue avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.