Document Workflow

Remove blank lines from pasted text without losing structure

Choose between deleting every blank row and collapsing repeated gaps, protect indentation, verify LF or CRLF handling, and export cleaned lists, logs, or prose.

Written and tested by Published: Reviewed:

How this workflow was checked

For the Remove Empty Lines review, we preserved the source shown in “Collapse repeated gaps in release notes” and completed “Identify the text structure” and “Run the bounded Worker”. The produced output was compared literally where possible, with “Deleting every paragraph separator” and “Trimming indentation casually” checked against the linked failure evidence.

Collapse-runs mode reduced four blank lines in two runs to two separators, preserved all three release-note lines, and left leading and trailing content untouched with trimming disabled.

Problem

Text copied from PDFs, email, spreadsheets, terminals, and web pages can contain empty rows, tab-only rows, excessive paragraph gaps, and mixed LF or CRLF endings. Deleting every gap without a policy can join paragraphs, destroy visual sections, or hide a byte-level line-ending change.

When to use this

  • A copied ID, URL, hostname, or checklist column needs exactly one meaningful item per line.
  • A log or stack trace contains empty records that make scanning and sharing harder.
  • Notes or prose contain several blank rows per paragraph break and should retain one separator.
  • PDF, email, or spreadsheet copy introduced rows containing only spaces, tabs, or Unicode whitespace.
  • You need visible before-and-after counts and a local text download rather than an opaque editor command.

Steps

  1. Step 1

    Preserve the original block

    Keep an untouched copy and note whether paragraph breaks, indentation, source order, and the final LF or CRLF are significant to the destination.

  2. Step 2

    Identify the text structure

    Use Remove all for one-record-per-line lists and logs. Use Collapse runs for prose, notes, or sectioned text where one empty separator should remain.

  3. Step 3

    Paste or select a local file

    Enter text or select a TXT, CSV, TSV, log, or Markdown file within the 1,048,576 UTF-8 byte and 200,000 source-line limits.

  4. Step 4

    Protect nonblank content

    Leave Trim surviving lines off unless leading and trailing whitespace is definitely unwanted. Enabling it can remove Python, YAML, or nested-code indentation.

  5. Step 5

    Run the bounded Worker

    Start cleanup and compare source lines, output lines, blank rows found, and blank rows removed. The run stops after three seconds rather than holding the page indefinitely.

  6. Step 6

    Read every diagnostic

    Check whether blank runs were collapsed, nonblank lines were trimmed, or mixed LF, CRLF, and CR endings were normalized to the predominant source style.

  7. Step 7

    Verify and export

    Spot-check paragraph boundaries, indentation, zero-width characters, and the terminal line ending, then copy or download the exact result and test it in the target workflow.

Example

Collapse repeated gaps in release notes

Input

Release 2.4


Fixed login timeout
 	

Added audit export

Output

Collapse runs, trimming off:
Release 2.4

Fixed login timeout

Added audit export

Blank lines: 4 | Blank runs: 2 | Removed: 2

Common mistakes

Deleting every paragraph separator

Use Collapse runs when empty rows carry document structure. Remove all is better for machine-oriented one-item-per-line data.

Trimming indentation casually

The trim option changes real content on surviving lines. Keep it off for indentation-sensitive code and aligned plain text.

Treating zero-width characters as whitespace

JavaScript trim() does not remove U+200B and related format characters. A visually empty row can remain nonblank and should be inspected separately.

Ignoring mixed line endings

Mixed input is normalized to the most frequent source style. Review the warning before using the output in patches, repositories, or byte-sensitive imports.

Running later cleanup in the wrong order

Remove blank rows before duplicate detection or sorting so empty records do not become misleading values or collect at one edge of the output.

FAQ

Should I remove blank lines before duplicate lines?

Usually yes for one-item-per-line data. Empty-line cleanup removes noise first, then duplicate removal can compare only meaningful rows with an explicit case and whitespace policy.

Which mode is safer for copied prose?

Collapse runs is safer because it retains one empty separator per consecutive group. Review the preview before replacing the original text.

Does a whitespace-only line keep its spaces in collapse mode?

No. The retained separator is an actual empty row, so hidden spaces and tabs in that blank run are removed.

Can I clean code safely?

Blank rows can be removed or collapsed, but leave trimming off when indentation matters. Also confirm whether blank rows are part of the project's formatting convention.

Will CRLF files stay CRLF?

Uniform CRLF is preserved, including a terminal ending when output remains. Mixed endings are normalized to the predominant style and reported.

Is the pasted text uploaded?

No. File reading and cleanup happen in a bounded browser Worker. Analytics records counts and selected options, not the source or output text.