Open iamrecursion opened 2 years ago
I'm assuming that it's as simple as
npm run devbuild
ornpm run build
for building with any changes there, but I'm a bit confused as to how I then integrate changes with the Obsidian plugin!
Yup! Running either of those commands produces a folder, dist
, containing tikzjax.js
. You then copy tikzjax.js
to the obsidian-tikzjax
folder. Then you can build the plugin like any other Obsidian plugin using npm run dev
.
Some notes:
The person I forked TikZJax from wrote some build instructions for TikZJax you can find here. However, you can skip the entire section involving web2js and just use the core.dump.gz
and tex.wasm.gz
files that I've already gone and generated myself. You can grab those from a previous version of this repo
Before every build, genTexFiles.js
is run which pulls in all the files listed in tex_files.json for embedding into TikZJax. However, this might lead to issues if we're running different TeX distributions/versions and it pulls in different versions of files which might be incompatible with my particular core.dump
and tex.wasm
.
(Further, I haven't listed some package files in tex_files.json due to some awkward issues, like only an older version of chemfig working! So I instead manually copied the chemfig files to the tex_files
folder for embedding. But these won't be picked up by genTexFiles.js
.)
So, it might be best if you used copies of my tex files? I can provide those here if you want. Or I could commit them to the TikZJax repo.
In the dist
folder, you'll also see a fonts.css
has been produced. You can ignore this as it doesn't change between builds and I've already embedded it into Obsidian TikZJax
I'm very happy to write whatever tips you can give me into a little dev guide for the repo (
CONTRIBUTING.md
or whatever you feel is suitable) if that's helpful!
Yeah, that'd be useful! :)
Yup! Running either of those commands produces a folder,
dist
, containingtikzjax.js
. You then copytikzjax.js
to theobsidian-tikzjax
folder. Then you can build the plugin like any other Obsidian plugin usingnpm run dev
.
Makes sense. I was wondering if there was any automated integration but couldn't find any!
You can grab those from a previous version of this repo
Can I ask what the reasoning is behind the removal of these files in the current state of the repo?
So, it might be best if you used copies of my tex files? I can provide those here if you want. Or I could commit them to the TikZJax repo.
It would make sense to me to commit them to the repo (potentially as LFS files depending on size). Getting these builds as reproducible as possible makes the most sense to me at this stage, and relying on individual TeX distributions seems...risky.
Yeah, that'd be useful! :)
Will do! I'll probably post the WIP guide here so I can get your feedback before PRing it! I wanna make sure I've understood everything correctly.
Makes sense. I was wondering if there was any automated integration but couldn't find any!
Ah yeah, thankfully copying a single file over isn't too bad. Maybe you could set webpack to output directly to the obsidian-tikzjax
folder though!
Can I ask what the reasoning is behind the removal of these files in the current state of the repo?
Previously, the TikZjax files were stored in the repo to make them available for fetching via jsdelivr. With #3, the core.dump.gz
and tex.wasm.gz
files are embedded directly in tikzjax.js
, and no longer need to be fetched from a CDN. So we no longer need to store them (or any of the contents of the old dist
folder) in the repo.
It would make sense to me to commit them to the repo (potentially as LFS files depending on size). Getting these builds as reproducible as possible makes the most sense to me at this stage, and relying on individual TeX distributions seems...risky.
Done! With that, you can remove the npm run gen-tex-files
command from the build scripts in package.json
(so the tex_files don't get overwritten whenever you run a build).
Will do! I'll probably post the WIP guide here so I can get your feedback before PRing it! I wanna make sure I've understood everything correctly.
Sounds good 👍
Ah yeah, thankfully copying a single file over isn't too bad. Maybe you could set webpack to output directly to the
obsidian-tikzjax
folder though!
Yeah it's definitely not too painful!
Previously, the TikZjax files were stored in the repo to make them available for fetching via jsdelivr. With #3, the
core.dump.gz
andtex.wasm.gz
files are embedded directly intikzjax.js
, and no longer need to be fetched from a CDN. So we no longer need to store them (or any of the contents of the olddist
folder) in the repo.
Makes sense. With all that said, though, for consistency it makes sense to me for them to be committed to the tikzjax repo so that builds can be reproducible there. Would you be up for doing that?
Done! With that, you can remove the
npm run gen-tex-files
command from the build scripts inpackage.json
(so the tex_files don't get overwritten whenever you run a build).
Sounds great!
Makes sense. With all that said, though, for consistency it makes sense to me for them to be committed to the tikzjax repo so that builds can be reproducible there. Would you be up for doing that?
Good idea! I've done that now (:
Perfect, thank you so much! I'll try and write up some building instructions in the next few days!
Actually, a question. Would it make sense to remove the npm run gen-tex-files
from the repo as well? If the assumption is that people should use the provided tex files, only those that know what they're doing should then run that.
Yes, you're right! I'll go ahead and do that when I get the chance.
I can PR it if that's easier?
That'd work too :)
Done here!
I'm also interested in potentially making some FRs to this plugin, was any progress made on a CONTRIBUTING doc?
Rightyo! I'm starting to have a look at #4 whilst also keeping an eye out for a resurgence of #7, and I'm wondering what your development workflow is like.
In particular, I'm interested in what's required to build and use an updated version of your TikZJax fork in the plugin, as well as how you tend to work whilst developing changes to the plugin directly! I've been poking at the
output-single-file
branch in your TikZJax fork, and I'm assuming that it's as simple asnpm run devbuild
ornpm run build
for building with any changes there, but I'm a bit confused as to how I then integrate changes with the Obsidian plugin!I'm very happy to write whatever tips you can give me into a little dev guide for the repo (
CONTRIBUTING.md
or whatever you feel is suitable) if that's helpful!