@marp-team/marp-cli
Try it now!
npx
- ``` shell
- # Convert slide deck into HTML
- npx @marp-team/marp-cli@latest slide-deck.md
- npx @marp-team/marp-cli@latest slide-deck.md -o output.html
- # Convert slide deck into PDF
- npx @marp-team/marp-cli@latest slide-deck.md --pdf
- npx @marp-team/marp-cli@latest slide-deck.md -o output.pdf
- # Convert slide deck into PowerPoint document (PPTX)
- npx @marp-team/marp-cli@latest slide-deck.md --pptx
- npx @marp-team/marp-cli@latest slide-deck.md -o output.pptx
- # Watch mode
- npx @marp-team/marp-cli@latest -w slide-deck.md
- # Server mode (Pass directory to serve)
- npx @marp-team/marp-cli@latest -s ./slides
- ```
ℹ️You have to install Google Chrome or Microsoft Edge to convert slide deck into PDF, PPTX, and image(s).
Docker
Install
Use package manager
macOS: Homebrew
- ``` shell
- brew install marp-cli
- ```
Windows: Scoop
- ``` batchfile
- scoop install marp
- ```
Local installation
ℹ️Marp CLI is working only with actively supported Node.js versions, so Node.js 14 and later is required when installing into your Node.js project.
- ``` shell
- npm install --save-dev @marp-team/marp-cli
- ```
Global installation
- ``` shell
- npm install -g @marp-team/marp-cli
- ```
Standalone binary
Basic usage
Convert to HTML
- ``` shell
- marp slide-deck.md
- ```
- ``` shell
- marp slide-deck.md -o output.html
- ```
Convert to PDF (--pdf)
- ``` shell
- marp --pdf slide-deck.md
- marp slide-deck.md -o converted.pdf
- ```
ℹ️If you want to use Chromium or flavored browsers to convert, you have to specify the path to the browser binary through CHROME_PATH environment variable. For example: CHROME_PATH=$(which brave) marp --pdf slide-deck.md
PDF output options
Convert to PowerPoint document (--pptx)
- ``` shell
- marp --pptx slide-deck.md
- marp slide-deck.md -o converted.pptx
- ```
ℹ️A converted PPTX consists of pre-rendered images. Please note that contents would not be able to modify or re-use in PowerPoint.
Convert to PNG/JPEG image(s)
Multiple images (--images)
- ``` shell
- # Convert into multiple PNG image files
- marp --images png slide-deck.md
- # Convert into multiple JPEG image files
- marp --images jpeg slide-deck.md
- ```
Title slide (--image)
- ``` shell
- # Convert the title slide into an image
- marp --image png slide-deck.md
- marp slide-deck.md -o output.png
- ```
Scale factor
- ``` shell
- # Generate high-resolution image of the title slide
- marp slide-deck.md -o title-slide@2x.png --image-scale 2
- ```
ℹ️--image-scale is not affect to the actual size of presentation.
Export presenter notes (--notes)
- ``` shell
- # Export presenter notes as a text
- marp --notes slide-deck.md
- marp slide-deck.md -o output.txt
- ```
Security about local files
- ``` shell
- marp --pdf --allow-local-files slide-deck.md
- ```
Conversion modes
Watch mode (--watch / -w)
Server mode (--server / -s)
index.md / PITCHME.md
Preview window (--preview / -p)
ℹ️--preview option cannot use when you are using Marp CLI through official docker image.
Template
- ``` shell
- marp --template bespoke slide-deck.md
- ```
bespoke template (default)
Features
ℹ️Presenter view may be disabled if the browser restricted using localStorage (e.g. Open HTML in the old Safari with private browsing, or open the localHTML file with Chrome that has blocked 3rd party cookies in chrome://settings/content/cookies ).
Docs
bare template
Zero-JS slide deck
- ``` shell
- marp --template bare --engine @marp-team/marpit slide-deck.md
- ```
Metadata
Global directives | CLI option | Description | Available in |
---|---|---|---|
:--- | :--- | :--- | |
title | --title | Define title of the slide deck | HTML, PDF, PPTX |
description | --description | Define description of the slide | HTML, PDF, PPTX |
author | --author | Define author of the slide deck | HTML, PDF, PPTX |
keywords | --keywords | Define comma-separated keywords | HTML, PDF |
url | --url | Define canonical URL * | HTML |
image | --og-image | Define Open Graph image URL | HTML |
*: If could not parse a specified value as valid, the URL will be ignored.
By global directives
- ``` gfm
- ---
- title: Marp slide deck
- description: An example slide deck created by Marp CLI
- author: Yuki Hattori
- keywords: marp,marp-cli,slide
- url: https://marp.app/
- image: https://marp.app/og-image.jpg
- ---
- # Marp slide deck
- ```
By CLI option
Theme
Override theme
- ``` shell
- marp --theme gaia
- ```
Use custom theme
- ``` shell
- marp --theme custom-theme.css
- ```
ℹ️Normally Marpit theme CSS requires @theme meta comment, but it's not required in this usage.
Theme set
- ``` shell
- # Multiple theme CSS files
- marp --theme-set theme-a.css theme-b.css theme-c.css -- deck-a.md deck-b.md
- # Theme directory
- marp --theme-set ./themes -- deck.md
- ```
Engine
Use Marpit framework
- ``` shell
- # Install Marpit framework
- npm i @marp-team/marpit
- # Specify engine to use Marpit
- marp --engine @marp-team/marpit marpit-deck.md
- ```
If you want to use the Marpit-based custom engine by the module name, the specified module must be exporting a class inherited from Marpit as the default export.
Functional engine
Spec
- ``` js
- // engine.mjs (ES modules)
- import { MarpitBasedEngine } from 'marpit-based-engine'
- export default () => MarpitBasedEngine // Return a class inherited from Marpit
- ```
- ``` js
- // engine.cjs (CommonJS)
- const { MarpitBasedEngine } = require('marpit-based-engine')
- module.exports = function (constructorOptions) {
- // Return an instance of Marpit initialized by passed constructor options
- return new MarpitBasedEngine(constructorOptions)
- }
- ```