kisonecat / tikzjax

TikZJax is TikZ running under WebAssembly in the browser
LaTeX Project Public License v1.3c
437 stars 36 forks source link

Refactor code to allow TikZ to html conversions on demand #30

Open rei2hu opened 1 week ago

rei2hu commented 1 week ago

This is a refactoring that will allow users to perform conversions on demand, keeps the existing functionality, and fixes some bugs.

I had a use case where I wanted to do the main processing in a Worker, so I made these changes (and some more that aren't included) to support that. I've left most of the existing code intact. Also helps with #8, #20, and #24.

TikZJax.js contains all of the conversion logic and exposes a load(wasmPath, coredumpPath) method that can be called to instantiate the wasm module on demand.

index.js contains all of the logic that relies on being in the dom.

I've updated the README with a basic example of how to load things manually.

I also had to pull in a different version of dvi2html to get things to build, but that should not be an issue because the interface looks to be the same.

The repository seems incomplete so let me know if I've messed up some hidden workflow.