Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorTatarnikov authored Nov 5, 2023
0 parents commit 4df2134
Show file tree
Hide file tree
Showing 12 changed files with 248 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/render_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Render presentation and publish to GitHub Pages

# Render presentation with Quarto on all merges to main, all pull requests,
# or by manual workflow dispatch. The build job can be used as a CI check
# that the presentation still renders successfully.
# The deploy step only runs when a release tag is pushed to the main branch
# and actually pushes the generated html to the gh-pages branch
# (which triggers a GitHub pages deployment).
on:
push:
branches:
- main
tags:
- '*'
pull_request:
workflow_dispatch:

jobs:
build:
name: render and publish
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Render Quarto Project
run: |
quarto render index.qmd --to revealjs
- name: Move outputs to build folder
if: github.event_name == 'push' && github.ref_type == 'tag'
run: |
mkdir build
mv index.html build/
mv index_files build/
touch build/.nojekyll
cp -r img build/
- name: Deploy
if: github.event_name == 'push' && github.ref_type == 'tag'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: build

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
index.html
index_files/
build/
.DS_Store
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2023, SWC/GCNU Neuroinformatics Unit

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# quarto-presentation-template

## Prerequisites

You only need to do these once locally.
* Install [Quarto](https://quarto.org/docs/get-started/)
* Install the [VS Code Quarto extension](https://quarto.org/docs/get-started/hello/vscode.html)

## Create a new presentation

* Click on "Use this template" -> "Create a new repository"
* Choose a repository name that ends with `-slides` (this should help as spot quarto presentation repositories at a glance, especially important if they proliferate)
* Clone the newly created repository and navigate to its root folder
* Create a conda environment with `conda create -n quarto python=3.11`
* Activate the environment with `conda activate quarto`
* `pip install -r requirements.txt`
* If you have additional requirements for your execution environment (e.g. your Python package) add them to `requirements.txt`
* Edit the `index.qmd` file to your liking, using the example slides as a guide.

## Build the presentation locally

You can either:
* Use the VS Code extension's GUI ("Render" button)
* Use the command line:
* `quarto render index.qmd --to revealjs` for reveal.js slides
* `quarto render index.qmd --to html` for a standalone HTML page with embedded resources.

## Deploy the presentation on GitHub Pages
* Make a new release on GitHub, tagged with a version number. Include some information on the date, location, event, etc. in the release notes.
* GitHub actions will take care of the rest (see example deployment [here](https://neuroinformatics-unit.github.io/quarto-presentation-template/#/title-slide))
Binary file added img/bg_logo_wide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/logo_niu_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/logo_niu_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
111 changes: 111 additions & 0 deletions index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
---
title: A template presentation
subtitle: so much fun
author: SWC Neuroinformatics Unit
execute:
enabled: true
format:
revealjs:
theme: [default, niu-dark.scss]
logo: img/logo_niu_dark.png
footer: "Edit this footer | 2023-07-26"
slide-number: c
menu:
numbers: true
chalkboard: true
scrollable: true
preview-links: false
view-distance: 10
mobile-view-distance: 10
auto-animate: true
auto-play-media: true
code-overflow: wrap
highlight-style: atom-one
mermaid:
theme: neutral
fontFamily: arial
curve: linear
html:
theme: [default, niu-dark.scss]
logo: img/logo_niu_dark.png
date: "2023-07-05"
toc: true
code-overflow: scroll
highlight-style: atom-one
mermaid:
theme: neutral
fontFamily: arial
curve: linear
margin-left: 0
embed-resources: true
page-layout: full
my-custom-stuff:
my-reuseable-variable: "I can use this wherever I want in the markdown, and change it in only once place :)"
---

## Contents

Some example slides - [also look at example RevealJS slides in the Quarto docs](https://quarto.org/docs/presentations/revealjs/)

* Non-executable and executable code-blocks
* bullet points with highlighting
* two-column slides
* how to include a slide from a separate MD file
* preview and link to a webpage

## Just a code block, nothing gets executed...

... but there is some fancy highlighting

```{.python code-line-numbers="1|3|4-9"}
from pathlib import Path
home_path = Path.home()
if home_path.exists():
data_path = home_path / "data"
else:
pass
# raise some error maybe?
```

## A code block that's actually executed at render-time

```{python}
#| echo: true
#| code-fold: true
from pathlib import Path
print("Hello world")
```

## You can execute code without showing that you have by using #|echo: false
```{python}
#| echo: false
from pathlib import Path
print("Hello world")
```

{{< include slides/extra_slide.qmd >}}

## An example image

Include an image:

![](img/bg_logo_wide.png){width=900 fig-align=center}


## Link and a preview a webpage:

::: {style="text-align: center; margin-top: 1em"}
[interoperable Python-based tools for computational neuroanatomy](https://brainglobe.info/index.html){preview-link="true" style="text-align: center"}
:::

## Use a variable several times

Variables defined in the metadata is re-useable anywhere

* {{< meta my-custom-stuff.my-reuseable-variable >}}
* {{< meta my-custom-stuff.my-reuseable-variable >}}
8 changes: 8 additions & 0 deletions niu-dark.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*-- scss:defaults --*/

$body-bg: #1E1E1E !default;
$body-color: #fff !default;
$link-color: #04B46D !default;
$font-family-sans-serif: arial, "open sans", "helvetica neue", helvetica, sans-serif !default;
$mermaid-font-family: arial;
/*-- scss:rules --*/
8 changes: 8 additions & 0 deletions niu-light.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*-- scss:defaults --*/

$body-bg: #fff !default;
$body-color: #1E1E1E !default;
$link-color: #03A062 !default;
$font-family-sans-serif: arial, "open sans", "helvetica neue", helvetica, sans-serif !default;
$mermaid-font-family: arial;
/*-- scss:rules --*/
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jupyter
jupyter-cache
3 changes: 3 additions & 0 deletions slides/extra_slide.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## A slide imported from outside the qmd

This will become an example about how to use a common slide deck for the group.

0 comments on commit 4df2134

Please sign in to comment.