Does any plugin merge/squeeze content to one line?

Sometimes I get texts from OCR, so they have multiple new-line characters like that:

Earthgrid is a startup that is developing a plasma boring robot that it
plans to use to start rewiring America’s energy, internet, and utility grids.
Its robot will be able to
tunnel up to one kilometer per day in its high-
speed configuration. The robot’s low-cost configuration will cost as little
as $300 per meter, making previously unfeasible projects economically
viable. Earthgrid will sell drilling as a service and build, own, operate,
and maintain tunnels for customers on long-term leases or toll
arrangements.

Is there any plugin can merge/squeeze them to one line?

1 Like

+1 from me too, I’d love to see this as a command. Currently I copy into VS Code, run the ‘Join Lines’ command, and paste back into Obsidian.

+1 This is a big feature for me, I too use OCR then paste it in word, using ^p, I replace & then paste in obsidian.
I tried looking for this feature in Linter Plugin but did not find any.

I think the Text Format plugin has what you want: it is a command called Merge broken paragraphs in selection. It will join the broken lines of the current selection to a single line – if there is a single linebreak.

You can add a custom shortcut for it, like every other command (cmd/control-J for example).

Note that, unlike Join lines in VS Code/Sublime Text, (a) you have to select the text that you want to “join”/merge first (having the cursor on the first line is not enough), and (b) this command will do nothing if there are two line breaks, so it will not join separate paragraphs (something I personally would find useful too, but I haven’t found a command like that).

3 Likes