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

Nested attributes are ignored #1452

Closed
tobiasdiez opened this issue Aug 15, 2022 · 1 comment · Fixed by nuxtlabs/remark-mdc#51
Closed

Nested attributes are ignored #1452

tobiasdiez opened this issue Aug 15, 2022 · 1 comment · Fixed by nuxtlabs/remark-mdc#51

Comments

@tobiasdiez
Copy link

Environment

  • Operating System: Linux
  • Node Version: v16.16.0
  • Nuxt Version: 3.0.0-rc.8
  • Package Manager: yarn@1.22.19
  • Builder: vite
  • User Config: alias, nitro, ssr, meta, css, modules, watch, runtimeConfig, serverHandlers, storybook, vite
  • Runtime Modules: @nuxtjs/tailwindcss@5.3.1, @pinia/nuxt@0.4.0, ./modules/storybook, ./modules/graphql, nuxt3-runtime-compiler-module@1.0.4, @nuxt/content@2.0.1
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-fxpgdf?file=content/index.md

Describe the bug

Given the following markdown content

![Nuxt](https://nuxtjs.org/design-kit/colored-logo.svg){.h-6}
[![Nuxt](https://nuxtjs.org/design-kit/colored-logo.svg){.h-6}](https:test)

in the rendered html, the first image the class h-6 is present, in the second not.

Additional context

No response

Logs

No response

@ManasMadrecha
Copy link

ManasMadrecha commented Aug 15, 2022

The issue is only for images inside a.


Nested attributes work properly for other elements. For example, this

[[Hooray]{.text-red-100}]{.bg-pink-50}

gives this correct ast (as per https://content.nuxtjs.org/playground)

{
        "type": "element",
        "tag": "p",
        "props": {},
        "children": [
          {
            "type": "element",
            "tag": "span",
            "props": {
              "class": "bg-pink-50"
            },
            "children": [
              {
                "type": "element",
                "tag": "span",
                "props": {
                  "class": "text-red-100"
                },
                "children": [
                  {
                    "type": "text",
                    "value": "Hooray"
                  }
                ]
              }
            ]
          }
        ]
      },

Even this

![Nuxt](https://nuxtjs.org/design-kit/colored-logo.svg){.abc}

gives proper ast

{
        "type": "element",
        "tag": "p",
        "props": {},
        "children": [
          {
            "type": "element",
            "tag": "img",
            "props": {
              "alt": "Nuxt",
              "src": "https://nuxtjs.org/design-kit/colored-logo.svg",
              "class": "abc"
            },
            "children": []
          }
        ]
      },

But this, i.e., image in a

[![Nuxt](https://nuxtjs.org/design-kit/colored-logo.svg){.nest}](https:test)

gives this wrong ast (Note: no class seen)

      {
        "type": "element",
        "tag": "p",
        "props": {},
        "children": [
          {
            "type": "element",
            "tag": "a",
            "props": {
              "href": "https:test",
              "rel": [
                "nofollow"
              ]
            },
            "children": [
              {
                "type": "element",
                "tag": "img",
                "props": {
                  "alt": "Nuxt",
                  "src": "https://nuxtjs.org/design-kit/colored-logo.svg"
                },
                "children": []
              }
            ]
          }
        ]
      },

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

Successfully merging a pull request may close this issue.

2 participants