Is it possible to source a lua filter from an R package? #10618
-
DescriptionMy QuestionHi there! I wonder if there is a way to source the lua filter(s) from an R package. Currently, we have 2 ways of sourcing a lua filter:
Now I'm building an R package and wonder if it's possible to source a lua filter from it. I know there is an ExampleTo explain it better, here is a simple example of using the "code-visibility" Quarto extension. Firstly, to install it, run in your Terminal:
Then, render this example Quarto doc: ---
title: "Quarto ext example usage"
filters:
- code-visibility
---
```{r}
# This line can be shown:
visible_line <- "Hi! I am visible!"
# This line is hidden by using this filter:
i_am_invisible <- "You are not supposed to see me!" #| hide_line
``` In the output HTML page, you can see the line of Then, back to my own R package development question, I wonder if I can have a lua filter in my R package, so that as long as it's installed, I can source it using Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think you are probably running into the limitation that a quarto document can't look outside its project directory. This is for reproducibility - all inputs must come from the project or document directory. So although you can run R and Python from packages, you can't currently do that with Lua, so you must copy Lua filters into the project directory. So you need to make a Quarto extension that installs the Lua filters that your R package needs. Others probably know whether it's possible to have a combined R package / Quarto extension so you can develop them in one repo. Worst case it's two project repos. |
Beta Was this translation helpful? Give feedback.
I think you are probably running into the limitation that a quarto document can't look outside its project directory.
This is for reproducibility - all inputs must come from the project or document directory. So although you can run R and Python from packages, you can't currently do that with Lua, so you must copy Lua filters into the project directory.
So you need to make a Quarto extension that installs the Lua filters that your R package needs.
Others probably know whether it's possible to have a combined R package / Quarto extension so you can develop them in one repo. Worst case it's two project repos.