Include only code blocks from a .qmd file #6378
Replies: 3 comments 4 replies
-
One workflow that you might want to try with knitr is code externalisation: your chunks (all of them or just a subset) live in a R file, and the qmd files import them by label. |
Beta Was this translation helpful? Give feedback.
-
Note that the described behaviour is not Quarto's behaviour but As mentioned, Maybe the |
Beta Was this translation helpful? Give feedback.
-
Some additional comment in addition to all that was given above. In addition to using |
Beta Was this translation helpful? Give feedback.
-
Description
Please refer to this documentation:
https://quarto.org/docs/reference/cells/cells-knitr.html#include
Currently, it's possible to pass the following parameter to a code block to include and evaluate code cells in a
.qmd
file.If this file has only code chunks, then this runs the code appropriately. However, if there is markdown in the file, then the markdown is also included.
A feature that appears to be missing is to specify that only code chunks from a
.qmd
will be included and evaluated. In my workflow, there are times when I would only like to include the code chunks, for example to make some data or variables available to the document at the beginning, while still providing additional narrative around the code blocks in the original file so that the code is well documented and will work as a stand alone page.Aside from this, I've also tried to use the following feature to accomplish this behavior:
https://quarto.org/docs/authoring/includes.html#computations
This does evaluate the code blocks, however, again, the markdown between the code is included.
Beta Was this translation helpful? Give feedback.
All reactions