from KillTheMule@programming.dev to rust@programming.dev on 11 May 2024 10:25
https://programming.dev/post/13926215
Hey all!
I’ve just published a small crate, and would like to take the occasion to not only announce this, but also make typst
better known in the rust community, because I think it’s awesome :)
What does this do?
It provides a derive macro to derive typst::foundations::IntoValue
for a struct.
Why would I want that?
If you’re using typst
as a library, chances are you want to get data into your documents. Rather than using a templating library or rolling your own, I’d suggest using inputs
(I’m still excited being made aware of that!), which implies making a Value
out of your data. typst_macros
provides the possibility to derive Cast
, which includes the treasured IntoValue
… for enums. This is a gap somewhat closed by this crate.
So what about this typst?
typst
is a typesetting system (akin to LaTeX) written in Rust. The core and cli are licensed freely, and it is very useable up to the point that I personally don’t use latex anymore, but have switched to typst. I’m personally ultra-fond of the ability to use typst as a library, which makes it perfect for apps that want to produce high-quality documents from user-provided data.
Any questions, comments, criticism, code reviews welcome! Also, give typst a shot.
threaded - newest
Did I get it right? The crate lets you directly input data into a typst document from an arbitrary struct?
Also out of scope of OP, is typst in anyway capable of typesetting music notation? I never used LaTeX so I have no idea about that either or if it’s even feasible.
Well, typst provides those means in itself, this crate just makes it easier to fulfill the necessary trait.
I don’t really think so. Music notation is also pretty specific, so I’d look into specialized software for that (although it might be theres a latex package, those things are everywhere ^^).
I don’t typeset music myself but I’ve heard that LilyPond is very good. It is based on LaTeX.