executablebooks / mdformat-myst

Mdformat plugin for MyST compatibility
MIT License
8 stars 2 forks source link

Block attributes formatting introduce extra empty line #25

Open kdeldycke opened 1 year ago

kdeldycke commented 1 year ago

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."}

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](https://myst-parser.readthedocs.io/en/latest/syntax/optional.html#block-attributes).

### Reproduce the bug

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

```shell-session
$ mdformat ./block-attributes.md
$ cat ./block-attributes.md
{caption="`GROUPS` - Description."}

```mermaid
flowchart
    (...)

### List your environment

```shell-session
$ mdformat --version
mdformat 0.7.16 (mdformat_myst: 0.1.5, mdformat_tables: 0.4.1, mdformat_frontmatter: 2.0.1)
welcome[bot] commented 1 year ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada: