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

remarkOptions not working #1608

Closed
tw1t611 opened this issue Aug 9, 2021 · 1 comment
Closed

remarkOptions not working #1608

tw1t611 opened this issue Aug 9, 2021 · 1 comment
Labels
🙋 no/question This does not need any changes

Comments

@tw1t611
Copy link

tw1t611 commented Aug 9, 2021

Subject of the issue

remark-break not working, when passed as remarkOptions in next-mdx-remote.

I am using next-mdx-remote to parse my markdown from a headless CMS.

I created an issue there, but the problem seems mdx related.
hashicorp/next-mdx-remote#177

import breaks from "remark-breaks";

... 

  const mdxSource = await serialize(source, {
    mdxOptions: {
      remarkPlugins: [breaks],
    },
  })

Your environment

  • OS: fedora 33
  • Packages: "next-mdx-remote": "^3.0.4"
  • Env: npm: 7.17.0, node: v14.15.3, Mozilla Firefox 90.0

Steps to reproduce

Parse markdown with line breaks.

Expected behaviour

One line break <br> should appear in parsed html.

Actual behaviour

It doesn't.

@ChristianMurphy
Copy link
Member

remark-breaks works with the version of MDX used in next-mdx-remote (1.6.x https://github.com/hashicorp/next-mdx-remote/blob/452755393f2bcadf1807f6398bf1429069acba42/package.json#L10)
Here is a running example showing the versions are compatible https://codesandbox.io/s/distracted-wescoff-3rde8?file=/src/App.js

It may be related to remark-breaksv3 being ESM https://github.com/remarkjs/remark-breaks/releases/tag/3.0.0, until recently (vercel/next.js#27069) Next has had issues loading ESM.
If there are ESM related warnings/errors shown in the console consider either:

  • Updating to a Next version that includes the ESM fixes
  • Or temporarily downgrading remark-breaks to version 2, until Next can be updated.

If no ESM related errors are thrown, this may be a bug in how next-mdx-remote handles plugins.

@ChristianMurphy ChristianMurphy added 🙋 no/question This does not need any changes and removed 🐛 type/bug This is a problem 🔍 status/open labels Aug 9, 2021
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
Development

No branches or pull requests

2 participants