# Capitalize Words

> Makes the first letter of every word upper case and leaves the other letters as they are

Version: 1.0.0 · By Deck

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

Or install with Terminal: 

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

## Script

```js
// Makes the first letter of every word upper case and leaves the other letters as they are.
function transform(input) {
  // A word starts at a letter that follows anything but a letter, mark, digit or apostrophe. An apostrophe
  // after a letter, mark or digit stays inside the word, as in don't and 1990's.
  return String(input ?? "").replace(
    /(^|[^\p{L}\p{M}\p{N}'\u2019]|(?:^|[^\p{L}\p{M}\p{N}])['\u2019])(\p{L})/gu,
    (match, before, letter) => before + letter.toUpperCase()
  );
}
```

---

- HTML: https://deckclip.app/plugins/capitalize-words
- 中文: https://deckclip.app/zh-cn/plugins/capitalize-words.md

© 2026 Yuze Pan
