When you sit down to start a new report, you can copy the template and all needed by navigating to your working directory and using the following terminal command:
# Be sure to navigate to the right place first with `cd my/working/directory`
quarto use template openjusticeok/ojo-report-template
This will install the extension and create an example qmd file that you can use as a starting place for your report / article / whatever.
TODO: Describe how to use your format.
The template includes the following configuration options in the yaml header:
- A
title
,subtitle
,logo
, anddescription
to display in the banner at the top author
,date
(set to use the current date by default),abstract
andabstract-title
can be used to create an executive summary, etc. before the bodynumber-sections
automatically numbers the section headers / TOC,smooth-scroll
makes the scrolling behavior nicer, andknitr: opts_chunk: fig.align: center
just sets the default behavior for figures / images in the body.
For a full list of available configuration options, see https://quarto.org/docs/reference/formats/html.html
Here is an example of a customized version of the template:
Here's how I made it:
- I navigated to the directory I wanted the report in (in this case it was
Github/diversion-hub/inst/reports/metrics-report/
) in the terminal. - I ran
quarto use template openjusticeok/ojo-report-template
, which cloned the template repo and generated a.qmd
file, plus all the necessary extensions / styling (most of which will be in/_extensions/
). If you just open and run the resulting.qmd
file, you should see the generic template version of the OJO report. - I customized the template by editing the
yaml
at the top of the.qmd
file (for exmaple, I settitle-block-banner
to match DHub's green color, andlogo
to the DHub logo instead of the OJO one). I also wanted to change a few more specific things, so I edited the SCSS variables at the top of/_extensions/openjusticeok/ojo-report-template/custom.scss
so I could change the title / subtitle text colors individually. Once you've cloned the template withquarto use template openjusticeok/ojo-report-template
, you can go nuts and change anything you want!
This template is built to generate a HTML report, but it is also designed to look good as a PDF. The steps to render your HTML report as a PDF are:
-
First, make sure that
toc: false
is set in your document's YAML header. If you don't, the floating TOC will throw off the spacing of the final document. -
Next, render your document normally in the HTML format. This will create
your_report.html
. -
Finally, make sure that you have the
{pagedown}
package installed, and run the following function:pagedown::chrome_print(input = "your_report.html", output = "your_report.pdf")
Note that the
input
is the.html
document, and not the original.qmd
file.
- This will generate a paralell
.pdf
version of your report wherever you specify in theoutput
. Done!