Carriage return with plain text, but newline with markdown document

When using set theNote to plain text of theRecord I get text with newlines (\n) when the document type is a Plain Text Document, but carriage returns (\r) when the document type is a Markdown Document.

As both formats are plain text as source, I would expect them to both deliver the same (type) of plain text result. Is it expected behavior that Markdown Documents deliver results with a carriage return rather than a newline as line separator?

DEVONthink does neither convert line breaks nor prefer a certain one. Were the items created by DEVONthink or imported?

Found it - I was indeed reading the text in Applescript and adding a line. I didn’t expect that do shell script in Applescript would change the original string, but it does. I was using:

set theNote to plain text of theRecord
set commandString to echo & quoted form of theNote
set textNote to do shell script commandString

Adding without altering line endings fixed it!

set theNote to plain text of theRecord
set commandString to echo & quoted form of theNote
set textNote to do shell script commandString without altering line endings
3 Likes