# Collapse Spaces

> Turns each run of spaces and tabs into a single space and leaves line breaks as they are

Version: 1.0.0 · By Deck

- Install in Deck: deck://install-plugin?id=collapse-spaces&url=https%3A%2F%2Fgithub.com%2Fyuzeguitarist%2Fdeck-plugins%2Freleases%2Fdownload%2Fplugins%2Fcollapse-spaces-1.0.0.zip
- Download .zip: https://github.com/yuzeguitarist/deck-plugins/releases/download/plugins/collapse-spaces-1.0.0.zip
- View on GitHub: https://github.com/yuzeguitarist/deck-plugins/tree/main/plugins/collapse-spaces

Or install with Terminal: 

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

## Script

```js
// Turns every run of spaces and tabs into a single space. Line breaks stay as they are.
function transform(input) {
  return String(input ?? "").replace(/[ \t]+/g, " ");
}
```

---

- HTML: https://deckclip.app/plugins/collapse-spaces
- 中文: https://deckclip.app/zh-cn/plugins/collapse-spaces.md

© 2026 Yuze Pan
