question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remark and rehype plugins not working to render markdown links

See original GitHub issue

Version

@nuxt/content: 1.15.1 nuxt: 2.15.7

Reproduction Link

https://github.com/hiurequeiroz/my-page

Steps to reproduce

I add the rehype plugin (I try with remark plugin too) yarn add rehype-external-links

Put the conf in nuxt.config.js:

content: {
    markdown: {
      rehypePlugins: () => [
        'rehype-external-links'
      ]
    }
  },

And in my markdown files i put some links

[instituto pandavas](http://institutopandavas.org.br)

What is Expected?

I expected nuxt render the markdown links

What is actually happening?

The final page dont render the links

I get this error:

 ERROR  Error [ERR_REQUIRE_ESM]: require() of ES Module /mnt/Arquivos/gits/pagina-hiure/node_modules/rehype-external-links/index.js from /mnt/Arquivos/gits/pagina-hiure/node_modules/@nuxt/content/lib/utils.js not supported.
Instead change the require of index.js in /mnt/Arquivos/gits/pagina-hiure/node_modules/@nuxt/content/lib/utils.js to a dynamic import() which is available in all CommonJS modules.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
moudevcommented, Mar 28, 2022

I have the same problem.

@nuxt/content”: “^1.15.1” “nuxt”: “^2.15.8”

I’m trying to use: “remark-emoji”: “^3.0.2”

Apparently, it’s related to; “Note that this package is ESM only from v3.0.0 since remark packages migrated to ESM.”. https://github.com/rhysd/remark-emoji#usage

Edit: I solved it using the version of the package that uses require() instead of import

0reactions
Tahulcommented, May 4, 2022

Hey!

As we are using latest versions of Remark & Rehype and Nuxt 3 gives support for ESM modules, all of this should be fine using @nuxt/content v2.

I am so closing this issue, but feel free to re-open if you still have the problem!.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transforming Markdown with Remark & Rehype - ryanfiller.com
Writing custom plugins to give extra powers to Markdown syntax using the Unified ecosystem.
Read more >
Using Remark and Rehype plugins with MDX in Next.js (with ...
I tried running this, using the yarn dev and everything works, except that none of the markdown plugins are functioning at all. (The...
Read more >
Next.js with MDX tips: Provide shortcuts to article headings
This tutorial will teach you how to automatically add links to heading tags in your mdx posts on your Next.js site with a...
Read more >
react-markdown | Yarn - Package Manager
react-markdown ... React component to render markdown. ... (migrate by renaming it to remarkPlugins ); 36e4916 Update remark-rehype , add support for ...
Read more >
remark - Keywords - unified
remark plugin that turns markdown into HTML to support rehype ... configure remark-lint with rules that prevent mistakes or stuff that fails across...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found