DOCUMENTATION / EXAMPLES
Learn by doing.
Small examples, ready to copy into a .slidedeck file.
Each SlideDeck example below is a complete presentation. Save it as talk.slidedeck, then compile or preview it using the getting-started guide. Use the copy button, or select the text manually. Each preview is generated from the example; use its controls to advance slides or fragments. Read the notes for assets, internet access and other prerequisites.
New to SlideDeck? Build one presentation step by step before exploring these examples.
Slides and text
Metadata, headings and formatting
Metadata is optional; when present, put author then title first. Separate slides with ===. Use up to three heading levels.
{
author: "Ada"
title: "My first deck"
theme: "white"
}
===
# Welcome
This is **bold**, *italic*, and __underlined__.
===
## Next slide
### A smaller heading
// This comment is not shown
Comments can also use /* ... */ across multiple lines. Put comments on separate lines; inline comment markers in slide text remain visible.
Lists and quotes
Indent a child marker at least to the start of its parent's text. List items are single-line.
# Things to do
- Plan
- Gather ideas
- Make a draft
1. Rehearse
2. Present
> Keep the message clear.
Tables
Write a header and a delimiter row with the same number of cells. Colons align columns left, right or center; outer pipes are optional, but the header must contain a pipe. Escape a literal pipe with \|.
# Results
| Name | Score | Status |
| :--- | ----: | :----: |
| **Ada** | 42 | Ready |
| Grace | 37 | A \| B |
Cells support inline formatting. Rows continue until a blank line or another slide element. Missing cells are empty and extra cells are ignored. Tables can also appear inside styled blocks and fragments.
Links and QR codes
Links use ![label] "destination"; images use parentheses instead. The special QR label generates an image from an online QR service.
# Find out more
Read ![the SlideDeck repository] "https://github.com/jdeantoni/SlideDeck".
![QR] "https://github.com/jdeantoni/SlideDeck"
Links can also use mailto:, relative paths or fragments. Check relative links in the generated HTML.
Inline styles, notes and footnotes
Use an inline span for part of a line. Hover notes use the browser's native tooltip and may not be accessible to keyboard or touch users.
# Explain a concept
This is [important]{color: 'red'; font-weight: 'bold'}.
[Hover here]{note: 'More context'} for a note.
[*A term*]{footnote: ['A *styled* explanation']{color: 'blue'}}
Footnote text supports bold, italic and underline; HTML is escaped, and links and inline spans are not interpreted. Spaces or tabs are allowed between a reference's ] and {. Styled footnote text can contain matching quotes; escape a quote with \ if it could be mistaken for the closing quote, such as before ] or ; note:. Footnotes appear at the end of the slide, even if their reference is inside an unrevealed fragment. Inline styles apply to a span, not to the containing list item.
Styles and layout
Styled blocks and list width
Block styles use CSS properties. Close styled and animated blocks with ::: end; blocks can be nested. Set a container width to constrain a whole list. In older files, replace block closing ::: or :::: with ::: end; quiz and synchronized-fragment delimiters are unchanged.
# A compact list
::: {width: '50%'; margin: '0 auto'; color: 'teal'}
- First point
- A longer point that wraps within the container
::: end
Use a class such as .callout in a block or inline span and define it in the metadata css field:
{
author: "Ada"
title: "Classes"
css: ".reveal .callout { color: teal; }"
}
===
# Reusable styles
::: {.callout}
This block uses a class.
::: end
This [word]{.callout} uses it too.
Columns and nested blocks
columns and gap create a grid of individual children. Use :::: with nested ::: blocks to group multiple elements in each column.
# Two grouped columns
:::: {.columns}
::: {.column; width: '50%'}
### Left
First group
::: end
::: {.column; width: '50%'}
### Right
Second group
::: end
::: end
# A simple grid
::: {columns: 2; gap: 20}
### One
### Two
::: end
Positioning and transforms
horizontal-margin and vertical-margin position in pixels; calque sets the layer. Transform shortcuts include rotate, scale, translate-x, translate-y and skew.
# Place an element
::: {horizontal-margin: 100; vertical-margin: 200; calque: 2; rotate: -5}
Positioned and rotated
::: end
Images and video
Paste an image in VS Code
With VS Code 1.97 or later, save your SlideDeck file, copy an image or image file, and paste it into the SlideDeck editor with Ctrl+V (or Cmd+V on macOS). The extension stores a copy in an img folder beside the source and inserts a reference such as . Keep that folder with your source file. See the step-by-step guide.
Use an existing image
For this example, put talk.slidedeck in the repository root: the image path points to an image included in the repository. If you installed the extension without cloning the repository, replace the path with your own image or URL.
# An image
{offset: '20px 10px'}{size: '250px 100px'}
Image dimensions and offsets are in slide pixels. Images are embedded during compilation. In a standalone presentation, click a slide image or focus it and press Enter/Space to enlarge it. Use Actual size to zoom and scroll to pan; close with Escape, Close, or a click on the background. Images inside links keep their link behavior; backgrounds, header logos and drawing overlays are excluded. The lightbox is disabled in previews and does not change PDF exports.
For local video, use the same syntax with a video file; the compiler copies it into an assets folder beside the HTML.
# A YouTube video

YouTube playback requires a network connection and permission from the video provider.
This local-video example also assumes the source file is in the repository root. If you installed the extension without cloning the repository, replace the path with your own video.
# A local video

Code and math
Syntax highlighting and progressive steps
Specify the language and optional highlight mode in the opening fence. Modes include all, none, line-by-line, block, function and class. Advance through line-by-line highlights using the presentation controls.
# Code
```javascript [highlight:line-by-line]
const x = 2;
console.log(x);
```
Synchronized fragments
Use [---] between explanations. Add keep after sync-fragments to accumulate them rather than replace them.
# Explain code
```javascript [highlight:line-by-line]
let x = 1;
x += 2;
```
:::[sync-fragments]
Start at one
[---]
Add two
:::[sync-fragments]
Mathematics
Write inline math between dollar signs and use a latex code block for display math. Include a LaTeX block in the presentation to enable math rendering; it loads KaTeX from a CDN.
# Mathematics
Inline: $E = mc^2$
```latex
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
```
Fragments and transitions
Advance to reveal each fragment. Use index: 0 inside the fragment attributes to control ordering. The presentation-wide transition belongs in metadata; a slide can override it at its start.
{
author: "Ada"
title: "Animation"
transition: "none"
}
===
# Reveal ideas
::: {animate: "fade-in"}
First idea
::: end
::: {animate: "fade-in"}
Second idea
::: end
===
{transition: "fade"}
# A different transition
Interactive content
Embedded code editor
Connect an editor to an output by using the same quoted ID. Supported languages are javascript, python and sql. Monaco and execution runtimes require internet access.
# Try JavaScript
,,,ide javascript
```
console.log("Hello!");
```
output: "result"
,,,
output: "result"
Live quiz
Start the quiz server from the project root with npm run quiz-server. It listens on port 4433. Serve the generated presentation over HTTP using a hostname reachable by participants; the quiz connects to that same hostname on port 4433. Opening the HTML directly as a file is not suitable for a shared quiz. See the quiz setup instructions.
:::quiz
"Quick quiz"
showJoinQrCode: true
question: "Which number is even?"
choice "one": "1"
choice "two": "2"
correct: "two"
showResultsOnDemand: true
visualization: barChart
:::
Drawing and visual layout
Presentation chalkboard
Press C for the slide notes canvas or B for the chalkboard; D downloads drawings. This plugin is separate from preview drawings and loads online.
{
author: "Ada"
title: "Draw while presenting"
chalkboard: "true"
}
===
# Draw on this slide
VS Code preview: move, resize and save drawings
Open the native preview in a trusted workspace. Select Edit layout to drag images or styled blocks; select an image and drag its corner to resize it. Shift preserves proportions while resizing. Draw lets you create pen strokes, arrows, rectangles and ellipses; Save fragments stores each as an SVG and a fragment in the source.
In layout mode drag the visible bounds of a saved drawing or its corner to move or resize it. These are whole-image transforms, not arrow endpoint editing. Save the source file to retain changes. Undo does not delete generated SVG files. Presentation-time dragging is not supported. The preview follows the editor's current slide; double-click non-interactive slide content to return to its source.
Themes and templates
Share a header between presentations
Save a header-only file named shared-header.slidedeck beside your deck:
@template
{
author: "Ada"
theme: "white"
css: ".reveal h1 { color: teal; }"
footer: "true"
}
At the beginning of your presentation, import it and optionally override individual fields. These are two separate files, not a single copyable snippet:
@import "shared-header.slidedeck"
{
title: "My presentation"
}
===
# Welcome
The import path is relative to the presentation. A template contains only a metadata header; @template lets the deck supply a missing author or title. Overrides use the usual metadata order. footer: "true" shows the presentation title and author on every slide. An optional cover-image: "images/cover.jpg" or base64 image data URI adds a centered image below the first slide's content; place both settings after css and before transition. An inherited cover image is relative to the template, while an override and other metadata assets are relative to the deck. Save the deck before importing; the preview reads template changes on the next deck edit or compilation. See the working example.
Select a reveal.js theme through metadata. Starter decks for academic, business, conference, technical and minimal layouts are available in the template directory; copy one as the basis for a presentation.
{
author: "Ada"
title: "Theme example"
theme: "white"
css: ".reveal h1 { color: teal; }"
}
===
# A themed slide
For more detail and complete examples, see the reference and example gallery.