Marp
Render Marp slide decks at build time. A note whose YAML frontmatter contains marp: true is rendered as a whole-document deck, and marp fenced code blocks render as inline decks.
Usage
import { defineConfig } from "@riebeckite/core";
import { marp } from "@riebeckite/plugin-marp";
export default defineConfig({
// ...
plugins: [
marp({
theme: "default",
allowHtml: true,
math: true,
caption: true,
}),
],
});
Obsidian vault compatibility
The Obsidian plugins Marp and Marp Slides treat the entire note as a Marp deck and never store marp code fences. In Obsidian, activation is plugin-level: opening the slide preview or exporting renders the whole file of the active note, and neither plugin reads a per-note marker. Riebeckite instead activates per document using the canonical marp: true frontmatter flag — the same signal Marp CLI and the VS Code extension use — so notes written for those plugins are detected as:
---
marp: true
theme: gaia
paginate: true
---
# First slide
---
# Second slide
The whole document (frontmatter included, so directives such as theme and paginate apply) is rendered as one <figure class="rb-marp"> deck that replaces the page body. Slide separators are --- / ===, exactly like Marp. Notes without the flag or any marp code block are left untouched.
Activation contract. Riebeckite is not activated the way the Obsidian plugins are. A note that showed as slides in Obsidian (because you opened the slide preview for it) will not render as a deck here unless
marp: trueis present in its frontmatter. Adding that one line is the only change such a vault needs — the deck body (separators,theme/paginateand other directives, standard Marp syntax) is used exactly as stored. In other words, the output follows Marp semantics, while the plugins' zero-config, plugin-level activation is not reproduced. Treat this as content-compatible, not fully drop-in.
Inline decks
In a note, write a fenced code block whose info string is marp. Slides are separated by ---, exactly like Marp. Setting the code block title renders a caption.
```marp title="Intro deck"
# First slide
- a bullet
---
# Second slide
```
How it renders
The plugin dynamically imports @marp-team/marp-core at build time and calls Marp#render. Marp Core never enters the client bundle. Each code block becomes:
<figure class="rb-marp" role="group" data-marp data-marp-slides="2">
<style>/* CSS generated at build time, scoped under .rb-marp */</style>
<figcaption class="rb-marp__caption">…</figcaption>
<div class="rb-marp__deck">
<svg data-marpit-svg>…</svg>
…
</div>
<details class="rb-marp__fallback">
<summary>Marp source</summary>
<pre><code>…original Markdown…</code></pre>
</details>
</figure>
CSS scoping and inlining
Plugins cannot inject into <head>, so the CSS generated by Marp is inlined into the <figure class="rb-marp"> as a <style> element. To keep it from leaking, the plugin:
- fixes Marp's
containeroption to therb-marp__deckclass so every generated selector stays under that container; - constrains the container selector to a
.rb-marpdescendant (for example.rb-marp div.rb-marp__deck > svg > foreignObject > section); - removes the global
@pagerule and rewriteshtml, bodyinside@media printto.rb-marp.
When several decks on one page use the same theme their generated CSS is identical, so the <style> element is emitted only once.
Build-time rendering
- Rendering uses
script: false, so a deck never ships client JavaScript. SVG slide sizing is handled bystyle.css; - captions come from the code block
title; data-marp-slidescarries the slide count anddata-marpmarks the deck.
Options
| Option | Default | Description |
|---|---|---|
theme |
"default" |
A theme name registered in Marp Core ("default", "gaia", "uncover", …) |
allowHtml |
true |
Allow raw HTML in the Marp Markdown |
math |
true |
Enable Marp math support |
inlineSVG |
unset | Marp's inlineSVG option. When unset, SVG slides are emitted |
caption |
true |
Show the code block title as a caption |
className |
"rb-marp" |
Wrapper class name |
An unknown theme falls back to the default theme and emits a diagnostic with source: "@riebeckite/plugin-marp". A render failure keeps the original code block and emits the same kind of diagnostic.
Limitations
- No client-side slide editing or paging UI; this only produces static HTML/CSS at build time.
- Only themes registered in Marp Core are available; loading arbitrary theme CSS is not supported.
inlineSVG: falseemits bare<section>elements without the SVG wrapper, and the generated CSS changes to match that structure.- Whole-document decks bypass the normal Markdown pipeline, so Obsidian
![[image]]image embeds are not resolved inside slides. Use regular Markdown image syntax with paths that exist on the published site, mirroring how Marp Slides itself does not support wiki links.
Exports
marp(options?)/marpPlugin(options?)— plugin factoryisMarpDocument(matter?)— frontmattermarp: truedetection helper- Types:
MarpOptions,MarpDeck,MarpBuildRenderResult