A possible solution to the problem of redundant blank lines. #170
Replies: 3 comments 12 replies
-
This is a bit like @matklad's idea in #128 (comment) 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 |
Beta Was this translation helpful? Give feedback.
-
I don't really see where this hostility to blank lines comes from. As @jgm says it would be there in print. The reason for that is that blank space between blocks enhances readability and anything which enhances readability is good. Also it does not increase file size that much since it is only one or two extra bytes each time. Lastly it makes automatic reformatting easier (although this is less important if you have a good reformatting function — I always reformat using Pandoc with the format at hand as both reader and writer!) I guess this comes from the one-line-per-paragraph crowd, whose obsession I, like jgm, don't understand.1 I do understand the one-sentence-per-line crowd better since that at least enhances diffing. It is anyway, as jgm repeatedly has said, important not to force the one-line-per-paragraph style on users. If blank lines is the price to pay for a saner parser I'll gladly pay it. It is vastly superior to adding extra non-blank noise to indicate the exception. I think it also may be that more people are using small screens nowadays, which I empathize with but don't sympathize with, because it usually comes with smaller font size/line height which ought to compensate. It isn't all that different from working in a terminal window, which many of us used to do even before handheld devices. tl;dr if a few extra blank lines in a plain text document drives some people away then maybe plain text editing isn't for them (and I challenge them to come up with a sane parser which meets their requirement without a lot of complication — I have tried it!) Footnotes
|
Beta Was this translation helpful? Give feedback.
-
Last try :) I understand that this topic has set the teeth on edge, but an attempt to comprehend it led to interesting conclusions. Since in a nutshell I fail to show the true essence of the problem, I decided to submit for your judgment a kind of essay. Solving the problem of blank lines in LML DjotProject "Djot"The LML syntax is important in areas where the focus of the work is shifted to the source text: keeping notes and blogs, writing articles, prototyping publications, etc. The main disadvantages of modern LMLs are usually an extension of their merits. For example, the ergonomics of Markdown comes at the cost of performance, while the completeness of Asciidoc comes at the cost of verbosity. Even Orgmode is losing appeal outside of its app. Attempts to create a truly universal LML only expanded their nomenclature, because came from the practice of plugging holes, not fundamental principles. But today we have such a chance - it's Djot. The Djot project is based on a set of principles that should ensure that the language is ergonomic, efficient, and extensible in a consistent way. Djot's main problemA well-composed and balanced syntax satisfies almost all the basic requirements for LML, but the abundance of empty lines in the source text causes subconscious irritation. The author of the project considers this problem to be a matter of aesthetic preferences and urges to put up with this syntax, since all other known approaches violate the fundamental principles. One single detail prevents Djot from becoming a truly popular and universal solution. The real cause of the blank lines problemDoes the blank line problem really just reflect established preferences, or is there something more fundamental at play here? Any text is essentially a set of related meanings, accentuated with the help of the format. Blank lines reflect the degree of semantic proximity between blocks of text in it, which significantly improves its readability. In Djot, blank lines are used only to separate blocks, which does not reflect their true nature. Observing a picture of evenly alternating blocks of text, our consciousness itself is forced to identify the degree of their semantic similarity, based on the context. This subconscious work and causes a feeling of irritation. What's stopping Djot from solving the blank lines problemThe most thorough method of text analysis is line by line. It gives maximum opportunities, but it also requires the same amount of resources. Djot saves a significant amount of resources by moving from line-by-line to block-by-block analysis. Now you do not need to check the format for each individual line. However, the price of this decision was a certain loss of flexibility in the analysis of blocks. The only natural block delimiter was the blank line. Any attempts to switch to other markers or a partial return to line-by-line analysis will contradict the main principles of the project: we lose either ergonomics or efficiency. Metablocks: Solving the Blank Line ProblemIf neither line-by-line nor block-by-block analysis satisfies us, then we need some other basic structure. What if we try to return to empty lines their natural essence - the separation of semantic blocks? Djot, like Markdown, does not support semantic division. This decision is based on the fact that we are trying to implement only those format elements that are in demand in normal writing and already have established display forms. But the child was thrown out with the water: such things as list headings and descriptions for headings represent very popular and well-established forms, although the colon, as a marker of enumerations or explanations, has been used in ordinary writing for a long time and everywhere. Due to line-by-line analysis, Markdown partially eliminates this problem, but for Djot this has become an unsolvable task. Let's call a group of semantically related blocks a metablock. Empty lines will be used to delimit metablocks (taking into account nesting in containers), and a colon will serve as a natural marker for separating metablocks into blocks. Conditional break markerLet's name the new marker "cond break". It should be noted that we do not need any colon, but only the one at the end of the line.
The decision on the need for a break will be made based on a comparison of the formats of the separated strings. If the string formats are completely the same, then nothing needs to be broken. Otherwise, for example when moving from a header to a simple line, from a simple line to a list, or from a key line to something else, we will get a gap between blocks. Thus, the decision to break will be made depending on the continuation format. Since the colon can be used directly in text, we need two kinds of cond break markers: with and without preserving the character:
ConclusionThe proposed solution to the empty lines problem in Djot is not just syntactic sugar: metablocks implement that part of the semantic markup that is clearly identified and is ubiquitous in almost any text. Metablocks do not claim to be mandatory inclusion in the AST. This is a support structure. The main purpose of the metablocks is to preserve the natural structure of the source text in Djot without violating the core principles of the project. An example of Djot source text with metablocks:
And the same, but without metablocks:
|
Beta Was this translation helpful? Give feedback.
-
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:
Beta Was this translation helpful? Give feedback.
All reactions