Quick Start
Add two lines to your HTML and call Slides.init():
<head>
<link rel="stylesheet" href="https://slides.johnsonlee.io/slides.css">
</head>
<body>
<script src="https://slides.johnsonlee.io/slides.js"></script>
<script>
Slides.init({
title: 'My Presentation',
chapters: ['cover', 'chapter-1', 'chapter-2'],
langs: { en: 'EN', zh: '中文' }
});
</script>
</body>
Features
Config
| Property | Type | Required | Description |
|---|---|---|---|
title | string | Yes | Site title for <title> tag |
chapters | string[] | Yes | Markdown filenames without .md |
langs | { code: label } | No | Language map, e.g. { en: 'EN', zh: '中文' } |
reveal | object | No | Override Reveal.js init options |
Content Structure
Markdown files are loaded from src/{lang}/{chapter}.md:
src/
en/
cover.md
chapter-1.md
chapter-2.md
zh/
cover.md
chapter-1.md
chapter-2.md
Images & i18n
The framework only rewrites paths for chapter markdown files. Image paths inside markdown are not rewritten.
For language-neutral images, use a shared assets/ directory:

For language-specific images (e.g. SVGs with translated labels), put them in src/{lang}/images/ with the same filename. Each language's markdown references its own path:
src/
en/
images/
bubble-sort.svg <- English labels
chapter-3.md <- 
zh/
images/
bubble-sort.svg <- Chinese labels
chapter-3.md <- 
CSS Customization
Override the accent color with CSS custom properties:
:root {
--slides-accent: #e7ad52;
--slides-accent-rgb: 231, 173, 82;
}
Auto-Layout
The JS engine inspects each slide after Markdown rendering and applies the best layout automatically:
1. Centered
Heading + at most one line, no list/table/image. Auto or via <!-- .slide: class="center" -->.
2. Heading + Short List
Single list with ≤ 8 items stretches to fill space, items evenly spaced.
3. Heading + Long List
Lists with > 8 items auto-split into ceil(N/8) columns.
4. Heading + Table
Table fills available width below the heading.
5. Heading + Image
Image centered in remaining space below the heading.
6. Multi-Block
Multiple content blocks get automatic vertical spacing.
LaTeX Support
Inline math with $...$ or \(...\):
The loss function is $L = -\sum p(x) \log q(x)$.