Trim trailing whitespace

I’d like have a plugin that trims trailing whitespace when a note is saved, and possibly leave one blank line at the end of the note.

Partly due to Automatic space inserted after selecting tag, and just day-to-day editing, I get random trailing whitespace and blank lines cluttering my files. As a programmer, with editors that know how to deal with it, this irks me.

I’m not sure how feasible it is, but if no-one else has done something similar I might give it a go.

2 Likes

Maybe some need it, but remember “forced line breaks” in Markdown (two spaces at the end of a line).

Hmm, that’s a good point. I don’t use them myself so that’s not a problem for me, but it probably should preserve those by default.

This plugin will trim extra spaces in a selection: GitHub - Benature/obsidian-text-format: Format seleted text in Obsdidian.md

2 Likes

I’d love to be able to highlight trailing whitespace as well as can be done in Sublime using the HighlightTrailingWhitespace package. Here’s an example:
image

1 Like

:wave:t2: Was also looking for this, so I built it.

It’s now available in the Community Plugins browser, too! Would love to hear thoughts on it.

1 Like

Plugin Text Format now supports removing trailing spaces after v2.6.0

(issue: Feature request: Trim trailing spaces · Issue #61 · Benature/obsidian-text-format · GitHub)