Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 1.76 KB

File metadata and controls

60 lines (46 loc) · 1.76 KB

texlive-api

A simple integration of TeXLive in Node.js that works in the server and (someday) in the client.

I came to use someone else's package, but they were all either too old or made assumptions I didn't care for, so I'm writing this for the simple use case of: You've installed TexLive on a unix system and want to script it from node. Easy.

Currently only works on Unix + Server, but Windows support is trivial and browser support will come eventually. It supports variable targets (latex, tex, xelatex, etc. ) and delivers rendered data using a virtual file abstraction.

Usage

import { TexLive } from '@environment-safe/texlive-api';
const pdfFile = await TexLive.compile(`
    \\documentclass{article}
    \\begin{document}
        Hello Foo!
    \\end{document}
`);
// compile file 
const pdfFile = await TexLive.compileFile('/some/dir/myfile.tex');
const pdfFile = await TexLive.compileInPlace('/some/dir/myfile.tex');

The returned file is an instance of @environment-safe/file which can be used directly or saved to a new location.

Testing

Run the es module tests to test the root modules

npm run import-test

to run the same test inside the browser:

npm run browser-test

to run the same test headless in chrome:

npm run headless-browser-test

to run the same test inside docker:

npm run container-test

Run the commonjs tests against the /dist commonjs source (generated with the build-commonjs target).

npm run require-test

Development

All work is done in the .mjs files and will be transpiled on commit to commonjs and tested.

If the above tests pass, then attempt a commit which will generate .d.ts files alongside the src files and commonjs classes in dist