Skip to content

How to include code snippet from external file? #3868

Answered by mcanouil
drriguz asked this question in Q&A
Discussion options

You must be logged in to vote

Include shortcode is to include child Quarto document.

For actual code, via knitr at least you can use https://quarto.org/docs/reference/cells/cells-knitr.html#include.

Meaning, there is no native way to include only part of a file, unless you write a hacky code cell using the knitr code option to include your contents.

In my opinion, if you only want a subset of a Quarto document A (not code) into document B, I suggest you put this subset in _C, and include it in both A and B.

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@drriguz
Comment options

@cderv
Comment options

cderv Feb 2, 2023
Maintainer

@drriguz
Comment options

Answer selected by drriguz
Comment options

You must be logged in to vote
1 reply
@drriguz
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants