Replacing two paragraph marks with one

What I’m trying to do

I have a long document and all the paragraphs are separated with a blank line. I’d like to remove those blank lines and rely on css to space the paragraphs.

In Word I would search for two adjacent paragraph marks and replace them with one. Can I do the same in Obsidian? If not is there some other solution?

Thank you

On macOS, I would:

  1. Open in the note in the default app (Text Edit),
  2. Invoke Find and Replace (CMD OPT F),
  3. Search for two paragraph returns (OPT ENTER, OPT ENTER),
  4. And replace with one paragraph return (OPT ENTER).

Assume other OSes have similar native options or access to a universal app such as VS Code.


Sorry, I should have said that I was using Windows. You did give me the idea of searching for alt-codes, but I couldn’t get that to work either. Thanks.

What I might do is uploaded it into LibreOffice Writer as a text file. I’m pretty sure I can do this there. Then I can save it as a docx file, import that into Typora and save it as a markdown.

1 Like

Eightning mention VS Code, and that is available for Windows as well as Mac, and it’s a good alternative where you could do regex replace of the double newlines into a single newline.

Something like searching for\n\n and replacing with \n, could do the trick.

Another question though; Are you sure your markdown will be consistent and correct if you replace all the double newlines with a single newline? You might run into some issues related to blocks not being separated properly, and cause various issues related to rendering of your markdown.

Perennial problem - one way or the other - markdown paragraphs defined by blank lines, rich text paragraphs rarely using blank lines for readability reasons. And quite a bit of variation in how programs work with them (eg Inspire Writer exports lines to docx as if they are paragraphs).

So my solution is to know exactly how any program works with these and try to have consistency within workflows.
With the backup of using my (Windows) text editor (Editpad Pro) to do instant conversion between lines and paragraphs. Many text editors should be able to do this.

VS Code, I have that on my computer and it worked. Thank you very much.

If you’re going to use Markdown, I really recommend accepting the syntax. I disliked the blank lines at first but I’ve gotten used to it.

You can probably use a CSS snippet to hide or minimize the blank lines. If you only want it in Reading View / exports, that should be pretty easy. Doing it in Live Preview is probably trickier but might be possible.

At one time, I did that. Many writers appear to use snippets to make lines look like paragraphs. And it is certainly easy in Word to switch between lines and paragraphs.
But, in general, I found it didn’t do. I had to convert documents too often and bulk conversion wasn’t always very practical.

The problem is that it depends on your needs and your ecosystem.

I write notes and research articles in markdown; for these purposes I like having blank space between paragraphs. I use Tangent Notes with return set to produce a new paragraph. The articles go into Word via Writage. That works.

But writing books or continuous prose is another matter completely: there I need not to see blank lines and I also cannot rely on automated bulk conversion between lines and paragraphs - which means that I’ve had to check each step in my workflow.
I like to write in Writemonkey (latest version Jan 2023). Being a markdown stickler means that I use lines instead of paragraphs (though I have to view in other programs to see indents at the start of a new line as that feature hasn’t been added yet). It gives me total freedom to write in short files (but view them as a single document) moving the sequence as much as I wish or to write a whole book as a single files - again making it easy for me to move sections. I’m also free to do any of the writing in other programs if I wish and may just write shorter files in Tangent (with Enter set to new line). But its native export leaves me with lines in Word.
So I prefer to use Inspire Writer (a Ulysses clone). That automatically converts markdown lines to paragraphs (and leaves huge blank lines if the imported files were written with markdown paragraphs) and gives me excellent export and preview options. This ecosystem makes it most efficient for me to write in lines.
If I was writing in Word or in iAWriter, I would write in paragraphs.

True, but if a person finds themself working against a fundamental part of their tool, t think it’s best if they have a pressing reason for it.

It sounds like you have a workflow that works for you, so that’s good.

But that’s the situation you have if you use many markdown programs. Differences may seem trivial but they quickly become unproductive when you string programs together. Some early syntax decisions are downright bad, given the uses the programs are out to now. If you use tables, you have to fight markdown to do it. Obsidian tries to stick to the rules, but still chooses to break some of them. This means that you need to understand the decisions each program you use has made to avoid bumps and stumbles. And the area around lines and paragraphs has multiple inconsistencies.

I think for most things, using a blank line between paragraphs might make sense because then if you view it with a text viewer or editor it is readable. I suppose this is the reason for the blank line?

Regardless, I am writing a book. A long one too. So far 200,000+ words. I did the first draft on Word, but I’ve decided to leave Word. Now, I’ve been floundering around looking for a new word processor that I like. I landed on LibreOffice Writer, which is okay, but I feel no love for it. I have discovered that I like using Obsidian. It makes a pretty good word processor if you don’t need all the fancy stuff. For a long document, not having the extra blank line seems better. It may because I’ve used Word for so long it feels natural not to have the blank line.

What I think I’m going to do is learn how to use Obsidian frontmatter and create document specific css for my long documents. Then the other documents can continue to have the extra blank line.

Thanks to everyone for your help.

1 Like

No. Just markdown. Markdown uses whitespace a lot.
Presumably comes from code editors where lines are the key element and paragraphs, as such, don’t exist.

How do you have it organised? Multiple sections or one long file with headings?

one long file with headings.

Depending on how you manage it, Obsidian’s not great at handling such large files. Won’t matter if you don’t move around a lot, but certainly will if you try to shuffle content. I’d actually have said that Word was better for that. Not that it’s good either.

Most solutions use sections/chapters which are combined at the end.

Back many months ago when I first tried out Obsidian, I would have agreed with your concern about Obsidian. However, I gave it a retry, and whither it was me that changed or Obsidian, I’m finding it to me a pleasant experience. I’ve only just restarted so perhaps this will change. But honestly, if you’re just writing and editing, I think Obsidian is fine even for very large files. It’s very responsive. That might change fast if you have a lot links that need to be updated or formats.

I’m using the outliner plugin to make moving around easier. And the Editing Toolbar. I have ProWritingAid to help me with my terrible grammar. I have had moments of regret that I gave up Word. But at the moment, I’m very happy with Obsidian as my word processor.

I actually loved using Word. I do believe it is the best word processor. However, I left it because I got tired of having to subscribe to it every year. At least I think that was the reason, it may have been that I was just wanting to try something new.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.