Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ns-rse authored Oct 24, 2023
0 parents commit d41868f
Show file tree
Hide file tree
Showing 15 changed files with 2,599 additions and 0 deletions.
1 change: 1 addition & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
source("renv/activate.R")
50 changes: 50 additions & 0 deletions .github/workflows/quarto-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
on:
push:
branches: main

name: Render and Publish

jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
# To install LaTeX to build PDF book
tinytex: true
# uncomment below and fill to pin a version
# version: 1.2.335

- name: Install Quarto Extensions
run: |
quarto install --no-prompt extension jmbuhr/quarto-qrcode
quarto install --no-prompt extension grantmcdermott/quarto-revealjs-clean
quarto install --no-prompt extension ArthurData/quarto-confetti
- name: Install Python and Dependencies
uses: actions/[email protected]
with:
python-version: '3.10'
cache: 'pip'
- run: pip install -r requirements.txt

- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.2.0'

- name: Install R Dependencies
uses: r-lib/actions/setup-renv@v2
with:
cache-version: 1

- name: Publish to GitHub Pages (and render)
uses: quarto-dev/quarto-actions/publish@v2
with:
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # this secret is always available for github actions
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/.quarto/
_site/*
\#*
*~
.quarto/*
_extensions/*
21 changes: 21 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Configuration
config:
# MD013 - line-length
line_length:
line_length: 120
code_blocks: false
tables: false
html:
allowed_elements:
- div

globs:
- "**/*.md"
- "**/*.qmd"

ignore:
- ".quarto/*"
- "_site/*"

# Fix any fixable errors
fix: true
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
types: [yaml, markdown]
- id: end-of-file-fixer
- id: check-yaml

- repo: https://github.com/DavidAnson/markdownlint-cli2
rev: v0.9.2
hooks:
- id: markdownlint-cli2
args: []

ci:
autofix_prs: true
autofix_commit_msg: '[pre-commit.ci] Fixing issues with pre-commit'
autoupdate_schedule: weekly
autoupdate_commit_msg: '[pre-commit.ci] pre-commit-autoupdate'
121 changes: 121 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
Creative Commons Legal Code

CC0 1.0 Universal

CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.

Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").

Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.

For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:

i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.

4. Limitations and Disclaimers.

a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.
143 changes: 143 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# Template Quarto Revealjs site

This template can be used to publish a [RevealJS](https://revealjs.com/) website that has been written in
[Quarto](https://www.quarto.org). It includes a [GitHub Action](https://docs.github.com/en/actions) which will convert
the Quarto source to HTML and publish them via [GitHub Pages](https://pages.github.com/).

Its a useful way of making slides portable as they are then available via the URL and naturally the slides are version
controlled.

## Usage

### Use the Template

Start by clicking on the "_Use this Template_" button and selecting "_Create a new repository_". You will have to choose
a name for the repository and this should reflect the nature of your talk. When ready click on "_Create repository from
template_" and this will copy all the resources into a new repository under your GitHub account ready for you to start
using.

### Repository settings

You **MUST** make sure your repository action settings are configured to allow read and write permissions.

![image](https://user-images.githubusercontent.com/20887250/216280796-86028c95-76b7-418a-a3eb-e614a8ab874a.png)

You can find this settings at `https://github.com/[USER]/[repo]/settings/actions`.

### Clone the repository

Typically you will work on files on your local computer, staging and committing changes and periodically pushing to
GitHub for backup and publishing. How you clone depends on what client you use but at the command line you can use...

``` bash
git clone https://github.com/<USERNAME>/<REPOSITORY>
```

Substitute `<USERNAME>` and `<REPOSITORY>` appropriately.

### Edit `_quarto.yaml`

How you should edit `_quarto.yaml` and change the `site-url` to reflect your GitHub user account and the name of the
repository you have chosen for this project. Its probably wise to modify the `title` and `description` too. The sample
code below shows in capitals the fields you should modify.

``` yaml
project:
type: website

website:
title: "<INSERT_TITLE>"
site-url: https://<YOUR_GITHUB_USERNAME>.github.io/<NAME_OF_REPOSITORY>
description: "<INSERT_DESCRIPTION>"
```
### Install Extensions
This template uses some [extensions](https://quarto.org/docs/extensions/)
([quarto-clean](https://github.com/grantmcdermott/quarto-revealjs-clean), [QR
extension](https://github.com/jmbuhr/quarto-qrcode) and [confetti](https://github.com/ArthurData/quarto-confetti)) and
these need to be installed locally _before_ you can proceed.
``` bash
quarto install --no-prompt extension jmbuhr/quarto-qrcode
quarto install --no-prompt extension grantmcdermott/quarto-revealjs-clean
quarto install --no-prompt extension ArthurData/quarto-confetti
```

### Publish Locally

You will need to run `quarto publish gh-pages` once locally before deploying this template. This creates a new branch
`gh-pages` which is where the resulting pages are published to and pushes them to GitHub.

``` bash
quarto publish gh-pages
```

### Write your slides

You are now ready to create your slides by editing the `index.qmd` in the root of the repository. For more information
on writing RevealJS slides in Quarto see the [RevealJS](https://quarto.org/docs/presentations/revealjs/) guide and the
[Revealjs Reference](https://quarto.org/docs/reference/formats/presentations/revealjs.html).

When you stage, commit and push your commits to GitHub the `quarto-publish.yaml` will run.

## pre-commit

A [pre-commit](https://pre-commit.com) configuration is included (see `.pre-commit-config.yaml`) and includes a hook for
[markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) (see `.markdownlint-cli2.yaml` for
configuration). To use `pre-commit` you will have to install `pre-commit install` in your cloned repository. This requires
`pre-commit` to be installed on your system or within a Python Virtual Environment. To find out more about installing
and configuring `pre-commit` see the article [pre-commit : Protecting your future
self](https://rse.shef.ac.uk/blog/pre-commit/) or refer to the official documentation.

## Extensions

There are a growing number of useful [Quarto extensions](https://quarto.org/docs/extensions/). Three are included in this
template and they are also installed during the publishing and deployment of the resulting slides as they are listed in
the `quarto-publish.yml`. You should have installed these locally as instructed above.

If you use additional extensions then as well as installing them locally on your computer you **MUST** remember to add
them to the `Install Quarto Extensions` section of `.github/workflows/quarto-publish.yaml` otherwise your pages will not
build and deploy.

### QR Code generation

The [quarto-qrcode](https://github.com/jmbuhr/quarto-qrcode) extension is particularly useful as it simplifies
generating and embedding [QR Codes](https://en.wikipedia.org/wiki/QR_code) that link to websites in your slides.

### Clean Theme

The [quarto-revealjs-clean](https://github.com/grantmcdermott/quarto-revealjs-clean/) theme is a nice (clean!)
theme. For a full example of all the features of this theme see the authors
[quarto-revealjs-clean-demo](https://github.com/grantmcdermott/quarto-revealjs-clean-demo).

### Confetti

The [confetti](https://github.com/ArthurData/quarto-confetti) extension adds some eye-candy and throws confetti over
your slides whenever you press the `c` button. They originate from the mouse location and therefore follow it around.

## Embedding Code

The beauty of Quarto is that it is a literate programming system which means you can embed code that is executed and the
results, whether that is tables, figures, or numbers, can be included in the resulting document. Quarto supports several
languages including perhaps the two of the most popular languages [R](https://www.r-project.org) and
[Python](https://www.python.org).

### R

You will likely have [R](https://www.r-project.org) installed locally along with all the packages that are required (and
perhaps even use reproducible environments using [renv](https://rstudio.github.io/renv/) or
[pak](https://pak.r-lib.org)).

For slides to build and execute your R code correctly you need to enable installation of R and the required packages in
the `.github/workflows/quarto-publish.yaml`. A sample section is already present that should just need un-commenting,
but may need tweaking if you use any packages to manage a reproducible environment.

### Python

Similarly with Python you likely have Virtual Environments configured locally to run your Python code, and these should
have be detailed in a `requirements.txt` file so they can be installed when the GitHub Workflow is executed to build
your pages on GitHub.

You will need to enable installation of Python and these packages in the `.github/workflows/quarto-publish.yaml` and
a sample section is already present that can be un-commented if required.
7 changes: 7 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
project:
type: website

website:
title: "<TITLE>"
site-url: https://<YOUR_GITHUB_USERNAME>.github.io/<NAME_OF_REPOSITORY
description: "<DESCRIPTION>"
Binary file added img/OSC_Sheffield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d41868f

Please sign in to comment.