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

How to add remark and rehype plugins #242

Open
imlautaro opened this issue Aug 1, 2024 · 2 comments
Open

How to add remark and rehype plugins #242

imlautaro opened this issue Aug 1, 2024 · 2 comments

Comments

@imlautaro
Copy link

imlautaro commented Aug 1, 2024

I've been trying to add the plugins "remark-math" and "rehype-mathjax" to the MDC configuration but it doesn't work and the "docs" are not clear about that.

It works with the @nuxt/content module, but I need it to work with the MDC module because my markdown is coming from a database, not from the content directory.

What I tried in my nuxt.config.ts file:

mdc: {
  remarkPlugins: {
	remarkMath: {
		src: 'remark-math',
	},
},
rehypePlugins: {
	rehypeMathjax: {
		src: 'rehype-mathjax',
	},
  },
},
@JoaoVCMiranda
Copy link

Hi there!

Thank you for sharing, I'm facing a similar issue but with content directories

But I tried to use the CDN approach. And nuxt wouldn't let me have a tag in the tree.

With CDN you would need to do something about the "hydration" module on nuxt (Which I'm not sure yet of how it works).

@jonasfroeller
Copy link

jonasfroeller commented Sep 19, 2024

I am not sure. I tried it the same way as remark-flexible-code-titles, which worked, but for remark-math it didn't. Then i switched to [require.resolve('remark-math')], which unfortunately doesn't seem to work too.

my configuration:

{
  mdc: {
    remarkPlugins: {
      [require.resolve('remark-math')]: {},
      'remark-flexible-code-titles': {},
    },
    rehypePlugins: {
      [require.resolve('rehype-katex')]: {},
    },
    highlight: {
      highlighter: 'shiki',
      theme: {
        dark: 'github-dark',
        default: 'github-light',
      },
      langs: supportedShikiLanguages,
    },
  },
}

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

3 participants