Skip to content

Block attributes formatting introduce extra empty lineΒ #25

@kdeldycke

Description

@kdeldycke

Describe the bug

context
When block attributes are formatted, an extra line is added.

expectation
I expect the following MyST code to be left as-is by mdformat, as it looks pretty well formatted to me:

{caption="`GROUPS` - Description."}
```mermaid
flowchart
    (...)
```

bug
But instead, the code above gets re-formatted like this:

{caption="`GROUPS` - Description."}

```mermaid
flowchart
    (...)
```

Notice the extra blank line introduced.

problem
I think this is a problem if I compare all canonical reference from the MyST-parser documentation.

Reproduce the bug

$ cat ./block-attributes.md
{caption="`GROUPS` - Description."}
```mermaid
flowchart
    (...)
```
$ mdformat ./block-attributes.md
$ cat ./block-attributes.md
{caption="`GROUPS` - Description."}

```mermaid
flowchart
    (...)
```

List your environment

$ mdformat --version
mdformat 0.7.16 (mdformat_myst: 0.1.5, mdformat_tables: 0.4.1, mdformat_frontmatter: 2.0.1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions