Skip to content

Commit eac6cae

Browse files
author
René Fritze
committed
A new start
1 parent 55bc8c7 commit eac6cae

39 files changed

+6755
-1
lines changed

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text eol=lf
2+
3+
*.png binary

.github/dependabot.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
# Configuration: https://dependabot.com/docs/config-file/
3+
# Docs: https://docs.github.com/en/github/administering-a-repository/keeping-your-dependencies-updated-automatically
4+
5+
version: 2
6+
7+
updates:
8+
- package-ecosystem: github-actions
9+
directory: .github
10+
schedule:
11+
interval: weekly
12+
allow:
13+
- dependency-type: all
14+
commit-message:
15+
prefix: ':arrow_up:'
16+
open-pull-requests-limit: 50
17+
18+
- package-ecosystem: npm
19+
directory: "{{cookiecutter.directory_name}}"
20+
schedule:
21+
interval: weekly
22+
allow:
23+
- dependency-type: all
24+
commit-message:
25+
prefix: ':arrow_up:'
26+
open-pull-requests-limit: 50
27+
28+
29+
- package-ecosystem: github-actions
30+
directory: "{{cookiecutter.directory_name}}/.github"
31+
schedule:
32+
interval: weekly
33+
allow:
34+
- dependency-type: all
35+
commit-message:
36+
prefix: ':arrow_up:'
37+
open-pull-requests-limit: 50

.github/workflows/bot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
name: Dependabot auto-merge
3+
on: pull_request
4+
5+
permissions:
6+
pull-requests: write
7+
contents: write
8+
9+
jobs:
10+
dependabot:
11+
runs-on: ubuntu-latest
12+
if: ${{ github.actor == 'dependabot[bot]' }}
13+
steps:
14+
- name: Dependabot metadata
15+
id: metadata
16+
uses: dependabot/[email protected]
17+
with:
18+
github-token: ${{ secrets.GITHUB_TOKEN }}
19+
- name: Enable auto-merge for Dependabot PRs
20+
run: gh pr merge --auto --merge "$PR_URL"
21+
env:
22+
PR_URL: ${{github.event.pull_request.html_url}}
23+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
name: build
3+
4+
on: [push, pull_request]
5+
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: '16'
15+
- uses: astral-sh/setup-uv@v5
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install cookiecutter build
19+
git config --global user.email "[email protected]"
20+
git config --global user.name "Your Name"
21+
git config --global init.defaultBranch main
22+
23+
- name: with neither git nor pre-commit
24+
run: |
25+
GIT=$(which git)
26+
sudo chmod -x ${GIT}
27+
cookiecutter -v --no-input -f -o /tmp/cookie_reveal . directory_name=foo1
28+
make -C /tmp/cookie_reveal/foo1 install
29+
make -C /tmp/cookie_reveal/foo1
30+
sudo chmod +x ${GIT}
31+
- name: with git only
32+
run: |
33+
cookiecutter -v --no-input -f -o /tmp/cookie_reveal . directory_name=foo2
34+
make -C /tmp/cookie_reveal/foo2 install
35+
make -C /tmp/cookie_reveal/foo2
36+
- name: with git and pre-commit
37+
run: |
38+
python -m pip install pre-commit
39+
cookiecutter -v --no-input -f -o /tmp/cookie_reveal . directory_name=foo3
40+
make -C /tmp/cookie_reveal/foo3 install
41+
make -C /tmp/cookie_reveal/foo3
42+
make -C /tmp/cookie_reveal/foo3 clean
43+
make -C /tmp/cookie_reveal/foo3 pdf

.github/workflows/deploy.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on:
2+
push:
3+
branches:
4+
- "main"
5+
6+
name: Deploy
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
13+
deploy:
14+
runs-on: ubuntu-latest
15+
name: build and upload
16+
steps:
17+
# Checkout the source code so we have some files to look at.
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: '16'
22+
- uses: astral-sh/setup-uv@v5
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install cookiecutter build pre-commit
26+
git config --global user.email "[email protected]"
27+
git config --global user.name "René Fritze"
28+
git config --global init.defaultBranch main
29+
- name: Render cookiecutter
30+
run: cookiecutter -v --no-input -f -o /tmp/ . directory_name=cookie_reveal
31+
- run: make -C /tmp/cookie_reveal install
32+
- run: make -C /tmp/cookie_reveal html
33+
- run: make -C /tmp/cookie_reveal pdf
34+
- name: Deploy
35+
uses: peaceiris/[email protected]
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: /tmp/cookie_reveal/static_html/
39+
- uses: actions/upload-artifact@v4
40+
with:
41+
name: pdf-slides
42+
path: -C /tmp/cookie_reveal/slides/*pdf

.github/workflows/git_checks.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
on: pull_request
3+
4+
name: Git
5+
6+
jobs:
7+
message-check:
8+
name: Block Autosquash Commits
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Block Autosquash Commits
12+
uses: xt0rted/block-autosquash-commits-action@v2
13+
with:
14+
repo-token: ${{ secrets.GITHUB_TOKEN }}
15+
16+
merge_conflict_job:
17+
runs-on: ubuntu-latest
18+
name: Find merge conflicts
19+
steps:
20+
# Checkout the source code so we have some files to look at.
21+
- uses: actions/checkout@v4
22+
# Run the actual merge conflict finder
23+
- name: Merge Conflict finder
24+
uses: olivernybroe/[email protected]

.github/workflows/pre-commit.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.10"
16+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.3.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- id: check-executables-have-shebangs
12+
- id: check-case-conflict
13+
- id: check-symlinks
14+
15+
- repo: https://github.com/psf/black
16+
rev: "22.3.0"
17+
hooks:
18+
- id: black

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
MIT License
22

33
Copyright (c) 2025 René Fritze
4+
Copyright (c) 2017 Richard Wen
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,84 @@
11
# cookiecutter-mkslides
2-
Cookiecutter template for mkslides
2+
3+
Template for [mkslides](https://github.com/MartenBE/mkslides) presentations with Python cookiecutter.
4+
5+
[Demo output](https://rene.fritze.me/cookiecutter-mkslides/)
6+
7+
[![Build Status](https://github.com/renefritze/cookiecutter-mkslides/actions/workflows/build.yml/badge.svg?main)](https://github.com/renefritze/cookiecutter-mkslides/actions/workflows/build.yml)
8+
[![GitHub license](https://img.shields.io/github/license/renefritze/cookiecutter-mkslides.svg)](https://github.com/renefritze/cookiecutter-mkslides/blob/main/LICENSE)
9+
10+
## Install
11+
12+
1. Install [Python](https://www.python.org/downloads/)
13+
2. Install [cookiecutter](https://pypi.python.org/pypi/cookiecutter) via `pip`
14+
15+
```
16+
python3 -m pip install cookiecutter
17+
```
18+
19+
## Usage
20+
21+
1. Create a template using [cookiecutter](https://pypi.python.org/pypi/cookiecutter)
22+
2. Change the directory to the folder with the same name as the `directory_name` input
23+
3. Install dependencies with [npm](https://www.npmjs.com/)
24+
4. Render HTML slides in the `static_html` folder
25+
5. Render PDF slides in the `slides` folder
26+
27+
```
28+
cookiecutter gh:renefritze/cookiecutter-mkslides
29+
cd <directory_name>
30+
make install
31+
make html
32+
make pdf
33+
```
34+
35+
See [Implementation](#implementation) for more details.
36+
37+
## Developer Notes
38+
39+
### Create Github Repository
40+
41+
1. Ensure [git](https://git-scm.com/) is installed
42+
2. Change directory to the generated folder `cd <directory_name>`
43+
3. Initialize the repository
44+
4. Add the generated files to commit
45+
5. Create an empty [Github repository](https://help.github.com/articles/create-a-repo/) with the same name as `directory_name`
46+
6. Pull any changes if the Github repository is not empty
47+
7. Push the commit from `4.` to your created Github repository
48+
49+
```
50+
git init
51+
git add .
52+
git commit -a -m "Initial commit"
53+
git remote add origin https://github.com/<github_user>/<directory_name>.git
54+
git pull origin main --allow-unrelated-histories
55+
git push -u origin main
56+
```
57+
58+
### Implementation
59+
60+
This code creates folders and files for [cookiecutter](https://pypi.python.org/pypi/cookiecutter) templates.
61+
62+
* The main file is [cookiecutter.json](https://github.com/renefritze/cookiecutter-mkslides/blob/main/cookiecutter.json) which defines the inputs for the command line interface
63+
* The inputs then replace any values surrounded with `{{}}` inside the folder [{{cookiecutter.directory_name}}](https://github.com/renefritze/cookiecutter-mkslides/tree/main/%7B%7Bcookiecutter.directory_name%7D%7D)
64+
65+
```
66+
cookiecutter <-- template tool
67+
|
68+
cookiecutter.json <-- template inputs
69+
|
70+
{{cookiecutter.directory_name}} <-- generated template
71+
```
72+
73+
The following files will be created inside a folder with the same name as the `directory_name` input:
74+
75+
File | Description
76+
--- | ---
77+
**slides/<file_name>.md** | [Markdown](https://daringfireball.net/projects/markdown/) file containing the slide contents
78+
**template.html** | A [reveal-md](https://www.npmjs.com/package/reveal-md) custom template file for generating slides
79+
**.gitignore** | A Node [.gitignore](https://git-scm.com/docs/gitignore) automatically generated from github
80+
**.npmignore** | A file to specify ignoring `static_html/*`
81+
**LICENSE** | MIT [license file](https://help.github.com/articles/licensing-a-repository/) automatically created from github
82+
**.github** | [Github Actions](https://github.com/features/actions) workflows for deploying the page to Github Pages
83+
**package.json** | The [npm package.json](https://docs.npmjs.com/files/package.json) specifications with [reveal-md](https://www.npmjs.com/package/reveal-md) and [decktape](https://www.npmjs.com/package/decktape) dependencies
84+
**README.md** | a readme [Markdown](https://daringfireball.net/projects/markdown/) file with header section

0 commit comments

Comments
 (0)