Skip to content

Markdown images missing alt attributes #16621

@jlwalkerlg

Description

@jlwalkerlg

Astro Info

Astro                    v6.2.2
Vite                     v7.3.2
Node                     v22.22.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/mdx (v5.0.4)
                         @astrojs/sitemap (v3.7.2)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I have the following line in src/content/blog/markdown-style-guide.md (line 42):

![](../../assets/blog-placeholder-about.jpg)

I would expect that to output an img tag with an empty alt attribute (alt=""), but it actually doesn't output any alt attribute at all -- it's completely missing from the img tag.

I found this issue but it appears to have been resolved back in 2022, so it looks like the issue has resurfaced.

What's the expected result?

![](../../assets/blog-placeholder-about.jpg) in markdown content should render an img tag with alt="".

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-prquajd2?file=src%2Fcontent%2Fblog%2Fmarkdown-style-guide.md

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)feat: markdownRelated to Markdown (scope)pkg: astroRelated to the core `astro` package (scope)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions