'Trim trailing whitespace' pref discards valid Markdown formatting

Number:rdar://35531164 Date Originated:11/14/17
Status:Open Resolved:
Product:Developer Tools Product Version:9.1
Classification:Crash/Hang/Data Loss Reproducible:Always
The Markdown syntax uses two or more spaces at the end of a line to indicate a newline. (https://daringfireball.net/projects/markdown/syntax)

If the 'trim trailing whitespace' pref is turned on in Xcode, these meaningful whitespace characters are trimmed from Markdown documents.

It is not particularly useful to have to remember to turn that preference off when editing a Markdown document in Xcode, and then turn it back on when you are finished.

Categorized as data loss since this preference strips meaningful formatting data from the Markdown document.

Steps to Reproduce:
- Make sure the 'trim trailing whitespace' pref is turned on
  (Preferences > Text Editing > Editing)
- Edit a Markdown document in Xcode.
- Attempt to type a line with two space characters at the end and hit return
- The meaningful spaces at the end of the line are removed

Expected Results:
Expected to be able to edit Markdown in Xcode without being hampered by a preference that makes sense in source code files, but does not make sense in a Markdown file.

Would be great if Xcode considered those two trailing spaces to be meaningful (since they are in Markdown) and not strip them, even when the preference is turned on.

Actual Results:
Either have to keep turning preference on and off depending on what type of file I am editing. Or can't use Xcode to edit Markdown.

Xcode Version 9.1 (9B55)

2016 15" Touch Bar MacBook Pro


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!