Passing json data as argument parameter
rousbound opened this issue · 3 comments
rousbound commented
I think it would be desirable to pass json data directly to typst. Without needing typst to read the json file from disk.
messense commented
What json data? Can you elaborate?
rousbound commented
I'm sorry for my unclear explanation.
I meant that it would be desirable for generating dynamic documents, to have an API such as the following:
import typst
compiler = typst.Compiler(".")
json_file = get_json_file()
pdf_bytes = typst.compile("hello.typ", json_file=json_file)
So in the document I could retrieve the json file in a way like:
#let data = json(json_file)
Or something else in a similar way.
The advantage is to load json in memory, instead of writing the json in a directory and making typst reading it.
I don't know if that is possible without deeper modifications to typst though.
rousbound commented
We found a plausible path to solve this feature in: typst/typst#1158 (comment)