terminal
quarto add edenian-prince/quarto-html-ext/nwpageThis is an example template showcasing the default styles and formats that come with this Quarto template. You can customize and change anything you want, or just use the default
I recommend installing this as an extension for an existing quarto project (but you can also use it as a base template)
For existing projects execute this in a terminal:
terminal
quarto add edenian-prince/quarto-html-ext/nwpageFor websites, in your _quarto.yml file change the format to be nwpage-html instead of just html.
Change this:
_quarto.yml
project:
type: website
website:
title: "codebook"
navbar:
left:
- href: index.qmd
text: Home
- about.qmd
format:
html:
theme: cosmo
css: styles.css
toc: trueTo this:
_quarto.yml
project:
type: website
website:
title: "codebook"
navbar:
left:
- href: index.qmd
text: Home
- about.qmd
format:
nwpage-html:
toc: trueSimilarly, if you just have an html quarto doc that is not part of a website, you can call the formats into your document in your .qmd file’s front matter like this with nwpage-html:
index.qmd
---
title: my qmd doc
author: you
format:
nwpage-html: default
---
# header
the rest of the document...To create a project with the template:
terminal
quarto use template edenian-prince/quarto-html-ext/nwpageThis template should be used for htmls. I’m planning on adding a pdf typst template in the near future
Frank Aragona - faaragona4@gmail.com or frank.aragona@doh.wa.gov
The styling for the code blocks was inspired by the mlr3book. They look so clean, and be sure to check out their awesome book on machine learning in R.
There CSS styles for creating different code block sizes:
.smallframe - for small blocks, usually for small code chunks and terminal commandsterminal
sudo make installIn markdown:
:::{.smallframe}
::: {.cell filename='terminal'}
```{.bash .cell-code}
sudo make install
```
:::
:::.medframe - for medium size chunksR script
library(dplyr)
df <- mtcars |>
select(mpg,cyl,disp)|>
filter(mpg > 30)In markdown:
:::{.medframe}
::: {.cell filename='R script'}
```{.r .cell-code}
library(dplyr)
df <- mtcars |>
select(mpg,cyl,disp)|>
filter(mpg > 30)
```
:::
:::.myframe is a code block with a box shadow underneath. It makes it appear as thought the code block pops out of the screenPython script
import os
import pandas as pd
for f in os.listdir(received_submission_dir):
if f.endswith('received_submissions.csv'):
df = pd.read_csv(f'{received_submission_dir}/{f}')
received_submission_df_list.append(df)
received_submission_df = pd.concat(received_submission_df_list)
received_submission_df.reset_index(drop=True, inplace=True)In markdown:
:::{.myframe}
::: {.cell filename='Python script' python.reticulate='false'}
```{.python .cell-code}
import os
import pandas as pd
for f in os.listdir(received_submission_dir):
if f.endswith('received_submissions.csv'):
df = pd.read_csv(f'{received_submission_dir}/{f}')
received_submission_df_list.append(df)
received_submission_df = pd.concat(received_submission_df_list)
received_submission_df.reset_index(drop=True, inplace=True)
```
:::
:::There are custom code outputs to make the outputs more readable. This was inspired by the knitr documentartion on chunk styling
I added a background and bold font to the outputs like this:
R script
library(dplyr)
(
df <- mtcars |>
select(mpg,cyl,disp)|>
filter(mpg > 30)
) mpg cyl disp
Fiat 128 32.4 4 78.7
Honda Civic 30.4 4 75.7
Toyota Corolla 33.9 4 71.1
Lotus Europa 30.4 4 95.1
The Quarto default is this (which I think is a bit too plain sometimes):
R script
library(dplyr)
(
df <- mtcars |>
select(mpg,cyl,disp)|>
filter(mpg > 30)
) mpg cyl disp
Fiat 128 32.4 4 78.7
Honda Civic 30.4 4 75.7
Toyota Corolla 33.9 4 71.1
Lotus Europa 30.4 4 95.1
To use the output style, make sure to use #| class-output: watch in the yaml header of your code chunk, like this:
R script
```{r filename="R script"}
#| eval: true
#| message: false
#| warning: false
#| class-output: watch
library(dplyr)
(
df <- mtcars |>
select(mpg,cyl,disp)|>
filter(mpg > 30)
)
``` mpg cyl disp
Fiat 128 32.4 4 78.7
Honda Civic 30.4 4 75.7
Toyota Corolla 33.9 4 71.1
Lotus Europa 30.4 4 95.1
There are custom callout blocks inspired by this fantastic website by Hasse Walum and Desiree de Leon.
To make a custom callout block, use the .note div like this:
::: {.note .medframe}
**Objectives**
- Prevent sensitive information leaks to Github
- Set up guardrails, `.gitignore`, hooks
- Scrub private repos before they go public
:::to get this
Objectives
.gitignore, hooksnote: I’m using icons in the callout block that need to be installed in your project. if you want to use icons, follow this guide to install and use
The custom panel tabsets were inspired and pull from this awesome blog by Christoph Scheuch
To make a panel tabset, wrap a group of headers in a fenced div called `:::{.panel-tabset} like:
:::{.panel-tabset}
## header1
stuff here
## header2
other stuff here
## header3
even stuff here
:::and it will output to be this:
stuff here
other stuff here
even stuff here
You can learn more about controlling the appearance of HTML output here: https://quarto.org/docs/output-formats/html-basics.html