I want to let TextEdit never save <CR>, the carriage return.
Different operating systems save end-of-line as different Unicode characters. For MS DOS (like Windows) it is <CR><LF>, and for Unix and Mac <LF>, and for the very old Mac OS 9 just <CR>. Here <CR> is the carriage return, and <LF> the line feed.
When sometimes I paste, into TextEdit, several paragraphs from a Windows-created file, for example pdf or doc/docx, <CR>'s are also copied. TextEdit does not fully conform with Unix standards, in that it does accept <CR><LF>'s, by showing them indeed as line breaks. I cannot tell, then, whether a line break is Window-styled <CR><LF> or Unix-styled <LF>.
When I save my personal writings in pure text (txt) written in Markdown, I don't want these <CR>'s, but can neither see them, nor delete them in TextEdit. It is when I open the text file in question with Vim, did I spot those <CR>'s shown as ^M. Indeed, in Vim, it is easy to replace them with empty strings.
However, I too edit in TextEdit often. Can I set TextEdit so that it never saves <CR>'s in a buffer of its? That is, when I paste a <CR> in a buffer, the <CR> is ignored and not written.