Live Preview: Support code blocks in quotes

Steps to reproduce

Paste this into a note:

> ```ts
> for (const el of array) {
>     console.log('Hello world')
> }
> ```

Expected result

Instead of looking like this (a code block in a block quote):

for (const el of array) {
    console.log('Hello world')
}

Actual result

It shows up like this in Live Preview.

Environment

  • Operating system: Manjaro
  • Debug info:

Additional information

Licat confirmed that it is a parser bug.

11 Likes

Steps to reproduce

  1. Turning on the live preview mode
  2. Create a note with code block inside a block quote:
Quote:

> Add the `-Z` (aka `--null`) flag to `grep`, and the `-0` (also aka `--null`) flag to `xargs`. This will output NUL terminated file names, and tell `xargs` to read NUL terminated arguments.
>
>eg.
>
> ```shell
> grep -irlZ $schema $WORKDIR/ | xargs -0 sed -i 's/'"$schema"'/EXI1/gI'
> ```

Expected result

The above note should be rendered properly in live preview mode, as the same as in the preview mode:

Actual result

The code block within the block quote is not rendered properly.

Environment

  • Operating system:
  • Debug info:
    SYSTEM INFO:
    Obsidian version: v0.13.18
    Installer version: v0.12.3
    Login status: logged in
    Catalyst license: insider
    Insider build toggle: on
    Live preview: on
    Legacy editor: off
    Base theme: dark
    Community theme: none
    Snippets enabled: 0
    Safe mode: on

RECOMMENDATIONS:
none


Additional information

No

5 Likes

As a workaround, I’ve started to make my quotes admonitions.
I.e. adding > [!quote] at the start of the quote block solves the problem. I.e. code blocks are rendered ok. But then full quote is an admonition, which is not what everybody would like.

1 Like

Hi, any update on this FR? I’ve notices this as well, I thought on first instance that the code block weren’t working inside quote blocks, but then I switched to read mode and it’s properly rendered…

1 Like