ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 nogu66

marp-preview

Claude Code 面板中的实时 Marp 幻灯片预览:所有幻灯片在一个可滚动列中渲染,保存时重新渲染,并滚动到 Claude 或编辑器刚刚修改的幻灯片。

nogu66@nogu66

nogu66/marp-preview/tree/main/plugins/marp-preview

已翻译

关于这个 mod

一个 Claude Code 插件,会在面板中渲染实时 Marp 幻灯片预览。它由单个钩子模块(hooks/register.tsx)实现,覆盖 session.start、command.run(/marp)、ui.render、ui.close 和 session.end。它会查找演示文稿(也可以通过 grep 查找 marp: true),启动带有 --watch --images png --allow-local-files 的长期运行 marp 进程,将 PNG 写入 /tmp/marp-preview/,并把面板滚动到刚刚修改的幻灯片。它会读取演示文稿及其 mtime,但不会写入项目,也不会接触网络(除了 npx 获取 marp-cli)。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add nogu66/marp-preview
claude plugin install marp-preview
原文 / README

marp-preview

A live Marp slide preview in a Claude Code pane: every slide rendered in one scrolling column, re-rendered on save and scrolled to the slide Claude or your editor just changed.

Usage, requirements and troubleshooting: github.com/nogu66/marp-preview.

What the hooks do

The plugin is one hooks module, hooks/register.tsx:

| Hook | What it does | | --- | --- | | session.start | Registers the /marp command, and resumes following the deck if the pane is still open after a reload | | command.run (/marp) | Finds or takes the deck, opens the pane and starts marp watching it | | ui.render (the pane) | Draws every slide's image in one column, which the pane scrolls | | ui.close | Stops marp when the pane closes | | session.end | Stops marp when the session ends (not on a /clear, which keeps the pane) |

What it touches

  • Files it reads: the deck you open, and its modification time once a second while the pane is open, to see that marp is keeping up. To find a deck when /marp has no argument it runs grep for marp: true over the .md files under the folder the session is in, then over the project.
  • Files it writes: none in the project. It never changes the deck.
  • Processes it runs: marp (from a node_modules at or above the deck, else npx --yes @marp-team/marp-cli) with --watch --images png --allow-local-files, writing PNGs under /tmp/marp-preview/. It is one long-running process, with the browser marp starts, for as long as the pane is open: started by /marp, restarted if it dies or hangs, and ended when the pane closes, the session ends or the plugin reloads. Also the grep above.
  • Not touched: the network (beyond what npx does to fetch marp-cli), the model, tool calls, the prompt, and settings.
  • Environment variables: none.

更多类似作品