Refactor code to allow TikZ to html conversions on demand#30
Refactor code to allow TikZ to html conversions on demand#30rei2hu wants to merge 5 commits intokisonecat:masterfrom
Conversation
|
|
||
| window.TikZJax = TikZJax; | ||
| if (!window.TikZJaxNoAutostart) { | ||
| window.onload = TikZJax(document); |
There was a problem hiding this comment.
I'm not sure if this is considered a bug or not, but TikZJax was not being executed with the onload function, but was being executed when the line was hit (because the result of the call is what's being assigned to window.onload)
| } | ||
|
|
||
| const coredump = new Uint8Array(inf.result, 0, pages*65536); | ||
| return async (input) => { |
There was a problem hiding this comment.
load returns a function that sets up wasm with the loaded payload/core dumps, so theoretically you could load different wasm/coredumps.
const tex1 = await load(wasm1, coredump1);
const tex2 = await load(wasm2, coredump2);
tex1(tikz1);
tex2(tikz2);The main point of this is to prevent loading multiple times though. I don't see any benefit to loading multiple times.
|
Can I use this version before it is merged? Is there a bundled js-file I can download? |
Not a bundled version, but I did put together a repo that can be added to a package.json to do server side generation of svgs using these changes e.g. If you run into an issue using it feel free to make an issue there and I can look at it though it works for me(tm) |
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.jscontains all of the conversion logic and exposes aload(wasmPath, coredumpPath)method that can be called to instantiate the wasm module on demand.index.jscontains 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
dvi2htmlto 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.