Skip to content

Commit f56488c

Browse files
authored
Initial commit
0 parents  commit f56488c

36 files changed

Lines changed: 2933 additions & 0 deletions

.github/workflows/render.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
on:
2+
workflow_dispatch:
3+
push:
4+
branches: main
5+
6+
name: Quarto Publish
7+
8+
jobs:
9+
build-deploy:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Check out repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Quarto
18+
uses: quarto-dev/quarto-actions/setup@v2
19+
env:
20+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
tinytex: true
23+
- name: Install Python and Dependencies
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.10'
27+
cache: 'pip'
28+
- run: pip install jupyter
29+
- run: pip install -r requirements.txt
30+
- name: Remove .onlyteacher blocks from .qmd files
31+
run: |
32+
for file in Week*/*.qmd; do
33+
[ -f "$file" ] || continue # Skip if not a regular file
34+
sed -i '/::: {.onlyteacher}/,/:::/d' "$file"
35+
done
36+
- name: Render Book and Slides
37+
run: |
38+
quarto render --profile book
39+
- name: Build PDFs from slides
40+
run: |
41+
python3 -m http.server 8000 &
42+
find ./_slides -name 'slides.html' | while read slide; do
43+
echo "Converting $slide to PDF"
44+
pdf_path="${slide%.html}.pdf"
45+
relative_slide_path="${slide#./}"
46+
url_path="/slides/$relative_slide_path"
47+
# Output path inside container: use /tmp
48+
tmp_pdf_name="$(basename "$pdf_path")"
49+
tmp_pdf_path="/tmp/$tmp_pdf_name"
50+
clean_slide=$(echo "$slide" | sed 's|^\./||')
51+
echo "http://localhost:8000/$clean_slide"
52+
docker run --rm -t --network=host -v "$(pwd)":/slides -v /tmp:/tmp astefanutti/decktape "http://localhost:8000/$clean_slide" "$tmp_pdf_path"
53+
cp "/tmp/$tmp_pdf_name" "$pdf_path"
54+
done
55+
- name: Deploy _book to gh-pages
56+
uses: peaceiris/actions-gh-pages@v4
57+
with:
58+
github_token: ${{ secrets.GITHUB_TOKEN }}
59+
publish_dir: ./_book
60+
publish_branch: gh-pages
61+
keep_files: true
62+
63+
- name: Deploy _slides to gh-pages (subfolder)
64+
uses: peaceiris/actions-gh-pages@v4
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
publish_dir: ./_slides
68+
publish_branch: gh-pages
69+
destination_dir: slides
70+
keep_files: true

.quarto/project-cache/deno-kv-file

36 KB
Binary file not shown.

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
s# Markdown Slide Master
2+
3+
This repository contains a template for creating slides and books using Quarto. It is designed to be used as a starting point for your own courses in HES-SO Valais-Wallis style.
4+
5+
The repository includes Continous Integration (CI) configuration for automatic deployment of the book and slides to GitHub Pages.
6+
The individual GitHub Pages should then be linked on moodle.
7+
8+
The output generated by this template is available at [https://duerrsimon.github.io/hevs-quarto/](https://duerrsimon.github.io/hevs-quarto/).
9+
10+
11+
## How to use this template
12+
1. Create a new repository from this template on GitHub
13+
2. Either locally or on Github, edit the `quarto.yml` file to set the title, author, and other metadata for your course.
14+
3. Edit the `index.qmd` file to provide an overview of your course.
15+
4. Edit the `_quarto-book.yml` file to set the book title, author, and other metadata. Also add your course structure in the `chapters` section.
16+
5. Modify the `base_url` in `_variables.yml`. it should be `githubusername.github.io/reponame/`
17+
6. Add your course content in the `Week1`, `Week2`, etc. directories, following the structure of the provided example.
18+
19+
The quarto documentation is available at [https://quarto.org/docs/](https://quarto.org/docs/).
20+
21+
Note that you can exempt certain parts of the document to show up in the public material by using
22+
23+
```
24+
::: {.onlyteacher}
25+
Your content here
26+
:::
27+
```
28+
29+
30+
## How to locally preview and render the book and slides
31+
For course development, you can preview and render the book and slides locally using Quarto. For production use and deployment, it is recommended to use the CI/CD pipeline provided in this repository.
32+
33+
#### Install Quarto
34+
Follow the instructions at [https://quarto.org/docs/get-started/](https://quarto.org/docs/get-started/) to install Quarto on your system.
35+
36+
#### Live preview of a single slide set
37+
```
38+
quarto preview Week1/slides.md
39+
```
40+
41+
#### Live preview of the book
42+
```
43+
quarto preview --profile book
44+
```
45+
46+
#### Generate book and slides locally
47+
```
48+
quarto render --profile book
49+
```
50+
The files will be generated in the `_book` directory. You can then open the `index.html` file in your browser to view the book.
51+
The slides will be generated in the `_slides` folder.
52+
53+
Additionally a PDF of the book will be generated.
54+
55+
GitHub Actions will automatically also generate a PDF version of the slides.
56+

Week1/img/example.webp

236 KB
Loading

Week1/index.qmd

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Week description
2+
3+
Lorem ipsum dolor sit amet. hello.
4+
5+
$$
6+
e=mc^2
7+
$$
8+
9+
[👨🏻‍🏫 Slides]({{< var base_url>}}slides/Week1/slides.html){.btn .btn-outline-primary .btn role="button"}
10+
[Slides PDF]({{< var base_url>}}slides/Week1/slides.pdf){.btn .btn-outline-secondary .btn role="button"}
11+
12+
## Exercise with Inline Solution accessible to the students
13+
```{pyodide}
14+
#| exercise: ex_1
15+
16+
# square each number
17+
for x in range(5):
18+
print(______)
19+
```
20+
21+
::: {.solution exercise="ex_1"}
22+
23+
```
24+
# square each number
25+
for x in range(5):
26+
print(x**2)
27+
```
28+
:::
29+
30+
31+
## Solution only visible in the teacher version
32+
33+
::: {.onlyteacher}
34+
```{python}
35+
# square each number
36+
for x in range(5):
37+
print(x**2)
38+
```
39+
:::

Week1/slides.qmd

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: "Coursetitle"
3+
subtitle: "Week title"
4+
format:
5+
live-revealjs:
6+
slide-number: true
7+
brand: ../_brand.yml
8+
theme: ../hevs.scss
9+
show-slide-number: all
10+
preview-links: auto
11+
chalkboard: true
12+
logo: https://www.hevs.ch/_nuxt/img/logo_hesso.9af1d79.svg
13+
footer: "Coursetitle"
14+
---
15+
16+
## Slide 1 Title
17+
18+
- Point 1
19+
- Point 2
20+
21+
22+
## Images
23+
24+
![Example img](img/example.webp)
25+
26+
27+
## Interactive Code
28+
29+
```{pyodide}
30+
#| exercise: ex_1
31+
32+
# square each number
33+
for x in range(5):
34+
print(______)
35+
```
36+
37+
[More documentation on Live Code](https://r-wasm.github.io/quarto-live/)
38+
39+
## Line Highlighting
40+
41+
```{.python code-line-numbers="6-8"}
42+
import numpy as np
43+
import matplotlib.pyplot as plt
44+
45+
r = np.arange(0, 2, 0.01)
46+
theta = 2 * np.pi * r
47+
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
48+
ax.plot(theta, r)
49+
ax.set_rticks([0.5, 1, 1.5, 2])
50+
ax.grid(True)
51+
plt.show()
52+
```
53+
54+
55+
## Line Higlighting with animation
56+
57+
```{.python code-line-numbers="|6|9"}
58+
import numpy as np
59+
import matplotlib.pyplot as plt
60+
61+
r = np.arange(0, 2, 0.01)
62+
theta = 2 * np.pi * r
63+
fig, ax = plt.subplots(subplot_kw={'projection': 'polar'})
64+
ax.plot(theta, r)
65+
ax.set_rticks([0.5, 1, 1.5, 2])
66+
ax.grid(True)
67+
plt.show()
68+
```
69+
70+
## Multiple columns
71+
72+
:::: {.columns}
73+
74+
::: {.column width="40%"}
75+
Left column
76+
:::
77+
78+
::: {.column width="60%"}
79+
Right column
80+
:::
81+
82+
::::
83+
84+
85+
## Aside
86+
87+
- Green ^[A footnote]
88+
- Brown
89+
- Purple
90+
91+
::: aside
92+
Some additional commentary of more peripheral interest.
93+
:::

Week2/index.qmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Week title
2+
3+
Lorem ipsum dolor sit amet.
4+
5+
[Slides](https://duerrsimon.github.io/hevs-quarto/slides/Week2/slides.html){.btn .btn-outline-primary .btn role="button"}
6+
[Slides PDF](https://duerrsimon.github.io/hevs-quarto/slides/Week2/slides.pdf){.btn .btn-outline-secondary .btn role="button"}

Week2/slides.qmd

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "Coursetitle"
3+
subtitle: "Week title"
4+
format:
5+
live-revealjs:
6+
slide-number: true
7+
brand: ../_brand.yml
8+
theme: ../hevs.scss
9+
show-slide-number: all
10+
preview-links: auto
11+
chalkboard: true
12+
logo: https://www.hevs.ch/_nuxt/img/logo_hesso.9af1d79.svg
13+
footer: "Coursetitle"
14+
---
15+
16+
## Slide 1 Title
17+
18+
- Point 1
19+
- Point 2
20+
21+
## Slide 2 Title
22+
23+
Lorem ipsum dolor sit amet.
24+

_brand.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
color:
2+
palette:
3+
dark-grey: "#222222"
4+
blue: "#ddeaf1"
5+
background: white
6+
foreground: dark-grey
7+
primary: black
8+
9+
logo:
10+
medium: img/hesso.svg
11+
12+
typography:
13+
fonts:
14+
- family: Inter
15+
source: google
16+
- family: Barlow
17+
source: google
18+
base: Barlow
19+
headings: Inter
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
title: Quarto Live
2+
author: George Stagg
3+
version: 0.1.3-dev
4+
quarto-required: ">=1.4.0"
5+
contributes:
6+
filters:
7+
- live.lua
8+
formats:
9+
common:
10+
ojs-engine: true
11+
filters:
12+
- live.lua
13+
html: default
14+
revealjs: default
15+
dashboard: default

0 commit comments

Comments
 (0)