ed-mathml2tex 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -0
- package/lib/mathml2latex.browser.cjs.js +1027 -0
- package/lib/mathml2latex.browser.es.js +1025 -0
- package/lib/mathml2latex.browser.umd.js +1033 -0
- package/lib/mathml2latex.cjs.js +1027 -0
- package/lib/mathml2latex.es.js +1025 -0
- package/lib/mathml2latex.umd.js +1033 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# mathml2latex
|
|
2
|
+
|
|
3
|
+
It's a javascript library to convert mathML to latex
|
|
4
|
+
|
|
5
|
+
## Build
|
|
6
|
+
|
|
7
|
+
Clone this repo and run `npm run build`, It'll generate belowing files:
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
lib
|
|
11
|
+
├── mathml2latex.browser.cjs.js
|
|
12
|
+
├── mathml2latex.browser.es.js
|
|
13
|
+
├── mathml2latex.browser.umd.js
|
|
14
|
+
├── mathml2latex.cjs.js
|
|
15
|
+
├── mathml2latex.es.js
|
|
16
|
+
└── mathml2latex.umd.js
|
|
17
|
+
dist
|
|
18
|
+
└── mathml2latex.js
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## usage
|
|
22
|
+
|
|
23
|
+
### load library
|
|
24
|
+
|
|
25
|
+
In browser environment, you need to build the library first, then load it:
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script src="dist/mathml2latex.js"></script>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Using with npm
|
|
33
|
+
|
|
34
|
+
```shell
|
|
35
|
+
npm install mathml2latex
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
const MathMl2LaTeX = require('mathml2latex')
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### convert mathml html
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
const mathmlHtml = '<math display="block"><mfrac><mi>a</mi><mi>b</mi></mfrac></math>';
|
|
46
|
+
const latex = MathML2LaTeX.convert(mathmlHtml); // => \frac{a}{b}
|
|
47
|
+
```
|