Quarto includes short code
Using the Quarto includes
short code, writing a long document can easily be broken down into several smaller ones.
Imagine the following main.qmd
file:
# My thesis in Latin
{{< include chapter1.md >}}
{{< include chapter2.md >}}
Quarto will then merge the three files when you render main.qmd
.
If you don't have yet a Docker image with Quarto, read this article Running Quarto Markdown in Docker.
Includes tagโ
The tag is simple, you just need to specify the relative path to the file to include. Get in-depth syntax on the official documentation
Here is some dummy content for chapter1.md
:
## Chapter 1
Voluptatem minus labore architecto sed voluptas molestiae perferendis. Sed voluptatem ut amet at blanditiis sunt et exercitationem quidem. Vel id impedit dicta omnis repudiandae iure.
Expedita magni facere. Ullam non non sint qui provident. Ea beatae voluptatem pariatur. Et beatae error ea aut neque omnis pariatur rerum ut.
Ad aut nobis magni aut est dicta adipisci est. Quo reiciendis eum aut rem. Dolores sit magni non.
And for chapter2.md
:
## Chapter 2
Iure repudiandae perferendis maiores dolorem consequuntur exercitationem suscipit.
Animi voluptatem est quia. Quia id optio. Architecto ut ipsa voluptas minima voluptate accusamus architecto.
Consequatur debitis et sunt eos quod qui unde aut.
Now, by running, f.i., quarto render main.qmd --to html
, Quarto will merge files and you'll get:
.qmd
files?For Quarto, the extension isn't very important: whether it's .qmd
or .md
, there's no difference in treatment.
On the other hand, it's probably more interesting for us to use the .qmd
extension when using a Quarto-specific syntax, as is the case here.