Skip to content

Instantly share code, notes, and snippets.

@graebnerc
Last active May 7, 2024 21:49
Show Gist options
  • Save graebnerc/f42962b9ecbf9d7a7e6dc5593be691bd to your computer and use it in GitHub Desktop.
Save graebnerc/f42962b9ecbf9d7a7e6dc5593be691bd to your computer and use it in GitHub Desktop.
#T9: Possible solution for the Quarto task
The Netlify version can be found at: https://quarto-ex-solution.netlify.app/
---
title: "A possible solution"
author: "Claudius"
date: "2024-05-10"
execute:
echo: false
format:
html:
toc: true
toc-depth: 2
toc-location: body
number-sections: true
theme: darkly
pdf:
toc: true
toc-depth: 2
toc-location: body
number-sections: true
---
# Introduction
In the (invisible) YAML header we set the default value for the chunk option
`echo` to `FALSE`, meaning that code is hidden by default.
Also check out the header, in which we explicitly set `title`, `date`, and
`author` - the result of this can be seen in the rendered document. To comply
with the respective tasks we added the specifications
`toc: true` and `toc-location: body` to `html` to add the
table of contents at the beginning, and `theme: darkly` to use this theme.
As you could expect, `number-sections: true` ensures section headings are
numbered.
To the `pdf` call we add the TOC related comments and `number-sections: true´.
## A second level heading
Again some text. Here is the first chunk.
The code is shown in the rendered document because we set the chunk option
`echo: true`, and so is the output produced by the code because the chunk
option `include` is set the `TRUE` by default:
```{r}
#| echo: true
vector_random_numbers <- rnorm(
n = 12, mean = 5, sd = 2)
vector_random_numbers
```
## A visualization
Here we produce the desired ggplot (the code for which remains hidden because
we did not deviate from the default value of `echo`, which we set to `FALSE`
in the setup chunk.)
# Using Netlify Drop
The document was published using [Netlify Drop](https://app.netlify.com/drop),
as explained in the slides.
This is the reason the file is called `index.qmd`: Netlify Drop only works if
a `html`-file called `index.html` is included in the uploaded directory.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment