From 260b808152e125ba80483c206bd693e4bceb8129 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 4 Feb 2025 17:04:58 -0700 Subject: [PATCH 1/2] 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. --- spec.txt | 67 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/spec.txt b/spec.txt index a4c7ed70..9cc86a04 100644 --- a/spec.txt +++ b/spec.txt @@ -424,6 +424,30 @@ code block starting with two spaces. ```````````````````````````````` +As a consequence of tab stop calculations, wrapping a line in a +block quote may involve removing spaces. + +```````````````````````````````` example + - → this line has three spaces worth of indentation + - >→ 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) + - >→for a truly equivalent line, we need to remove spaces +. + +```````````````````````````````` + ```````````````````````````````` example -→→foo . @@ -3689,11 +3713,12 @@ these constructions. (A recipe is provided below in the section entitled ## Block quotes -A [block quote marker](@), -optionally preceded by up to three spaces of indentation, -consists of (a) the character `>` together with a following space of -indentation, or (b) a single character `>` not followed by a space of -indentation. +A [block quote marker](@) is either complete or incomplete. +A [complete block quote marker](@) consists of the character `>` together with +a following space of indentation. +An [incomplete block quote marker](@) consists of the character `>`, and +cannot have a space or a tab after it. +Any block quote marker may be preceded by up to three spaces of indentation. The following rules define [block quotes]: @@ -3702,6 +3727,16 @@ The following rules define [block quotes]: marker] to the beginning of each line in *Ls* is a [block quote](#block-quotes) containing *Bs*. + To prepend a [complete block quote marker] to a line, calculate its + indentation without the list marker at the current tab stop (N1), + then insert `>` at the start of the line, then calculate its indentation at + the same tab stop (N2, which will equal N1 unless the line starts with a tab), + then add M=N1+1-N2 spaces of indentation (if M is negative, remove spaces). + + An [incomplete block quote marker] can be be used instead, but + only if the line does not start with a space or tab. A single block quote + container can use a mix of both marker styles. + 2. **Laziness.** If a string of lines *Ls* constitute a [block quote](#block-quotes) with contents *Bs*, then the result of deleting the initial [block quote marker] from one or @@ -4095,15 +4130,20 @@ baz

```````````````````````````````` -When including an indented code block in a block quote, -remember that the [block quote marker] includes -both the `>` and a following space of indentation. So *five spaces* are needed -after the `>`: +When quoting an indented code block or multi-line list item, +remember that the [complete block quote marker] must be used. +So *five spaces* are needed after the `>`: ```````````````````````````````` example > code > not code + +>- first paragraph in list item using an incomplete block quote marker +> +> the second paragraph must use a complete block quote marker +> +> not the third paragraph .
code
@@ -4112,6 +4152,15 @@ after the `>`:
 

not code

+
+
    +
  • +

    first paragraph in list item using an incomplete block quote marker

    +

    the second paragraph must use a complete block quote marker

    +
  • +
+

not the third paragraph

+
```````````````````````````````` From 0dcc1c3f735a64d71bff6a44c9d4fbeb56062dfc Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Wed, 5 Feb 2025 09:22:47 -0700 Subject: [PATCH 2/2] Clean up some incorrect language now that I slept on it Thanks, woorm, for catching that "list marker" mistake. --- spec.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.txt b/spec.txt index 9cc86a04..abcb1246 100644 --- a/spec.txt +++ b/spec.txt @@ -3728,9 +3728,9 @@ The following rules define [block quotes]: is a [block quote](#block-quotes) containing *Bs*. To prepend a [complete block quote marker] to a line, calculate its - indentation without the list marker at the current tab stop (N1), + indentation without the block quote marker at the current column (N1), then insert `>` at the start of the line, then calculate its indentation at - the same tab stop (N2, which will equal N1 unless the line starts with a tab), + the same column (N2, which will equal N1 unless the line starts with a tab), then add M=N1+1-N2 spaces of indentation (if M is negative, remove spaces). An [incomplete block quote marker] can be be used instead, but