Skip to content

Latest commit

 

History

History
55 lines (33 loc) · 3.33 KB

README.md

File metadata and controls

55 lines (33 loc) · 3.33 KB

OJO HTML Report Format

image

How to install / use

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.

Using

TODO: Describe how to use your format.

Format Options

The template includes the following configuration options in the yaml header:

  • A title, subtitle, logo, and description to display in the banner at the top
  • author, date (set to use the current date by default),
  • abstract and abstract-title can be used to create an executive summary, etc. before the body
  • number-sections automatically numbers the section headers / TOC, smooth-scroll makes the scrolling behavior nicer, and knitr: 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

Examples

Here is an example of a customized version of the template:

image

Here's how I made it:

  1. 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.
  2. 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.
  3. I customized the template by editing the yaml at the top of the .qmd file (for exmaple, I set title-block-banner to match DHub's green color, and logo 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 with quarto use template openjusticeok/ojo-report-template, you can go nuts and change anything you want!

Printing to PDF

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:

  1. 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.

  2. Next, render your document normally in the HTML format. This will create your_report.html.

  3. 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.

  1. This will generate a paralell .pdf version of your report wherever you specify in the output. Done!