Skip to content

Extraneous indent for mdxJsxTextElements during stringify #9

Closed
@tonywu6

Description

@tonywu6

Initial checklist

Affected packages and versions

mdast-util-mdx-jsx@2.1.3, remark-mdx@2.3.0, remark-parse@10.0.2, remark-stringify@10.0.3

Link to runnable example

https://codesandbox.io/p/sandbox/nostalgic-cloud-fdvyzk

Steps to reproduce

Maybe introduced here?

const depth = inferDepth(context)

With default options, parse and then stringify a MDX document containing a mdxJsxTextElement nested inside a mdxJsxFlowElement, for example:

<div>
    Lorem ipsum <span>dolor</span> sit amet
</div>

Expected behavior

Input and output should be the same

Actual behavior

Inline elements have extra whitespace in front of them

<div>
    Lorem ipsum   <span>dolor</span> sit amet
</div>

Affected runtime and version

node@16.20

Affected package manager and version

pnpm@8.5.0

Affected OS and version

macOS Ventura 13.1

Build and bundle tools

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions