2.2.2 • Published 1 year ago
texsvg v2.2.2
texsvg
Converts TeX to SVG using MathJax and SVGO:
texsvg(string)Examples
Module:
const texsvg = require('texsvg');
texsvg('\\frac{a}{b}').then((svg) => console.log(svg));CLI:
texsvg '\frac{a}{b}' fraction.svgOther:
Installation
Module
NPM:
npm install texsvgYarn:
yarn add texsvgCLI
NPM:
npm install --global texsvgYarn:
yarn global add texsvgNPX:
npx texsvgUsage
Module
Import with ES Modules:
import * as texsvg from 'texsvg';Or require with CommonJS:
const texsvg = require('texsvg');Convert TeX to SVG using async-await:
const quadraticFormula = 'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}';
(async () => {
try {
const svg = await texsvg(quadraticFormula);
console.log(svg);
} catch (err) {
console.error(err);
}
})();Convert TeX to SVG using Promise:
const quadraticFormula = 'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}';
texsvg(quadraticFormula)
.then((svg) => console.log(svg))
.catch((err) => console.error(err));CLI
Usage:
texsvg <tex> <file>Convert TeX to SVG and log result to console:
texsvg '\frac{a}{b}'Convert TeX to SVG and save result to file:
texsvg '\frac{a}{b}' fraction.svgTesting
Run tests with coverage:
npm testRun tests in watch mode:
npm run test:watchRun integration tests:
npm run test:integrationLint files:
npm run lint
npm run lint:tscFix lint errors:
npm run lint:fixRelease
Release is automated with Release Please.
License
2.2.2
1 year ago
2.2.1
2 years ago
2.2.0
2 years ago
2.1.0
2 years ago
2.0.7
2 years ago
2.0.5
2 years ago
2.0.6
2 years ago
2.0.3
2 years ago
2.0.4
2 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.5.1
3 years ago
1.5.0
3 years ago
1.4.0
4 years ago
1.3.1
5 years ago
1.3.0
5 years ago
1.2.0
6 years ago
1.1.0
6 years ago
1.0.0
6 years ago
0.0.0
6 years ago
