# Carriage returns and code blocks

#1

Indented and fenced code blocks don’t seem to preserve line endings as mandated by the spec:

4.4 says:

The contents of the code block are the literal contents of the lines, including trailing line endings, minus four spaces of indentation.

(4.5 simply says that the content is “all subsequent lines”, but I would think the same rule applies).

My reading of this is that if there’s a \r or \r\n on one of these lines it should be echoed back out in the resulting code block. However, cmark doesn’t do this. Try \t\foo\r\tbar or \nfoo\r\bar\n, in both cases the \r is converted to \n (same story for \r\n). This leads me to believe cmark is ignoring line endings in code blocks, which goes against what the spec says.

Personally I think normalizing the line endings would be a good thing, but I’m just wondering what’s correct here given what the spec says.