Markdown: fenced code block within block quote loses quotes after one line

Issue #817 resolved
Kuro Kurosaka created an issue

When there is a fenced code block (the lines sandwiched between the lines of the three backslashes) is placed in a block quote (a block of lines where each line starts with a block quote marker '> ' ) as in:

> quoted block
> ```
> code line 1
> code line 2
> code line 3
> ```
> fenced block ended above
>

The block quote ended above.

only the first line of of the fenced lines retains the block quote marker after extraction and merge. All lines after the first line of the fenced block lose the marker including the lines after the fenced block.

> quoted block
> ```
> code line 1
code line 2
code line 3
```
fenced block ended above


The block quote ended above.

To reproduce, use the attached quoted-fenced-block.md:

    ./tikal.sh -x quoted-fenced-block.md

    ./tikal.sh -m quoted-fenced-block.md.xlf

The resulting quoted-fenced-block.md.out.md doesn't have the block quote marker after the first line of the fenced block.

A error message "Something's not right in block quote...." is observed on both runs of tikal.sh.

Reference: https://spec.commonmark.org/0.28/#fenced-code-blocks

Comments (6)

  1. Kuro Kurosaka reporter

    quoted-blocks.md includes triply nested block quote and quoted fenced block. The nested block quote loses the block quote marker as well. The quick code inspection suggests the current code is not prepared for quoting another block.

  2. Kuro Kurosaka reporter
    • changed version to M37

    When there is a fenced code block (the lines sandwiched between the lines of the three backslashes) is placed in a block quote (a block of lines where each line starts with a block quote marker '> ' ) as in:

    > quoted block
    > ```
    > code line 1
    > code line 2
    > code line 3
    > ```
    > fenced block ended above
    >
    
    The block quote ended above.
    

    only the first line of of the fenced lines retains the block quote marker after extraction and merge. All lines after the first line of the fenced block lose the marker including the lines after the fenced block.

    > quoted block
    > ```
    > code line 1
    code line 2
    code line 3
    ```
    fenced block ended above
    
    
    The block quote ended above.
    

    To reproduce, use the attached quoted-fenced-block.md:

        ./tikal.sh -x quoted-fenced-block.md
    
        ./tikal.sh -m quoted-fenced-block.md.xlf
    

    The resulting quoted-fenced-block.md.out.md doesn't have the block quote marker after the first line of the fenced block.

    A error message "Something's not right in block quote...." is observed on both runs of tikal.sh.

    Reference: https://spec.commonmark.org/0.28/#fenced-code-blocks

  3. Kuro Kurosaka reporter

    This bug fix will not address related issue #704. Only the code blocks that don’t have leading spaces will be handled properly.

    Other related bugs:

    • Issue #686
    • Issue #738 (maybe not a bug)
  4. Log in to comment