dprint / dprint-plugin-markdown

Markdown code formatting plugin for dprint.
MIT License
25 stars 9 forks source link

dprint breaks the code-block inside quote #89

Closed azzamsa closed 1 month ago

azzamsa commented 11 months ago

Describe the bug

dprint breaks the code-block inside quote.

Before vs After image

dprint-plugin-markdown version: markdown-0.16.2.wasm

Input Code

> Internally, with the builder this is something like
>
> ```rust
> Element {
>   tag: "main",
>   attrs: vec![("class", "text-center")],
>   children: vec![
>     Element {
>       tag: "div",
>       attrs: vec![("class", "flex-col")],
>       children: vec![
>         Element {
>           tag: "button",
>           attrs: vec![],
>           children: vec!["Click me"]
>         },
>         Element {
>           tag: "p",
>           attrs: vec![("class", "italic")],
>           children: vec!["Text"]
>         }
>       ]
>     }
>   ]
> }
> ```
>
> This is a _bunch_ of small allocations and separate strings,
> and in early 0.1 versions we used a `SmallVec` for children and
> attributes and actually caused some stack overflows.
>
> But if you look at the view itself you can see that none of this
> will _ever_ change. So we can actually optimize it at compile
> time to a single `&'static str`:

Expected Output

Just, don't break it.

Actual Output

> Internally, with the builder this is something like
>
> ```rust
> Element {
>   tag: "main",
>   attrs: vec![("class", "text-center")],
>   children: vec![
> ```

     Element {
    tag: "div",
    attrs: vec![("class", "flex-col")],

    > children: vec![
    >   Element {

          tag: "button",
    attrs: vec![],
    children: vec!["Click me"]

    > },
    > Element {

          tag: "p",
    attrs: vec![("class", "italic")],
    children: vec!["Text"]

    >   }
    > ]

    }

> ]
> }
>
> ````