Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Respect empty LineBlock lines in plain and ansi writers #10376

Merged
merged 2 commits into from
Nov 12, 2024
Merged

Conversation

silby
Copy link
Contributor

@silby silby commented Nov 11, 2024

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.

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.
@silby silby changed the title Respect empty LineBlock lines in plain writer Respect empty LineBlock lines in plain and ansi writers Nov 11, 2024
@silby
Copy link
Contributor Author

silby commented Nov 11, 2024

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
Copy link
Owner

jgm commented Nov 12, 2024

Good idea.

@jgm jgm merged commit a4b8591 into jgm:main Nov 12, 2024
9 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants