ArthurSonzogni / Diagon

Interactive ASCII art diagram generators. :star2:
https://arthursonzogni.com/Diagon/
MIT License
1.48k stars 56 forks source link

CLI option? #8

Closed Pomax closed 3 years ago

Pomax commented 3 years ago

Hiya, for... reasons... I tried loading up https://pomax.github.io/bezierinfo in Lynx, and realised that it would be very nice to see an ascii version of the ~250 LaTeX formulae pepper throughout the page, rather than seeing this:

image

Is there a way to invoke Diagon via the CLI, so it can be made part of a build chain, calling it on a .tex file and getting stdio output that can be used by "whatever was looking at stdio"?

E.g. I currently generate those svg images by effectively running xelatex 1a2b3c4d.tex && pdfcrop 1a2b3c4d.pdf && pdf2svg 1a2b3c4d-cropped.pdf && svgo 1a2b3c4d-cropped.svg && cp 1a2b3c4d-cropped.svg ../images/latex/1a2b3c4d.svg so create a secondary chain that runs Diagon would be super cool.

ArthurSonzogni commented 3 years ago

Yes there is a CLI. I should definitely mention this in the README.

Diagon is written in C++.

Note: The Math module takes formula written in its own simple language (as close a natural one) and can output formula in ascii art, unicode and latex.

Note that it can output latex, but not take latex as input.

You can compile yourself the executable from source, or use the precompiled version (using snap) https://snapcraft.io/diagon

sudo snap install diagon

I can provide Windows and Linux executables if needed. Feel free to ask for new features if you need something.

To get the documentation you can type:

diagon help

To get the documentation for the Math module, you can type:

diagon Math help

Most likely, you want to use something like:

cat input | diagon Math --style=latex

Or

diagon Math --style=latex -- "inline formula"

(It might be slightly different, I can't check locally at the moment)

Thanks for filling this question!

Pomax commented 3 years ago

Note that it can output latex, but not take latex as input.

Dang, I completely missed that =(

But thanks for the detailed answer!

Pomax commented 3 years ago

(did not mean to press "close" >_>;;)