Skip to content

Custom attributes not working on headings #1304

@hacknug

Description

@hacknug

Environment

Reproduction

Open the playground and paste the following code:

# Doesn't [work]{.font-bold}

# [This one either]{.font-bold}

Does [work]{.font-bold}

[This one too]{.font-bold}

Describe the bug

You'll see how the AST shows the paragraphs getting their props but the headings get nothing.

Additional context

This is likely something related to rehype-slug. It's probably passing things down but the plugin ignores them.

I'd expect those attributes to be passed down to my inner span since I understand why this could be something not supported in projects using rehype-slug.

Even when disabling rehype-slug via config, I'm seeing links on those headings. The only difference is the headings don't get an id assigned and a warning shows in my console:

[Vue warn]: Missing required prop: "id"

This wasn't as easy to get to as I would have liked since the docs stated I could disable a plugin using the following config but v2.0.1 had no support for that syntax.

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

Might be a good idea to keep the versioned docs and edge in different subdomains/dirs. It's okay though since we all understand the tremendous work you're putting into this just to give it away for free 💖

Let me know how I can help with this 👍

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions