Rstudio editor. Visualizing spaces at line ends



While R code is happily inattentive to end of line spaces, bookdown/knitr takes 2 or more spaces at the end of a line as an indication that the next line of text is a true new line, at least when using bookdown::renderbook().
Fixing this has me wandering around in the text search for double spaces at the end of lines, which is challenging because spaces are spaces and can't readily be seen. I would like to have less of these errors in my text in the first place.

While fixing this can be done with a global search and replace, it would be nice if there was a way to see these double spaces in the editor.

As always, many thanks for this wonderful tool.



In Tools -> Global Options -> Code -> Display, check "Show whitespace characters". This will let you see spaces and newlines in the editor: