obsidian-remove-newlines

Remove Newlines

Core Features

Adds four commands:

The commands will appear in the context menu (right-click), but can also be invoked via the Command Palette or bound to a keyboard shortcut.

Use Cases

I started developing remove-newlines because copy-pasting quotes from PDFs into my Obsidian notes involved a lot of tedious clean-up work. Since then, it has saved me countless hours of cleaning up ugly text formatting. People tend to use this plugin for the following use cases:

  1. Copy-pasting from a PDF: Text copied from PDFs often contains hard-wraps (e.g. a newline every 80 characters) and hyphenated word breaks. Paste without newlines will fix it.
  2. Copy-pasting from the web: Text copied from HTML often gets rendered into markdown with a large amount of unecessary blank lines. Paste without blank lines can fix it.
  3. Copy-pasting from LLM tools (e.g. ChatGPT, Claude, Perplexity): This falls under “text copied from HTML”, but this seems to be a popular use case. I recommend you use the dedicated copy buttons in the UI for best results, as they often put well-formatted markdown into the clipboard. Clicking and dragging the text on the page will often copy a bunch of gross HTML that converts to markdown poorly (and inconsistently). However, this text is significantly easier to clean up when you use Paste without blank lines.
  4. Cleaning up existing notes: Remove blank lines from selection is useful when cleaning up large drafts with lots of whitespace.

Usage

Paste without newlines

Pasting content into the Obsidian editor without newlines

Remove newlines from text selection

Removing newlines from a text selection in the Obsidian editor

Paste without blank lines

Pasting content into the Obsidian editor without blank lines

Remove blank lines from text selection

Removing blank lines from a text selection in the Obsidian editor

Change Settings

You can change how Remove Newlines handles word-break hyphenation and consecutive whitespace (when removing newlines) by visiting the plugin’s settings tab. A screenshot of the settings menu.

Adding Hotkeys

There are no hotkeys for these actions by default, but you can create them in the settings modal under the “Hotkeys” section. A screenshot of the hotkey menu in the Obsidian settings modal

What’s New?

1.0.7

1.0.6

1.0.5

1.0.4

1.0.3

Installing

Via the Community Plugin Manager

  1. Open the Community Plugins tab of your Obsidian’s settings modal.
  2. Click the “Browse” button under “Community Plugins”.
  3. Search for “Remove Newlines”.
  4. Click “Install” on the plugin page, then “Enable”.

Via URI/Browser

  1. Visit the official plugin page on Obsidian’s plugin repository.
  2. Click “Install”.
  3. Allow the site to open the obsidian link via Obsidian.
  4. Click “Install” on the plugin page, then “Enable”.

Manually

  1. Download the latest release of the plugin.
  2. Create a remove-newlines folder in your vault’s plugins/ directory: <YourVaultFolder>/.obsidian/plugins/remove-newlines
  3. Unzip the release file and copy over main.js, styles.css, and manifest.json into the remove-newlines/ folder you created in step 2.

Report Issues

If you encounter any issues, please report them on the issue tracker for this plugin. For help with pasting-related commands, please be sure to note what operating system and applications you are using (e.g. Windows, pasting text from Chrome).

Request Features

If you’d like to request a feature or have an idea for a new feature, please use the GitHub issue tracker.

Inspection

All relevant source code can be found in main.ts and also utils.ts. To compile yourself from source:

  1. clone this repo
  2. cd to the project folder
  3. run npm run dev or npm run build
  4. perform a manual install

Plugin Stats

View Plugin Statistics