jgm / djot

A light markup language
https://djot.net
MIT License
1.63k stars 43 forks source link

A possible solution to the problem of redundant blank lines. #169

Closed itraveller1 closed 1 year ago

itraveller1 commented 1 year ago

First of all, thanks for your work!

The project is great, but the problem of redundant blank lines is turning off many potential users.

I suggest introducing the empty string equivalent as a separate hard break token, like \\<nl>. This solution is orthogonal to the existing rules and not only solves the problem of vertical space, but also, I think, makes the source text more readable by highlighting semantic headings.

For example:

## Section header \\
     Description line.

List header: \\
1. Item string.
2. Item string. \\
   - item
   - item
3. Item string.
jgm commented 1 year ago

This is a bit like @matklad's idea in https://github.com/jgm/djot/issues/128#issuecomment-1346678429 which uses || as a "block break" device.

As applied to this particular issue, I am not sure I see the utility. The people who don't want to insert a blank line before a list are probably also not going to want to put \\ at the end of the line. And from the point of view of readable source, I think that the blank lines are better: \\ is non-linguistic noise, whereas the blank lines visually set off the list as a distinct block, just as it would be set off in a published book.