On this page ▾
Syntax
A deck is one markdown file. Everything else in this guide is a feature you switch on from inside it.
Slides
A line with only --- separates slides. A block of YAML between two --- lines at the top of a slide is that slide's frontmatter.
---
title: My talk
---
# First slide
---
layout: center
class: text-red-500
---
# Second slide
The frontmatter of the first slide is the headmatter. It describes the whole deck: title, theme, transition, export settings, and so on. The keys of both are in Headmatter and frontmatter.
If you set nothing, the first slide uses the cover layout and every other slide uses default.
Notes
The last HTML comment of a slide is its speaker note. It is stored with the slide and shown in the presenter view, never on the slide.
# Slide
<!-- This text is a note. -->
Links
As in Slidev, a markdown link to a slide moves inside the deck, and a link to a web page opens a new tab:
[go to slide 5](5), or [5](/5), [5](./5), [5](#/5)
[pricing](/pricing) goes to the slide with routeAlias: pricing
[results](#results) goes to a heading of this slide
[the docs](https://example.org) opens in a new tab
- An address of only digits, or
/,./or#/followed by a slide number or arouteAlias, becomes a<slide-ng-link>. A click moves to that slide without loading the page again, with history or hash routing, a base or an offline folder. Ctrl or Cmd + click opens it in a new tab. A number past the last slide goes to the last slide. An alias may be any name, also./caféor./My%20Alias. - Other addresses that start with
/or./, such as/file.pdfor a name that is norouteAlias, stay plain links. - The generator warns, naming the slide, about a number past the last slide (
[far](99)), a./nameor#/namethat is norouteAlias, and a link to the alias of a slide withhide:. A/nameis not warned about, since it may be a page of the site. #idand./#idscroll to that element of the slide.#5is such an anchor too: write5or#/5for slide 5.- An
http:orhttps:address getstarget="_blank" rel="noopener".mailto:and other links stay as they are. To open a web page in the same tab, write the link as HTML:<a href="https://example.com">x</a>is left as written. - An
<a>written as HTML whosehrefis a slide (<a href="/3">, also./3,#/3or an alias) becomes a<slide-ng-link>too. It keeps itsclass,idandstyle. With other attributes, such astarget, it is left as written, with a warning that names its line, because it does not reach the slide with hash routing, a base or offline.<slide-ng-link to="4">always works. - In speaker notes a web page opens a new tab too. A link to a slide moves the presenter to that slide, see Speaker notes.
- In an exported PDF a link to a slide points at that slide's page, see Export.
The differences with Slidev are on the differences page.
Slots
A line with only ::name:: starts a named part of the slide, which a layout can place somewhere:
---
layout: two-cols
---
# Left, the default part
::right::
# Right
See Slots.
Importing slides
src: in a slide's frontmatter replaces the slide with the slides of another file. See Importing slides.
Per-slide styles
A <style> block in a slide applies to that slide only. See Scoped styles.
Code and math
Fenced code is highlighted while the deck is generated. Math uses $...$ and $$ ... $$. Diagrams are mermaid and plantuml fences. Pages for each: Code, Diagrams and math.
Angular syntax
Interpolation, control flow and your own components work in a slide. Read Angular in markdown for the few rules that keep the markdown converter from breaking your template.
Errors and warnings
Messages start with the file and line they are about (slides.md:12: ...), or with the slide ([slides] slide 4: ...). A warning keeps the deck running, and an error stops the build. In the dev server a red banner or Angular's error overlay shows the message, the same after a reload as in the terminal, and the last good slides stay on screen until the file is fixed.
- A mistyped name gets the nearest real one:
layout: image-rigthgets "Did you mean "image-right"?", and so do<slide-ng-tocc />,slide-ng-clikand a component tag one or two letters away from one of yours. Any unknownslide-ng-*name is a warning. - Angular's own errors name the slide and the line of the markdown they are on.
- An element left open, such as a
<div>without</div>, a closing tag with another name, or a closing tag that closes nothing, stops the build with a message that names the slide and the tag. - The usual YAML slips in a frontmatter are said in plain words, with the line: a value with
:in it (quote it,title: "Part 2: the plan"), a tab (YAML needs spaces), a quote that is never closed, and a missing closing---. A heading that became a YAML comment because the closing---is missing gets a warning too.
Formatting the file
slide-ng format tidies spacing and rewrites the frontmatter as clean YAML. See Formatting.