In Markdown, spaces at the end of a line can control the rendered layout. Cleaning every run of repeated spaces can remove an intended hard break even though the source still has a newline.
Keep the original saved before editing. Use the procedure below on selected plain prose with accidental interior gaps, keeping code, tables and deliberate alignment outside the selection.
Identify the spaces that create the break
This example has two spaces between Pack and the, three between Bring and a, and two after the period on the first line.
Pack the seeds.
Bring a tray.
Under CommonMark rules, two or more spaces before a newline can create a hard break inside a paragraph. In this sample, the preview has a visible break before Bring. See the CommonMark hard line break rules.
Check what a broad cleanup would remove
A search for [ ]{2,} matches all three runs of repeated spaces in the sample. Replacing each run with one space produces this source.
Pack the seeds.
Bring a tray.
The first line now ends with one space. With ordinary CommonMark soft-break behavior, that source newline produces no hard-break element. Both instructions remain in one paragraph, but the explicit break before Bring has gone.
Return to the saved original before continuing. The next pattern preserves existing end spaces, so applying it to this already-cleaned result would leave the missing hard break unresolved.
Clean only spaces between non-whitespace characters
Open Find and Replace Text and paste the original sample into Your text.
Enable Use regular expression and Replace all. Leave Whole word only and Match case off. Enter this in Find, with single backslashes and no surrounding slashes or flags.
(?<=\S)[ ]{2,}(?=\S)
Click Replace with and press the spacebar once. Click Replace. Expect two replacements, with 34 characters before and 31 after.
Pack the seeds.
Bring a tray.
The checks on either side require a non-whitespace character. The matched runs therefore sit inside the prose, leaving leading indentation and spaces before a newline outside the matches. The lookbehind checks the preceding character without consuming it, as explained in the MDN lookbehind reference.
Verify the rendered result in its destination
Copy the result into the Markdown source editor and inspect its preview. Confirm that the gaps inside both instructions are tidy and the intended hard break remains before Bring.
Some renderers can turn ordinary source newlines into visible breaks too. Check with the renderer and settings that will publish the text. For a longer edit, use the draft comparison workflow with whitespace differences visible, then review the rendered copy as well.