|
1 | 1 | # 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 | +[](https://github.com/renefritze/cookiecutter-mkslides/actions/workflows/build.yml) |
| 8 | +[](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