Generate HTML slides from Markdown files
If you want to build the slides locally, Node or Docker is required.
Create one (README.md) or more markdown files in the root of your directory (e.g. a git repository) and start typing.
To start a new slide use a comment <!-- slide -->.
Example:
# Lecture Title
@module[123456]
@semester[Summer 2025]
Korbinian Kuhn [kuhnko@](mailto:kuhnko@hdm-stuttgart.de)
<!-- slide -->
## Content
- What we will do
- What you will learn
Build the slides with Node:
npx @korbiniankuhn/markdown-slides
Or with Docker:
docker run --rm -v "$(pwd)":/app -w /app node:alpine sh -c "npx @korbiniankuhn/markdown-slides"
Serve slides (you can also open the index.html file locally, but you might run into CORS issues e.g. for MathJax):
npx http-server -c-1 public
Updating to a new version? The changelog lists upgrade notes with commands to find the places in your slides that need changes.
Convert current directory to slides into a output directory public:
npx @korbiniankuhn/markdown-slides
Only use certain files and directories of the input directory, by name or with glob patterns like in .gitignore. Quote patterns with *, so the shell passes them on:
npx @korbiniankuhn/markdown-slides --allowed-files README.md 'chapter-*.md' images '*.css'
npx @korbiniankuhn/markdown-slides --ignored-files '*.pdf' drafts/
CLI arguments:
| Argument | Description | Default | Required |
|---|---|---|---|
-i, --in |
Input directory | . | false |
-o, --out |
Output directory | public | false |
-l, --language |
en or de: language of the page and its texts (buttons, labels for screen readers, alerts), and the default institution |
en | false |
--institution |
Custom institution name | undefined | false |
--title |
Lecture title for the back link on sub-pages, otherwise the first headline is used | undefined | false |
--toc-numbering |
Number the headings, true or false |
true | false |
--allowed-files |
Only use files and directories of the input directory that match these names or patterns | undefined | false |
--ignored-files |
Ignore files and directories that match these names or patterns (dotfiles are always ignored) | undefined | false |
Everything before the first <!-- slide --> is the title slide:
# Lecture Title
@module[123456]
@semester[Summer 2026]
Jane Doe [jane@](mailto:jane@example.com)
# heading is the title of the page, and of the lecture on sub-pages (or --title)@module[…] and @semester[…] are shown as labels--institution, the date of the build is added automatically| Identifier | Description |
|---|---|
<!-- slide --> |
Starts a new slide, on a line of its own |
## Heading |
Numbered and listed in the table of contents |
### Heading |
Numbered and listed in the table of contents |
<!-- comment --> |
Other comments are removed, e.g. notes for you |
All of GitHub Flavored Markdown works, e.g. tables, task lists and strikethrough.
| Identifier | Description |
|---|---|
:spacer |
Medium vertical spacer |
:spacer{size=sm} |
Small vertical spacer |
:spacer{size=md} |
Medium vertical spacer |
:spacer{size=lg} |
Large vertical spacer |
:spacer{size=xl} |
Extra-Large vertical spacer |
| Identifier | Description |
|---|---|
<!-- row --> |
Starts a row container |
<!-- row:end --> |
Ends a row container |
<!-- col --> |
Starts a col container |
<!-- col:end --> |
Ends a col container |
Columns have the same width. On phones, they are shown below each other.
<!-- row -->
<!-- col -->
Left
<!-- col:end -->
<!-- col -->
Right
<!-- col:end -->
<!-- row:end -->
Set the width and alignment of an image or video with an attribute block directly after it. The alt text stays as it is.
| Attribute | Values | Default |
|---|---|---|
width |
Percentage or pixels, e.g. 70% or 400px |
Original size |
align |
left, center or right |
center |
{width=70% align=left}
{width=50%}
.mp4 and .webm files are shown as videos. The alt text describes the image or video for screen readers; without one, the build warns. Invalid attributes stop the build.
Code blocks are highlighted with highlight.js when the language is set, and have a button to copy the code:
def greet(name):
return f"Hello {name}!"
Long lines scroll sideways on the slide and wrap when printed.
README.md is index.html (required), chapter-1.md is chapter-1.html[Chapter 1](chapter-1.md). Sub-pages link back to index.html with the lecture title.images, are copied as they are, so relative links keep workingHighlight a note, tip or warning like on GitHub. The title follows --language.
> [!TIP]
> Build the slides locally before you push.
Tip
Build the slides locally before you push.
Also available: [!NOTE], [!IMPORTANT], [!WARNING] and [!CAUTION].
Footnotes1 are shown at the bottom of the slide that refers to them, and numbered per slide.
Footnotes[^footnotes] are shown at the bottom of the slide.
[^footnotes]: Defined anywhere in the file.
Defined anywhere in the file, like on GitHub. ↩
LaTex equations are converted to equations with MathJax, including all accessibility features:
Centered Math (\\[ ... \\]):
\[ x = {-b \pm \sqrt{b^2-4ac} \over 2a} \]
Inline Math (\\( ... \\)):
\( x = {-b \pm \sqrt{b^2-4ac} \over 2a} \)
Mermaid is supported, fits in nicely with the colors of the theme and automatically reacts to the light or dark mode:
sequenceDiagram
Alice->>John: Hello John, how are you?
John-->>Alice: Great!
Alice-)John: See you later!| Key | Action |
|---|---|
| Right arrow, Page Down, Space | Next slide |
| Left arrow, Page Up | Previous slide |
Print the page in the browser (e.g. Ctrl+P, or Cmd+P on a Mac) and choose "Save as PDF":
## heading starts a new page, and pages use the light themeOverride the default theme with these files in the root of your project:
| File | Use |
|---|---|
logo-light.svg and logo-dark.svg |
Logos for the light and dark theme |
favicon.ico |
Icon in the browser tab |
*.css |
Styles, included in every page |
*.js |
Scripts, included in every page |
Setting the primary color is usually enough. In the dark theme, it is lightened where needed, so text stays readable:
:root {
--color-primary: blue;
}
Add a .gitlab-ci.yml to your repository. Every push to the default branch publishes the slides:
pages:
image: node:lts-alpine
script:
- npx @korbiniankuhn/markdown-slides -o public
artifacts:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Add CLI parameters to the npx line, e.g. --language de. Pin a version (@korbiniankuhn/markdown-slides@1.0.0) to update on your own schedule.
Set Settings → Pages → Source to GitHub Actions, and add .github/workflows/slides.yml:
name: Slides
on:
push:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: lts/*
- run: npx @korbiniankuhn/markdown-slides -o public
- uses: actions/upload-pages-artifact@v5
with:
path: public
- id: deployment
uses: actions/deploy-pages@v5