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

Turining off "rehype-slug" adds undefiend anchor link #1864

Closed
melnikovdv opened this issue Jan 30, 2023 · 3 comments
Closed

Turining off "rehype-slug" adds undefiend anchor link #1864

melnikovdv opened this issue Jan 30, 2023 · 3 comments

Comments

@melnikovdv
Copy link

Environment

  • Operating System: Darwin
  • Node Version: v16.15.1
  • Nuxt Version: 3.1.1
  • Nitro Version: 2.1.0
  • Package Manager: yarn@1.22.15
  • Builder: vite
  • User Config: build, vite, typescript, modules, app, googleFonts, content, yandexMetrika
  • Runtime Modules: @nuxtjs/tailwindcss@6.3.0, @nuxtjs/google-fonts@3.0.0-1, @nuxt/content@2.4.2, yandex-metrika-module-nuxt3@1.5.1
  • Build Modules: -

Reproduction

Any nuxt3 project with content module

Describe the bug

If I turn off rehype-slug plugin, it still adds undefined link to headers.

content: {
    markdown: {
      rehypePlugins: {   
        "rehype-slug": false
      }
    }
  },

What I then get in html:

<a href="#undefined"><!--[-->My test header<!--]--></a>

Additional context

No response

Logs

No response

@nobkd
Copy link
Contributor

nobkd commented Jan 30, 2023

If you just want to disable anchor link generation on headings, you can do so by setting anchorLinks option in the nuxt.config.ts to false.

But you also have a point, that it should automatically be disabled, if id is undefined.

@melnikovdv
Copy link
Author

Thank you, I haven't noticed this option. Now it works as expected with the anchorLinks turned off.

@nobkd
Copy link
Contributor

nobkd commented Mar 8, 2023

Should be fixed with https://github.com/nuxt/content/releases/tag/v2.5.0

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