diff --git a/.github/workflows/render_and_deploy.yml b/.github/workflows/render_and_deploy.yml new file mode 100644 index 0000000..6319311 --- /dev/null +++ b/.github/workflows/render_and_deploy.yml @@ -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 + \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c856cd0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +index.html +index_files/ +build/ +.DS_Store diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..33c624a --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..446737f --- /dev/null +++ b/README.md @@ -0,0 +1,43 @@ +# 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 starts with `slides-` (this should help us 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 +For the first deployment: +* Create an empty `gh-pages` branch: + ```sh + git checkout --orphan gh-pages + git reset --hard + git commit --allow-empty -m "fresh and empty gh-pages branch" + git push origin gh-pages + ``` +* Review the repository Settings/Pages to ensure that deployment is enabled from the `gh-pages` branch. +* Make the first release on GitHub, tagged with a version number (see below for versioning schemes). + +For all subsequent deployments: +* 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. +* GitHub actions will take care of the rest (see example deployment [here](https://neuroinformatics-unit.github.io/quarto-presentation-template/#/title-slide)) +* 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` diff --git a/img/bg_logo_wide.png b/img/bg_logo_wide.png new file mode 100644 index 0000000..7abb83c Binary files /dev/null and b/img/bg_logo_wide.png differ diff --git a/img/logo_niu_dark.png b/img/logo_niu_dark.png new file mode 100644 index 0000000..324b1bc Binary files /dev/null and b/img/logo_niu_dark.png differ diff --git a/img/logo_niu_light.png b/img/logo_niu_light.png new file mode 100644 index 0000000..efba940 Binary files /dev/null and b/img/logo_niu_light.png differ diff --git a/index.qmd b/index.qmd new file mode 100644 index 0000000..43919ff --- /dev/null +++ b/index.qmd @@ -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 >}} diff --git a/niu-dark.scss b/niu-dark.scss new file mode 100644 index 0000000..932b3b1 --- /dev/null +++ b/niu-dark.scss @@ -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 --*/ diff --git a/niu-light.scss b/niu-light.scss new file mode 100644 index 0000000..84b6395 --- /dev/null +++ b/niu-light.scss @@ -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 --*/ \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..d4424c2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +jupyter +jupyter-cache diff --git a/slides/extra_slide.qmd b/slides/extra_slide.qmd new file mode 100644 index 0000000..1d699ad --- /dev/null +++ b/slides/extra_slide.qmd @@ -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. \ No newline at end of file