# 转为引用格式

> 在每行开头加上 >，用于 Markdown 或邮件引用

版本：1.0.0 · 作者 Deck

- 安装到 Deck：deck://install-plugin?id=quote-lines&url=https%3A%2F%2Fgithub.com%2Fyuzeguitarist%2Fdeck-plugins%2Freleases%2Fdownload%2Fplugins%2Fquote-lines-1.0.0.zip
- 下载 .zip：https://github.com/yuzeguitarist/deck-plugins/releases/download/plugins/quote-lines-1.0.0.zip
- 在 GitHub 上查看：https://github.com/yuzeguitarist/deck-plugins/tree/main/plugins/quote-lines

也可以用终端安装：

```sh
mkdir -p ~/.deck/scripts/quote-lines && curl -fsSL https://github.com/yuzeguitarist/deck-plugins/releases/download/plugins/quote-lines-1.0.0.zip | tar -xf - -C ~/.deck/scripts/quote-lines
```

## 脚本

```js
// Puts "> " at the start of every line, as Markdown and plain-text email quote text. Empty lines get ">".
function transform(input) {
  const text = String(input ?? "").replace(/\r\n?/g, "\n");
  if (text === "") return "";
  const end = text.endsWith("\n") ? "\n" : "";
  const lines = (end ? text.slice(0, -1) : text).split("\n");
  return lines.map((line) => (line === "" ? ">" : "> " + line)).join("\n") + end;
}
```

---

- HTML：https://deckclip.app/zh-cn/plugins/quote-lines
- English：https://deckclip.app/plugins/quote-lines.md

© 2026 潘禹泽
