Hard-wrapping: require subsequent lines to be indented/quoted?
rauschma opened this issue · 6 comments
Support for hard-wrapping is useful – e.g., Markdown is often used in code comments where hard-wrapping is the rule not the exception.
However, I’d prefer to have slightly stricter rules and require subsequent lines to be quoted/indented. Affected are: block quotes, list items and headings.
Block quotes:
<!-- Before -->
> This paragraph
continues here.
<!-- After -->
> This paragraph
> continues here.
Lists:
<!-- Before -->
* This paragraph
continues here.
<!-- After -->
* This paragraph
continues here.
Headings could work either like block quotes or like lists:
<!-- Before -->
## My excessively long section heading is too
long to fit on one line.
<!-- After – option 1 -->
## My excessively long section heading is too
## long to fit on one line.
<!-- After – option 2 -->
## My excessively long section heading is too
long to fit on one line.
Why make this requirement?
- The syntax becomes more consistent: Going from one paragraph to multiple paragraphs does not require changing the initial paragraph.
- With indenting/quoting, special characters have no effect. Compare:
1. My favorite number is probably the number 2. 2. Next item. 1. My favorite number is probably the number 2. 2. Next item.
- I find it more pleasant to read. Most texts are written once and read many times.
- There already are Markdown tools that hard-wrap while taking the stricter rules into consideration.
more pleasant to read
I agree. Of course, you now have the option to write your documents this way -- it's just not a requirement.
The syntax becomes more consistent: Going from one paragraph to multiple paragraphs does not require changing the initial paragraph.
I'm not quite sure what example you have in mind here.
I thought about disallowing laziness when first designing djot, but then I realized we'd still have to figure out how to deal with things like
> foo
bar
When we hit the second line bar
, the block quote still hasn't been closed (by a blank line). So what do we do? There are three alternatives:
- Throw an error. Currently djot doesn't do that; like markdown, it always gives you a parse.
- Parse it as a lazy continuation -- that is, add the text to the last open container.
- Parse it as a new paragraph.
I chose 2 partly on the grounds of syntactic consistency. 3 gives you a kind of inconsistency: normally you need a blank line before a new paragraph, but not right after a block quote.
I'm not quite sure what example you have in mind here.
List item with one paragraph:
* First paragraph
that continues in another line.
List item with two paragraphs – I had to indent the second line of the first paragraph.
* First paragraph
that continues in another line.
Second paragraph
that continues in another line.
Loosely related: Triple colons (:::
) don’t normally end a paragraph but they do so in a list item (unless that item is indented):
* First paragraph
continues here.
::: note
:::
I thought about disallowing laziness when first designing djot, but then I realized we'd still have to figure out how to deal with things like [...]
I’d parse it as a new paragraph – which is similar to how parsing behaves for other block constructs – e.g.:
> foo
::: bar
:::
List item with two paragraphs – I had to indent the second line of the first paragraph.
No you don't. This works fine:
* First paragraph
that continues in another line.
Second paragraph
that continues in another line.
Ah, OK. My bad!
I’d still prefer the rules to be the same:
- First paragraph: indentation optional
- Subsequent paragraphs: indentation required
Also, code blocks and divs seem to require indentation even if they come first:
* ```
abc
```
* ::: div
abc
:::
Also, code blocks and divs seem to require indentation even if they come first:
Yes, because lazy lines are only possible for paragraph content.
(I’m closing the issue. I think the discussion is finished. Both positions are reasonable.)