# Wrap Unwrap for Raycast

URL: https://www.raycast.com/chrismessina/wrap-unwrap

> Wrap and unwrap text using Markdown-aware reflow.

- Install: raycast://extensions/chrismessina/wrap-unwrap
- Author: [Chris Messina](https://www.raycast.com/chrismessina)
- Installs: 122
- Platforms: macOS
- Categories: Productivity
- Updated: 2026-07-26
- Source: https://github.com/raycast/extensions/tree/555aea4ed36c6b9232d64ae57bf62bb63c91f6d5/extensions/wrap-unwrap/

## Commands

- **Wrap Text**: Wrap text at a configurable column width.
- **Unwrap Text**: Reflow wrapped text into continuous paragraphs while preserving Markdown structure.

## README

### Wrap Unwrap

Reflow text to or from wrapped form, with Markdown awareness. Two `no-view` commands you can hotkey-bind:

- **Wrap Text** — wrap the selected text (or clipboard text) at a configurable column width.
- **Unwrap Text** — reflow wrapped text into continuous paragraphs, preserving Markdown structure (code fences, lists, blockquotes, tables, links, hyphenation).

The classifier recognizes paragraphs, ATX and setext headings, fenced and indented code, blockquotes (with nesting), bullet/ordered/task lists, pipe tables, HTML blocks, reference link definitions, and hard breaks. Unwrap groups by blockquote prefix and inner role, so `> - item` reflows as a list item under a quote without losing structure.

#### Commands

| Command     | Description                                                                         |
| ----------- | ----------------------------------------------------------------------------------- |
| Wrap Text   | Wrap text at a configurable column width.                                           |
| Unwrap Text | Reflow wrapped text into continuous paragraphs while preserving Markdown structure. |

#### Preferences

Both commands share **Preferred Source**, **Primary Action**, **Hide HUD**, and **Pop to Root After Action**:

| Preference               | Default       | What it does                                                                                        |
| ------------------------ | ------------- | --------------------------------------------------------------------------------------------------- |
| Preferred Source         | Selected Text | Try the selection first; fall back to the clipboard if none. Choose Clipboard to flip the priority. |
| Primary Action           | Paste         | Paste the result into the focused app. Choose Copy to put the result on the clipboard instead.      |
| Hide HUD                 | off           | Suppress the success HUD ("Pasted wrapped text" / "Copied unwrapped text").                         |
| Pop to Root After Action | off           | Return to Raycast root after the action completes. (No-op when launched via hotkey.)                |

**Wrap Text** also has:

| Preference  | Default | What it does                                                                                                                                                    |
| ----------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Wrap Column | 80      | The column at which lines are wrapped. The wrap budget is the _full_ line including blockquote and list-item prefixes. Width values below 20 are clamped to 20. |

**Unwrap Text** also has:

| Preference               | Default | What it does                                                                                                                                                                                                                                                                                                                                        |
| ------------------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Strip Soft Hyphens       | on      | When joining lines, remove a trailing soft hyphen (U+00AD) — the invisible character that marks an optional break. A regular `-` is always kept, so `well-` + `known` rejoins as `well-known` and `state-of-the-art` stays intact; either way the halves join with no space.                                                                        |
| Keep Blank Lines         | off     | Preserve blank lines between paragraphs instead of collapsing runs.                                                                                                                                                                                                                                                                                 |
| Strip Bullet Indentation | off     | Re-indent bullet and numbered lists to a fixed 2-space-per-level step, removing the leading spaces that pasted terminal or rich-text content adds in front of markers. Nesting depth is preserved by relative indent order, so pasting into an email client produces native bullets. Recognizes Unicode bullets (`•`, `‣`, `▪`, `▸`, `–`, `—`) too. |

#### Suggested hotkeys

Bind these in Raycast → Extensions → Wrap Unwrap. Suggestions:

- Wrap Text → ⌃⌥W
- Unwrap Text → ⌃⌥U

#### For other extensions

Wrap Unwrap implements the [LitoMore cross-extension convention](https://github.com/LitoMore/raycast-cross-extension-conventions) on the provider side using only built-in Raycast SDK primitives. Pass a `launchContext` with the text and an optional `callbackLaunchOptions` describing where to send the result:

```ts
import { launchCommand, LaunchType } from "@raycast/api";

await launchCommand({
  name: "unwrap-text",
  type: LaunchType.UserInitiated,
  extensionName: "wrap-unwrap",
  ownerOrAuthorName: "chrismessina",
  context: {
    text: "Some\nwrapped\ntext\nto reflow",
    hyphenation: true,
    callbackLaunchOptions: {
      name: "your-callback-command",
      type: LaunchType.Background,
      extensionName: "your-extension",
      ownerOrAuthorName: "you",
    },
  },
});
```

The provider invokes your callback command with `context: { result: "..." }` containing the transformed text. When `callbackLaunchOptions` is present, the provider does not paste, copy, or show a HUD — it just hands the result back.

`UnwrapContext` accepts `text`, `hyphenation`, `keepBlankLines`, `flattenBullets`, and `callbackLaunchOptions`. `WrapContext` accepts `text`, `width`, and `callbackLaunchOptions`.

#### Acknowledgements

The Preferred Source / Primary Action preference pattern follows the popular [Change Case](https://www.raycast.com/erics118/change-case) extension's convention.
