Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unformatted mdx doesn't work #2053

Closed
4 tasks done
fawazahmed0 opened this issue May 29, 2022 · 2 comments
Closed
4 tasks done

Unformatted mdx doesn't work #2053

fawazahmed0 opened this issue May 29, 2022 · 2 comments
Labels
🙋 no/question This does not need any changes 👎 phase/no Post cannot or will not be acted on

Comments

@fawazahmed0
Copy link

fawazahmed0 commented May 29, 2022

Initial checklist

Affected packages and versions

2.1.1

Link to runnable example

No response

Steps to reproduce

The below doesn't work in mdx

  <div>Hello world
  </div>

But this works fine

  <div>
Hello world
  </div>

You can test on playground

Expected behavior

Unformatted mdx should work fine

Actual behavior

Unformatted mdx doesn't work

Runtime

No response

Package manager

No response

OS

No response

Build and bundle tools

No response

@ChristianMurphy
Copy link
Member

In MDX JSX content can either be inline

  <div>Hello world</div>

or a block

  <div>
    Hello world
  </div>

Content cannot be a mix of both.
The syntax error is expected in this case.

  <div>Hello world
  </div>

@ChristianMurphy ChristianMurphy closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2022
@ChristianMurphy ChristianMurphy added 🙋 no/question This does not need any changes 👎 phase/no Post cannot or will not be acted on labels May 29, 2022
@fawazahmed0
Copy link
Author

fawazahmed0 commented May 29, 2022

I had huge number of mdx files, which were generated using a script.

If anyone faces similar issue as mine , you can use prettier to format mdx.

npx prettier --write pathToMDXFolder

or

const prettier = require("prettier")
let prettifiedMDX = prettier.format( mdxString,{  parser: "mdx" });

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 no/question This does not need any changes 👎 phase/no Post cannot or will not be acted on
Development

No branches or pull requests

2 participants