Configs2026年5月4日·1 分钟阅读

Marp — Create Presentation Slides from Markdown

A Markdown-based presentation ecosystem with a CLI, VS Code extension, and browser-based engine that converts Markdown files into HTML, PDF, and PowerPoint slide decks.

Introduction

Marp (Markdown Presentation Ecosystem) lets developers write presentation slides in plain Markdown and convert them to polished HTML, PDF, or PPTX output. It brings the speed and version control of text-based authoring to slide decks, eliminating the need for GUI presentation tools.

What Marp Does

  • Converts Markdown files into self-contained HTML slide decks with a single command
  • Exports to PDF and PowerPoint formats for sharing and offline presentation
  • Uses --- as a slide separator and supports standard Markdown syntax including images and code blocks
  • Provides built-in themes (default, gaia, uncover) and supports custom CSS themes
  • Offers directives for per-slide styling, background images, and layout control via front-matter

Architecture Overview

Marp is composed of three main packages: Marp Core is the Markdown-to-slide rendering engine built on markdown-it, Marp CLI wraps Core with file I/O and export functionality using Puppeteer for PDF/PPTX generation, and the VS Code extension provides live preview. Slide separation, directive parsing, and theme injection happen in the Core pipeline. The output is standard HTML with embedded CSS and can be served as static files.

Self-Hosting & Configuration

  • Install the CLI: npm install -g @marp-team/marp-cli
  • Install the VS Code extension "Marp for VS Code" for live preview
  • Add a marp: true front-matter flag to enable Marp rendering in VS Code
  • Set themes, page size, and export options in front-matter or a .marprc.yml config file
  • Run marp --server . to start a live-reload development server for slide editing

Key Features

  • Slides are plain Markdown files that version cleanly in Git
  • Export to HTML, PDF, and PPTX from a single source
  • Scoped CSS per slide using directives like <!-- _class: lead -->
  • Background images and split layouts with simple directive syntax
  • Live-reload server for rapid slide development

Comparison with Similar Tools

  • Slidev — Vue-powered slide framework with component support; Marp is simpler and Markdown-pure
  • Reveal.js — HTML-based presentation framework; Marp offers a more streamlined Markdown-to-slides workflow
  • Google Slides / PowerPoint — GUI-based; Marp is text-first, versionable, and automatable
  • Deckset — macOS app for Markdown slides; Marp is free, cross-platform, and open source
  • Remark.js — browser-based Markdown slides; Marp adds PDF/PPTX export and a richer theme system

FAQ

Q: How do I separate slides? A: Use --- (three dashes) on its own line to mark where one slide ends and the next begins.

Q: Can I use custom CSS themes? A: Yes. Create a CSS file and reference it with --theme your-theme.css in the CLI or via front-matter.

Q: Does Marp support speaker notes? A: Yes. Add HTML comments <!-- speaker notes here --> after slide content. They appear in presenter view.

Q: Can I include diagrams or charts? A: Marp supports images and HTML. You can embed Mermaid or other rendered diagrams as images or use plugins.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产