quartools
quartools copied to clipboard
Code chunk generation
Ran into an issue with generating programmatic typst blocks, because they need their own code chunks so as to be evaluated properly. Ended up having to handroll a solution, so I think it makes sense that quartools supports this. Might have to examine quartools again because it's been a while since I've looked at the code :)
E.g., qto_codechunk with the following interface
qto_codechunk(
...,
lang = NULL,
id = NULL,
class = NULL,
css = NULL,
.attributes = NULL,
.content = NULL,
collapse = "",
drop_empty = TRUE,
drop_na = TRUE,
call = caller_env()
)
So qto_codechunk("#colbreak()", lang = "=typst") would generate:
```{=typst}
#colbreak()
```
Perhaps has implications for creating plain fenced blocks too, but the interface might need some more thought