ClaudeMods
☰
ZH-TW
● 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.

更多類似作品