Closed rmartine-ias closed 1 year ago
Why do you wonder about this?
A markdown-parsing tool I use panics with a newline in the image description: https://github.com/swsnr/mdcat/issues/194
(inline code so as to not link this issue and start any drama).
I wonder about the desired behavior mostly out of curiosity. I wanted a test so that this, and other tools, have something to reference for this case.
Apologies if this is the wrong forum for this, I haven't engaged with commonmark before.
So panics are no good of course! But yeah, I'd say line endings are definitely supported. There's nothing that says otherwise. And it's out there in the wild. Ik not opposed to a test case nut I'm more: its the only thing that makes sense, is it really/even needed!
They're definitely allowed, not just by commonmark but by every markdown implementation I've ever seen: Babelmark link.
On whether to collapse the newline to a space in the rendered output: I think we can leave this up to the renderer; in HTML the two options are completely equivalent.
@jgm that handling isn’t always true anymore, see https://github.com/commonmark/commonmark-spec/issues/744.
That being said, only keeping the line ending, allows the renderer (such as a browser) to choose this. As the render might do things differently. Turning it into a space prevents the renderer (a browser) from doing that.
Image descriptions can sometimes span multiple lines -- for example, if wrapping at 80 characters. This seems to be allowed by the spec, and works on the dingus.
Example:
I am requesting two things:
Clarification on whether the newline should be included in the rendered HTML, or if whitespace should be collapsed into a single space. Right now it is included:
A test case where the image description contains a newline