npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mrsf/rehype-mrsf

v0.4.8

Published

rehype plugin for rendering Sidemark/MRSF (Markdown Review Sidecar Format) review comments

Downloads

1,286

Readme

@mrsf/rehype-mrsf

A rehype plugin for rendering Sidemark / MRSF review comments directly into HTML output. Part of the unified ecosystem.

Works with Astro, Next.js MDX, Docusaurus, and any other tool that uses the unified pipeline.

Install

npm install @mrsf/rehype-mrsf

Quick Start

import { unified } from "unified";
import remarkParse from "remark-parse";
import remarkRehype from "remark-rehype";
import rehypeStringify from "rehype-stringify";
import { rehypeMrsf } from "@mrsf/rehype-mrsf";

const html = await unified()
  .use(remarkParse)
  .use(remarkRehype)
  .use(rehypeMrsf, { documentPath: "docs/guide.md" })
  .use(rehypeStringify, { allowDangerousHtml: true })
  .process(markdownSource);

Note: Pass { allowDangerousHtml: true } to rehype-stringify so the raw HTML tooltips are serialized.

Include the stylesheet in your page:

import "@mrsf/rehype-mrsf/style.css";

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | comments | MrsfDocument | — | Pre-loaded sidecar data (highest priority) | | loader | () => MrsfDocument \| null | — | Custom loader function | | sidecarPath | string | — | Explicit path to .review.yaml / .review.json | | documentPath | string | — | Auto-discover sidecar next to this markdown file | | showResolved | boolean | true | Show resolved comments | | interactive | boolean | false | Show action buttons (resolve, reply, edit) | | gutterPosition | 'left' \| 'right' | 'right' | Badge placement | | gutterForInline | boolean | true | Show badge for inline-highlighted comments | | inlineHighlights | boolean | true | Highlight selected_text with <mark> | | lineHighlight | boolean | false | Add background tint on commented lines | | theme | 'light' \| 'dark' \| 'auto' | 'auto' | Color scheme hint | | cwd | string | process.cwd() | Working directory for file discovery |

Data provisioning priority

  1. comments — inline sidecar data (works everywhere)
  2. loader — custom function (works everywhere)
  3. sidecarPath — explicit file path (Node.js only)
  4. documentPath — auto-discover .review.yaml/.json (Node.js only)

Gutter Placement

// Left gutter — badge in a margin column, content indented
.use(rehypeMrsf, { comments, gutterPosition: "left" })

// Right — badge floated right (default)
.use(rehypeMrsf, { comments, gutterPosition: "right" })

For inline emphasis, use inlineHighlights and gutterForInline instead of a separate gutter mode.

Browser / Bundler Usage

In browser environments (Vite, webpack, esbuild), the "browser" export condition in package.json automatically resolves to a file-system-free entry point. No special import needed:

import { rehypeMrsf } from "@mrsf/rehype-mrsf"; // auto-resolves to browser entry

Only comments and loader options work in the browser. sidecarPath and documentPath require Node.js.

Astro

// astro.config.mjs
import { rehypeMrsf } from "@mrsf/rehype-mrsf";
import sidecarData from "./content/guide.md.review.yaml";

export default defineConfig({
  markdown: {
    rehypePlugins: [
      [rehypeMrsf, { comments: sidecarData }],
    ],
  },
});

Next.js MDX

// next.config.mjs
import createMDX from "@next/mdx";
import { rehypeMrsf } from "@mrsf/rehype-mrsf";

const withMDX = createMDX({
  options: {
    rehypePlugins: [
      [rehypeMrsf, { documentPath: "docs/guide.md" }],
    ],
  },
});

export default withMDX(nextConfig);

Interactive Mode

Enable action buttons and hook into events (includes gutter “Add comment” buttons and an inline “Add comment” floater that appears when users select text):

.use(rehypeMrsf, { comments, interactive: true })
import { refreshAll } from "@mrsf/rehype-mrsf/controller";

document.addEventListener("mrsf:submit", async (e) => {
  // { action, commentId, text?, line?, end_line?, start_column?, end_column?, selection_text? }
  await saveComment(e.detail);
});

await mermaid.run();
refreshAll();

Events fired after user confirmation: mrsf:add, mrsf:reply, mrsf:edit, mrsf:resolve, mrsf:unresolve, mrsf:delete, mrsf:navigate, plus mrsf:submit with the full payload.

Set window.mrsfDisableBuiltinUi = true before loading the controller if you want to render your own dialogs and only consume the events.

The controller also auto-refreshes gutter positions on DOM mutations inside the rendered container, which covers common async renderers such as Mermaid. Call refreshAll() after third-party rendering when you need a deterministic reposition step.

CSS Customization

Override CSS custom properties:

:root {
  --mrsf-badge-bg: #0969da;
  --mrsf-tooltip-bg: #1c1c1c;
  --mrsf-highlight-bg: rgba(255, 213, 79, 0.3);
  --mrsf-gutter-width: 50px;
}

See the full list of variables.

License

MIT