jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.81k stars 3.39k forks source link

Respect empty LineBlock lines in plain and ansi writers #10376

Closed silby closed 2 weeks ago

silby commented 2 weeks ago

The plain writer behaved as a markdown variant with Ext_line_blocks turned off, and so empty lines in a line block would get eliminated. This is surprising, since if there's anything where the intent can be preserved in plain text output it's empty lines.

It's still a bit surprising to have nbsps in plain text output, as in the test, where the distinction doesn't really matter, but that'd be an orthogonal change.

As presented here the change ignores whether the line_blocks extension is enabled. As a write-only format, I'm not sure whether it makes sense for the plain writer to behave differently in the presence or absence of this extension.

Ditto ANSI writer.

silby commented 2 weeks ago

An alternative here is that possibly T.P.Shared.linesToPara should become linesToParas and split paragraphs on empties in the list of lines, but I haven't studied that.

jgm commented 2 weeks ago

Good idea.