Skip to main content

AltF Flow recipe

Hard wrap text at 72 characters

Git tools and many plain-text mail readers expect lines of about 72 characters. This recipe trims the text, squeezes runs of blank lines down to a single blank line so paragraphs stay separate, and then hard wraps each long line at 72 characters on word boundaries. Short lines, such as a summary line, are left untouched.

  • Free, no sign-up
  • Runs in your browser
  • Nothing uploaded
  • Share recipes as a link

3 steps · runs in your browser · nothing uploaded

Pipeline

  1. Remove spaces and blank lines from the start and end of the whole text.

    9 → 7 lines (-2)
  2. Keep one between paragraphs

    7 → 5 lines (-2)
  3. Width: 72

    5 → 9 lines (+4)

9lines75words430chars

9lines75words426chars

The 3 steps in this recipe

  1. 1

    Trim whitespace

    Remove spaces and blank lines from the start and end of the whole text.

  2. 2

    Remove empty lines - Keep one between paragraphs

    Delete blank lines, or squeeze runs of blank lines down to one so paragraphs stay apart.

  3. 3

    Wrap at a width - Width: 72

    Hard-wrap long lines at word boundaries, e.g. 280 for posts or 72 for commit messages.

Change any option in the workspace above, switch a step off to compare, or add your own steps. Save it to reuse it, or share the recipe as a link.

Worked example

Before

Fix race condition when two workers claim the same job



Workers polled the queue and claimed jobs with a read followed by a separate update, so two workers could read the same row before either wrote the claim. This change uses a single conditional update and checks the affected row count before starting work.

Also adds a regression test that starts two workers against one job and asserts that exactly one of them runs it.
After
Fix race condition when two workers claim the same job

Workers polled the queue and claimed jobs with a read followed by a
separate update, so two workers could read the same row before either
wrote the claim. This change uses a single conditional update and checks
the affected row count before starting work.

Also adds a regression test that starts two workers against one job and
asserts that exactly one of them runs it.

How the wrapping works

Each line longer than the width is broken at the last space that fits. Lines already within the width, including blank lines, pass through unchanged, so the blank line between the summary and the body is preserved. A single word longer than the width, such as a long URL, is cut into width-sized pieces, so consider moving long links to their own line.

Other widths

  • 50 for a short summary line convention.
  • 76 or 78 for plain-text email bodies.
  • 80 for code comments and README text in many style guides.

Wrap text at 72 characters: questions and answers

Does it re-flow text that is already wrapped?

No. It only breaks long lines. To re-flow, join each paragraph into one line first with Find and replace, then wrap.

Will it break bullet lists?

Long bullets are wrapped, but continuation lines are not indented under the bullet text.

Does it count characters or bytes?

It counts JavaScript string length, which matches characters for ordinary Latin text.

More recipes like this

Every step you can add (41)

Clean up

  • Trim whitespace
  • Trim every line
  • Remove empty lines
  • Collapse repeated spaces
  • Remove line breaks
  • Strip HTML tags
  • Straighten smart quotes
  • Remove accents
  • Remove punctuation
  • Remove emoji
  • Remove non-ASCII characters

Change case

  • Change case
  • Make URL slugs

Lines

  • Sort lines
  • Remove duplicate lines
  • Keep only duplicated lines
  • Compare with another list
  • Count repeated lines
  • Reverse line order
  • Shuffle lines
  • Keep a range of lines
  • Truncate long lines
  • Wrap at a width
  • Split into lines
  • Join lines

Find and filter

  • Find and replace
  • Filter lines
  • Remove words or characters

Extract

  • Extract

Data and formats

  • Format JSON
  • Minify JSON
  • CSV to JSON
  • JSON to CSV
  • Lines to JSON array
  • JSON array to lines

Encode and decode

  • Encode or decode

Build output

  • Add prefix / suffix
  • Quote each line
  • Number lines
  • Apply a line template
  • Add timestamp
What each step does, with its options

AltF Flow runs entirely in your browser. Your text is never sent to AltFTool; saved recipes stay in this browser and shared links carry the steps only.