Exercises
Exercises
Exercise 1: Customising Quarto outputs
- Create a Quarto document which outputs to HTML format.
- Include some text and a code block (in a programming language of your choice).
- Edit the YAML to use one of the Bootswatch themes. See quarto.org/docs/output-formats/html-themes.html for options.
- Further edit the YAML to change the
linkcolor. - Bonus: edit other YAML options to customise further.
Solution
Exercise 2: Using style files
- Create a
styles.scssfile. - Add the
styles.scssfile to the YAML options in your Quarto file. - Create some CSS variables and write some simple CSS rules in the
styles.scssfile.
Solution
Exercise 3: Styling with Quarto extensions
- Install the
LCARStemplate by Michael McCarthy usingquarto add mccarthy-m-g/quarto-lcars-theme. - Edit the YAML of your
.qmdfile to use the extension. See github.com/mccarthy-m-g/quarto-lcars-theme for more information. - Re-render your document.
- Bonus: browse the Awesome Quarto list and choose a different extension: github.com/mcanouil/awesome-quarto
Solution
Run:
quarto add mccarthy-m-g/quarto-lcars-theme
Exercise 4: Building your own Quarto extension
- Create an
_extensionsfolder in the same directory as your.qmdfile. - Create another folder inside the
_extensionsfor your extension e.g.PrettyHTML. - Move your
styles.scssfile from Exercise 2 into thePrettyHTMLfolder. - Create an
_extension.ymlfile in thePrettyHTMLfolder. - Write the YAML code specifying the extension title, author name, version number, and contribution (HTML format with the
styles.scssstyling). - Edit the YAML in the
.qmdfile to use this extension.