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

Blockquote alert errors with MDX and Next.js #5

Open
TommySorensen opened this issue Dec 13, 2024 · 3 comments
Open

Blockquote alert errors with MDX and Next.js #5

TommySorensen opened this issue Dec 13, 2024 · 3 comments

Comments

@TommySorensen
Copy link

TommySorensen commented Dec 13, 2024

Just wanted to let you know this plugin does not work with latest version of Next.js using MDX from https://nextjs.org/docs/app/building-your-application/configuring/mdx using turbopack https://nextjs.org/docs/app/building-your-application/configuring/mdx#using-plugins-with-turbopack

I havent added an example, but i'm using pretty simple setup like the docs

// next.config.mjs

import createMDX from '@next/mdx';

const nextConfig = {
  pageExtensions: ['mdx', 'tsx'],
};

const withMDX = createMDX({
  options: {
    remarkPlugins: [[''remark-github-blockquote-alert''],['remark-gfm']],
    rehypePlugins: [],
  },
});

export default withMDX(nextConfig);

It throws this error:

 ⨯ ./src/app/test/page.mdx
Error evaluating Node.js code
TypeError: attacher.call is not a function
    [at Function.freeze (node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:636:36)]
    [at Function.process (node_modules/.pnpm/[email protected]/node_modules/unified/lib/index.js:716:10)]
    [at process (node_modules/.pnpm/@[email protected][email protected]/node_modules/@mdx-js/mdx/lib/util/create-format-aware-processors.js:63:22)]
    [at Proxy.loader (node_modules/.pnpm/@[email protected][email protected]/node_modules/@mdx-js/loader/lib/index.js:89:3)]
    [at /node_modules/.pnpm/@[email protected][email protected]/node_modules/@mdx-js/loader/index.cjs:32:26]

So my question is if this package been tested with MDX?

@jaywcjlove
Copy link
Owner

@TommySorensen The potential issue lies in the format of remark-github-blockquote-alert:
There is an extra set of quotes around the plugin name. The correct format should be:

remarkPlugins: [['remark-github-blockquote-alert'], ['remark-gfm']],

However, I’m not entirely sure if your error is caused by remark-github-blockquote-alert.

@TommySorensen
Copy link
Author

TommySorensen commented Dec 16, 2024

My bad. This was a copy/paste paste mistake when copying the code to this Github Issue. I can confirm that the issue is still there with correctly configuration.

remarkPlugins: [['remark-github-blockquote-alert'], ['remark-gfm']],

It looks like the error rely inside MDX code, but cause by this plugin. Everything works fine if i remove the plugin from the next.config. I tested both with and without using the syntax for alerts

@jaywcjlove
Copy link
Owner

I'm a bit puzzled by this issue because I haven't encountered anything similar when using it elsewhere. @TommySorensen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants