@mrsf/marp-mrsf
v0.4.11
Published
Marpit/Marp plugin for rendering Sidemark/MRSF review comments
Maintainers
Readme
@mrsf/marp-mrsf
Render Sidemark/MRSF review comments in Marpit and Marp HTML output.
This package installs into a Marpit-compatible renderer through use() and reuses the existing MRSF runtime model: line metadata on rendered content, a single serialized thread payload per deck, and browser-side interaction through the shared MrsfController.
This is the first public test release of the Marp integration. The package is ready for evaluation in Marpit and Marp hosts, but the vendor-only page anchoring path should still be treated as early feedback territory.
Install
npm install @mrsf/marp-mrsfIf you are starting from Marpit directly, install both packages:
npm install @marp-team/marpit @mrsf/marp-mrsfFor Marp Core hosts:
npm install @marp-team/marp-core @mrsf/marp-mrsfBrowser and Bundler Support
The package exposes a browser-safe entry automatically through the standard browser export condition, so the same import works in Node.js, Vite, webpack, and esbuild.
In browser environments, use comments or loader. File-system-backed options such as documentPath and sidecarPath require Node.js.
Usage
Inline sidecar data
import { Marpit } from "@marp-team/marpit";
import { mrsfPlugin } from "@mrsf/marp-mrsf";
import "@mrsf/marp-mrsf/style.css";
import { MrsfController } from "@mrsf/marp-mrsf/controller";
const marpit = new Marpit();
marpit.use(mrsfPlugin, {
comments: sidecarData,
interactive: true,
});
const { html } = marpit.render(markdownSource);
const container = document.querySelector(".marpit");
if (container) {
new MrsfController(container, { interactive: true });
}Load from disk in Node.js
const marpit = new Marpit();
marpit.use(mrsfPlugin, {
documentPath: "slides/deck.md",
interactive: true,
});The plugin will look for slides/deck.md.review.yaml or slides/deck.md.review.json next to the Markdown document.
Custom loader
marpit.use(mrsfPlugin, {
loader: () => currentSidecarState,
interactive: true,
});Marp Core
import { Marp } from "@marp-team/marp-core";
import { mrsfPlugin } from "@mrsf/marp-mrsf";
import "@mrsf/marp-mrsf/style.css";
const marp = new Marp({ inlineSVG: true });
marp.use(mrsfPlugin, {
comments: sidecarData,
interactive: true,
lineHighlight: true,
});
const { html, css } = marp.render(markdownSource);Styles and Runtime
Include the default stylesheet to get shared badges, highlights, gutters, and tooltips:
import "@mrsf/marp-mrsf/style.css";For interactive hosts, mount the shared controller after the rendered HTML is in the DOM:
import { MrsfController } from "@mrsf/marp-mrsf/controller";
new MrsfController(container, {
interactive: true,
inlineHighlights: true,
});When users interact with comments, the controller dispatches the same mrsf:* events used by the other rendering plugins. The host remains responsible for persistence.
Vendor Page Hints
The Marp integration supports vendor-only x_page hints on comments. This is useful when a presentation-level note belongs to a whole rendered page rather than a specific source line.
comments:
- id: page-2-note
author: Review Bot
timestamp: "2026-03-25T12:10:00Z"
text: Tighten the slide title and reduce the bullet count.
resolved: false
x_page: 2x_page is not part of the MRSF standard. It is preserved as vendor metadata and interpreted by the Marp renderer only.
Notes
- The host application owns persistence. Listen for
mrsf:*events and save sidecar changes yourself. - The plugin adds
data-mrsf-pageto rendered page containers for runtime navigation. - Vendor hints such as
x_pagecan be used to attach a comment to a rendered page when line-level anchoring is not the right fit. - The plugin does not propose any MRSF spec changes. Page metadata is a renderer concern, not a canonical sidecar field.
- Inline SVG mode is supported and tags the SVG page containers with
data-mrsf-page.
Demo
An interactive demo lives in examples/marp-demo. It renders a small deck, keeps the sidecar in local host state, supports add/reply/edit/resolve/delete flows, and includes both line-based and x_page-based comments.
