feature request: make litedown more shell friendly
I consider myself a minimalist and like the idea of litedown. However, one thing that prevents me from trying litedown more is its focus on users who primarily work within an R session. Indeed, the docs seem to even assume users are using RStudio and frequently talk about the knit button.
I would try litedown more if it could (i) offer a CLI tool or (ii) provide guidance in the docs on how to create a bash wrapper around RScript to use it. Method (ii) may be easy and straightforward (am i right?). But knowing that the developer has users like me in mind would certainly encourage me to try litedown more.
I think there are other potential users like me. While litedown is an R package, its main functions are more similar to pandoc/quarto. I think most people use pandoc and quarto from CLI.
For now, the shell version would be:
- Type
Rin the shell to start R. - Type
litedown::roam().
Or
R -e 'litedown::roam(open=TRUE);while(TRUE)Sys.sleep(.01)'
# Ctrl + C to stop
If you only intend to render one file, call litedown::fuse() or litedown::mark(), which can also be done via R -e, or a shell script wrapper, which should be quite straightforward to write, e.g., fuse.sh
#!/usr/bin/env Rscript
litedown::fuse(commandArgs(TRUE))
Then
./fuse.sh your-file.Rmd
If you are looking for a product similar to litedown but doesn't depend on R, you may come back a year later. I have had some wild ideas for quite a while and need to find time to try.
YAML header should contain all the information and I usually have a project-wide makefile, but an executable script added to a path so I could just do:
litedown infile.rmd --out latex --keep_md --options +toc
or a variation of thereof sounds rad.
Yes, that would be nice and shouldn't be hard to write (especially on *nix).
A true executable?
When I said "a year" above, I meant "give me some time next year to learn Rust and reimagine Jupyter" (then a by-product would be a true CLI tool, not just a wrapper shell script).
Coming here late but as it is related: I also prefer shell (and/or farmed out shell calls from the editor) and FWIW I have been driving rmarkdown and friends for many years now from a simple shell wrapper render.r. It, just like dozens of similar scripts, are in package littler and use /usr/bin/r (or /usr/bin/env r). It would be pretty trivial to rewrite them for Rscript (and its mostly just the commandArgs() business).
It would be trivial to extend this to litedown.