PDF export with paragraph re-wrapping?

What I’m trying to do

I have notes with paragraphs pasted from another source, with line endings around 120 characters:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Curabitur pretium
tincidunt lacus nulla gravida orci a odio sit amet aliquam.

Markdown shouldn’t care about line endings - I’m not adding double spaces or <br> or anything. But when I export to pdf, it splits the lines to fit the page width but doesn’t merge with the next line - so I get a mess:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut
labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis
aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint
occaecat cupidatat non proident, sunt in culpa qui off
icia deserunt mollit anim id est laborum.
Curabitur pretium
tincidunt lacus nulla gravida orci a odio sit amet aliquam.

Things I have tried

If I make the paragraph a single long line with no breaks, the pdf export is fine - but that’s a lot of work for all this pasted text. I’ve looked at whether linters or the like can help, but so far drawn a blank.

Copying from another source retains not just formatting, but also white space as well as breaks.

Some tips:

  • try to paste with shift (Ctrl+Shift+v) to paste as plain text, but I’m not 100% sure if this method works always everywhere to remove line breaks and white spaces.
  • go to Obsidian’s Settings>Edit>Strict line breaks to modify line breaks globally
  • try to use the community plugin Linter to correct your text body with good formatting rules and remove double white spaces.
  • finally, the best option might be a shell script or manual editing to correct line width for your PDF printout.

Thanks for the suggestions

I’d tried the others, but the “Strict line breaks” setting actually seems to fix the problem! I had assumed from the description that it only affected reading view, but it seems to also affect pdf export.

1 Like