Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature request: make litedown more shell friendly #48

Open
AlbertLei opened this issue Dec 6, 2024 · 3 comments
Open

feature request: make litedown more shell friendly #48

AlbertLei opened this issue Dec 6, 2024 · 3 comments

Comments

@AlbertLei
Copy link

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.

@yihui
Copy link
Owner

yihui commented Dec 6, 2024

For now, the shell version would be:

  1. Type R in the shell to start R.
  2. 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.

@J-Moravec
Copy link

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.

@yihui
Copy link
Owner

yihui commented Dec 10, 2024

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants