Skip to content

Commit 226a5ce

Browse files
authored
Initial commit
0 parents  commit 226a5ce

File tree

12 files changed

+261
-0
lines changed

12 files changed

+261
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Render presentation and publish to GitHub Pages
2+
3+
# Render presentation with Quarto on all merges to main, all pull requests,
4+
# or by manual workflow dispatch. The build job can be used as a CI check
5+
# that the presentation still renders successfully.
6+
# The deploy step only runs when a release tag is pushed to the main branch
7+
# and actually pushes the generated html to the gh-pages branch
8+
# (which triggers a GitHub pages deployment).
9+
on:
10+
push:
11+
branches:
12+
- main
13+
tags:
14+
- '*'
15+
pull_request:
16+
workflow_dispatch:
17+
18+
jobs:
19+
build:
20+
name: render and publish
21+
permissions:
22+
contents: write
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Check out repository
26+
uses: actions/checkout@v3
27+
28+
- name: Set up Quarto
29+
uses: quarto-dev/quarto-actions/setup@v2
30+
31+
- name: Install python dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install -r requirements.txt
35+
36+
- name: Render Quarto Project
37+
run: |
38+
quarto render index.qmd --to revealjs
39+
40+
- name: Move outputs to build folder
41+
if: github.event_name == 'push' && github.ref_type == 'tag'
42+
run: |
43+
mkdir build
44+
mv index.html build/
45+
mv index_files build/
46+
touch build/.nojekyll
47+
cp -r img build/
48+
49+
- name: Deploy
50+
if: github.event_name == 'push' && github.ref_type == 'tag'
51+
uses: JamesIves/github-pages-deploy-action@v4
52+
with:
53+
folder: build
54+

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
index.html
2+
index_files/
3+
build/
4+
.DS_Store

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2023, SWC/GCNU Neuroinformatics Unit
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# quarto-presentation-template
2+
3+
## Prerequisites
4+
5+
You only need to do these once locally.
6+
* Install [Quarto](https://quarto.org/docs/get-started/)
7+
* Install the [VS Code Quarto extension](https://quarto.org/docs/get-started/hello/vscode.html)
8+
9+
## Create a new presentation
10+
11+
* Click on "Use this template" -> "Create a new repository"
12+
* Choose a repository name that starts with `slides-` (this should help us spot quarto presentation repositories at a glance, especially important if they proliferate)
13+
* Clone the newly created repository and navigate to its root folder
14+
* Create a conda environment with `conda create -n quarto python=3.11`
15+
* Activate the environment with `conda activate quarto`
16+
* `pip install -r requirements.txt`
17+
* If you have additional requirements for your execution environment (e.g. your Python package) add them to `requirements.txt`
18+
* Edit the `index.qmd` file to your liking, using the example slides as a guide.
19+
20+
## Build the presentation locally
21+
22+
You can either:
23+
* Use the VS Code extension's GUI ("Render" button)
24+
* Use the command line:
25+
* `quarto render index.qmd --to revealjs` for reveal.js slides
26+
* `quarto render index.qmd --to html` for a standalone HTML page with embedded resources.
27+
28+
## Deploy the presentation on GitHub Pages
29+
For the first deployment:
30+
* Create an empty `gh-pages` branch:
31+
```sh
32+
git checkout --orphan gh-pages
33+
git reset --hard
34+
git commit --allow-empty -m "fresh and empty gh-pages branch"
35+
git push origin gh-pages
36+
```
37+
* Review the repository Settings/Pages to ensure that deployment is enabled from the `gh-pages` branch.
38+
* Make the first release on GitHub, tagged with a version number (see below for versioning schemes).
39+
40+
For all subsequent deployments:
41+
* Simply make a new release tagged with the appropriate version number. For presentations, we prefer a date-based versioning scheme, e.g. `YY.MM` or `YY.MM.DD`. You are encouraged to include some additional information on location, event, etc. in the release notes. If the release is a work-in-progress, append `dev` to the version tag (`YY.MM.dev`) and tick the "Set as a pre-release" checkbox.
42+
* GitHub actions will take care of the rest (see example deployment [here](https://neuroinformatics-unit.github.io/quarto-presentation-template/#/title-slide))
43+
* Deployed presentations can be found at `https://{USER}.github.io/{REPOSITORY-NAME}/#/title-slide`. For repositories of the neuroinformatics-unit organisation, this redirects to `https://neuroinformatics.dev/{REPOSITORY-NAME}/#/title-slide`

img/bg_logo_wide.png

112 KB
Loading

img/logo_niu_dark.png

4.58 KB
Loading

img/logo_niu_light.png

4.59 KB
Loading

index.qmd

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
title: A template presentation
3+
subtitle: so much fun
4+
author: SWC Neuroinformatics Unit
5+
execute:
6+
enabled: true
7+
format:
8+
revealjs:
9+
theme: [default, niu-dark.scss]
10+
logo: img/logo_niu_dark.png
11+
footer: "Edit this footer | 2023-07-26"
12+
slide-number: c
13+
menu:
14+
numbers: true
15+
chalkboard: true
16+
scrollable: true
17+
preview-links: false
18+
view-distance: 10
19+
mobile-view-distance: 10
20+
auto-animate: true
21+
auto-play-media: true
22+
code-overflow: wrap
23+
highlight-style: atom-one
24+
mermaid:
25+
theme: neutral
26+
fontFamily: arial
27+
curve: linear
28+
html:
29+
theme: [default, niu-dark.scss]
30+
logo: img/logo_niu_dark.png
31+
date: "2023-07-05"
32+
toc: true
33+
code-overflow: scroll
34+
highlight-style: atom-one
35+
mermaid:
36+
theme: neutral
37+
fontFamily: arial
38+
curve: linear
39+
margin-left: 0
40+
embed-resources: true
41+
page-layout: full
42+
my-custom-stuff:
43+
my-reuseable-variable: "I can use this wherever I want in the markdown, and change it in only once place :)"
44+
---
45+
46+
## Contents
47+
48+
Some example slides - [also look at example RevealJS slides in the Quarto docs](https://quarto.org/docs/presentations/revealjs/)
49+
50+
* Non-executable and executable code-blocks
51+
* bullet points with highlighting
52+
* two-column slides
53+
* how to include a slide from a separate MD file
54+
* preview and link to a webpage
55+
56+
## Just a code block, nothing gets executed...
57+
58+
... but there is some fancy highlighting
59+
60+
```{.python code-line-numbers="1|3|4-9"}
61+
from pathlib import Path
62+
63+
home_path = Path.home()
64+
if home_path.exists():
65+
data_path = home_path / "data"
66+
else:
67+
pass
68+
# raise some error maybe?
69+
```
70+
71+
## A code block that's actually executed at render-time
72+
73+
```{python}
74+
#| echo: true
75+
#| code-fold: true
76+
77+
from pathlib import Path
78+
79+
print("Hello world")
80+
```
81+
82+
## You can execute code without showing that you have by using #|echo: false
83+
```{python}
84+
#| echo: false
85+
86+
from pathlib import Path
87+
88+
print("Hello world")
89+
```
90+
91+
{{< include slides/extra_slide.qmd >}}
92+
93+
## An example image
94+
95+
Include an image:
96+
97+
![](img/bg_logo_wide.png){width=900 fig-align=center}
98+
99+
100+
## Link and a preview a webpage:
101+
102+
::: {style="text-align: center; margin-top: 1em"}
103+
[interoperable Python-based tools for computational neuroanatomy](https://brainglobe.info/index.html){preview-link="true" style="text-align: center"}
104+
:::
105+
106+
## Use a variable several times
107+
108+
Variables defined in the metadata is re-useable anywhere
109+
110+
* {{< meta my-custom-stuff.my-reuseable-variable >}}
111+
* {{< meta my-custom-stuff.my-reuseable-variable >}}

niu-dark.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*-- scss:defaults --*/
2+
3+
$body-bg: #1E1E1E !default;
4+
$body-color: #fff !default;
5+
$link-color: #04B46D !default;
6+
$font-family-sans-serif: arial, "open sans", "helvetica neue", helvetica, sans-serif !default;
7+
$mermaid-font-family: arial;
8+
/*-- scss:rules --*/

niu-light.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/*-- scss:defaults --*/
2+
3+
$body-bg: #fff !default;
4+
$body-color: #1E1E1E !default;
5+
$link-color: #03A062 !default;
6+
$font-family-sans-serif: arial, "open sans", "helvetica neue", helvetica, sans-serif !default;
7+
$mermaid-font-family: arial;
8+
/*-- scss:rules --*/

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
jupyter
2+
jupyter-cache

slides/extra_slide.qmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## A slide imported from outside the qmd
2+
3+
This will become an example about how to use a common slide deck for the group.

0 commit comments

Comments
 (0)