Skip to content

Extra indentation added to indented dollar math equations #37

@e13h

Description

@e13h

Describe the bug

I don't expect any formatting changes to be applied to an indented dollar math equation, but every time I run the formatter it prepends whitespace to all but the first line of the dollar math equation.

This is a problem because it means the formatter never is successful when there is an indented dollar math equation.

Reproduce the bug

Input:

No issues here.

$$
x = 2y
$$

1. Formatter incorrectly inserts whitespace here.

   $$
   x = 2y
   $$

Output:

No issues here.

$$
x = 2y
$$

1. Formatter incorrectly inserts whitespace here.

   $$
         x = 2y
         $$

And if you run it again, it adds even more whitespace:

No issues here.

$$
x = 2y
$$

1. Formatter incorrectly inserts whitespace here.

   $$
               x = 2y
               $$

List your environment

python 3.10.12
ubuntu 22.04
mdformat==0.7.22
mdformat-myst==0.2.1

Executed via mdformat CLI in a python virtual env:

python3.10 -m venv foo
source foo/bin/activate
pip install mdformat mdformat-myst
# Create a file test.md with contents listed above
mdformat ./test.md

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