Skip to content

Commit 260b808

Browse files
committed
Block quote marker revision
This is the simplest fix #460 that I can think of that matches the behavior of the reference implementation. It's not simple, because the behavior being described is complex, but it needs to be spelled out.
1 parent 02db52e commit 260b808

1 file changed

Lines changed: 58 additions & 9 deletions

File tree

spec.txt

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,30 @@ code block starting with two spaces.
424424
</blockquote>
425425
````````````````````````````````
426426

427+
As a consequence of tab stop calculations, wrapping a line in a
428+
block quote may involve removing spaces.
429+
430+
```````````````````````````````` example
431+
- → this line has three spaces worth of indentation
432+
- >→ if we just add a caret, we bump to the next tab stop and have six (but the quote eats one, so it's five)
433+
- >→for a truly equivalent line, we need to remove spaces
434+
.
435+
<ul>
436+
<li>this line has three spaces worth of indentation</li>
437+
<li>
438+
<blockquote>
439+
<pre><code> if we just add a caret, we bump to the next tab stop and have six (but the quote eats one, so it's five)
440+
</code></pre>
441+
</blockquote>
442+
</li>
443+
<li>
444+
<blockquote>
445+
<p>for a truly equivalent line, we need to remove spaces</p>
446+
</blockquote>
447+
</li>
448+
</ul>
449+
````````````````````````````````
450+
427451
```````````````````````````````` example
428452
-→→foo
429453
.
@@ -3689,11 +3713,12 @@ these constructions. (A recipe is provided below in the section entitled
36893713

36903714
## Block quotes
36913715

3692-
A [block quote marker](@),
3693-
optionally preceded by up to three spaces of indentation,
3694-
consists of (a) the character `>` together with a following space of
3695-
indentation, or (b) a single character `>` not followed by a space of
3696-
indentation.
3716+
A [block quote marker](@) is either complete or incomplete.
3717+
A [complete block quote marker](@) consists of the character `>` together with
3718+
a following space of indentation.
3719+
An [incomplete block quote marker](@) consists of the character `>`, and
3720+
cannot have a space or a tab after it.
3721+
Any block quote marker may be preceded by up to three spaces of indentation.
36973722

36983723
The following rules define [block quotes]:
36993724

@@ -3702,6 +3727,16 @@ The following rules define [block quotes]:
37023727
marker] to the beginning of each line in *Ls*
37033728
is a [block quote](#block-quotes) containing *Bs*.
37043729

3730+
To prepend a [complete block quote marker] to a line, calculate its
3731+
indentation without the list marker at the current tab stop (N1),
3732+
then insert `>` at the start of the line, then calculate its indentation at
3733+
the same tab stop (N2, which will equal N1 unless the line starts with a tab),
3734+
then add M=N1+1-N2 spaces of indentation (if M is negative, remove spaces).
3735+
3736+
An [incomplete block quote marker] can be be used instead, but
3737+
only if the line does not start with a space or tab. A single block quote
3738+
container can use a mix of both marker styles.
3739+
37053740
2. **Laziness.** If a string of lines *Ls* constitute a [block
37063741
quote](#block-quotes) with contents *Bs*, then the result of deleting
37073742
the initial [block quote marker] from one or
@@ -4095,15 +4130,20 @@ baz</p>
40954130
````````````````````````````````
40964131

40974132

4098-
When including an indented code block in a block quote,
4099-
remember that the [block quote marker] includes
4100-
both the `>` and a following space of indentation. So *five spaces* are needed
4101-
after the `>`:
4133+
When quoting an indented code block or multi-line list item,
4134+
remember that the [complete block quote marker] must be used.
4135+
So *five spaces* are needed after the `>`:
41024136

41034137
```````````````````````````````` example
41044138
> code
41054139

41064140
> not code
4141+
4142+
>- first paragraph in list item using an incomplete block quote marker
4143+
>
4144+
> the second paragraph must use a complete block quote marker
4145+
>
4146+
> not the third paragraph
41074147
.
41084148
<blockquote>
41094149
<pre><code>code
@@ -4112,6 +4152,15 @@ after the `>`:
41124152
<blockquote>
41134153
<p>not code</p>
41144154
</blockquote>
4155+
<blockquote>
4156+
<ul>
4157+
<li>
4158+
<p>first paragraph in list item using an incomplete block quote marker</p>
4159+
<p>the second paragraph must use a complete block quote marker</p>
4160+
</li>
4161+
</ul>
4162+
<p>not the third paragraph</p>
4163+
</blockquote>
41154164
````````````````````````````````
41164165

41174166

0 commit comments

Comments
 (0)