Marp

How to write slides

Markdown

To write slides using Marp, you have to know basic Markdown syntax. It doesn't take long to learn the basics, and there are many Markdown tutorials on the internet, so this guide will focus on the additional syntax used by Marp that allows you to write slides.

Resources for learning Markdown

Slides

OK, let's write presentation slides. Marp splits slides in the deck using the horizontal ruler (e.g. ---).

  1. # Slide 1

  2. Hello, world!

  3. ---

  4. # Slide 2

  5. Marp splits slides in the deck by horizontal ruler.

If you use the --- ruler, an empty line may be required before the ruler by the spec of CommonMark. If you do not want to add empty lines around the ruler, you can also use the underline ruler ___, asterisk ruler ***, or space-included ruler - - - to split slides.

This feature is inherited from Marpit framework.

Syntaxes

Marp's Markdown syntax is based on CommonMark. In addition, Marp uses some extended syntax:

  • Line breaks in a paragraph will convert to <br /> tag automatically.
    • You also can use <br /> tag directly (Useful if you need a line break within a fitting header).
  • There is special meaning in some (uncommon) list markers * and 1). ▶️ Fragmented list.
  • Some extended syntaxes that came from GitHub Flavored Markdown (GFM) are enabled:
  • Most HTML tags are disabled by default for security reasons. Marp only allows users to use two tags by default: the <style> tag for tweaking the theme and the <br /> tag mentioned earlier.
    • To enable all HTML tags, you need to opt-in for the Marp tool you are using.

Many extended syntaxes are inherited from Marp Core.