6.18 FAQ
Q: How to add comments in Quarto markdown?
A: Use HTML comment syntax: <!-- This is a comment -->
Multiline comment:
Q: How to put shared chunk options setup in one file?
A: Put your shared chunk options in a separate file, e.g., _setup.qmd, then include it in your .qmd files using {{< include >}} shortcode:
The undersore in the file name indicates that it is a helper file that is not meant to be rendered on its own.
It is just a nice convention for the included files.
You should always use an underscore prefix with included files so that they are automatically ignored (i.e. not treated as standalone files) by a quarto render of a project.
I think this is the most concise way to include shared chunk options. Other options: put the shared chunk options in a separate .R file and source it in the setup chunk of your .qmd file:
Note that you cannot use {{< include >}} shortcode to execute an .R file.
If you have
the _setup.R will NOT be executed it NOT inserted. For inserting the content of an .R file, you need to quote the shortcode with triple backticks as follows.
Another common use for {{< include >}} shortcode is to print verbatim content from an external file. For example, you can use it to include a code snippet from an external file:
You can use other language tags, e.g., python,
The source code blocks ensure that the code is included as non-executed examples.
Load .txt files as verbatim text:
This is equivalent to
```{r, output="asis"}
f_name <- file.path(out_dir, "0-0_data_description.txt")
cat("<pre style='white-space: pre-wrap;'>", paste(readLines(f_name), collapse = "\n"), "</pre>")
```References: