# Why not allow images without alt?

**URL:** <https://talk.commonmark.org/t/why-not-allow-images-without-alt/617>\
**Category:** Extensions\
**Created:** [September 16, 2014, 5:34pm UTC](https://talk.commonmark.org/t/why-not-allow-images-without-alt/617 "2014-09-16T17:34:43Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![zzzzBov](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/zzzzbov/32/218_2.png) [@zzzzBov](https://talk.commonmark.org/u/zzzzBov)\
**Post date:** [September 30, 2014, 2:49pm UTC](https://talk.commonmark.org/t/why-not-allow-images-without-alt/617/21 "2014-09-30T14:49:43Z")

</div>

I think it’s ridiculous to design a syntax that users would be explicitly warned against using.

the relative cost to the user of typing `![](image.png)` vs `!(image.png)` is not worth the relative cost to the implementers to try to support and standardize a feature that we don’t actually want them to use to begin with.

My vote is to axe this extension. The premise of

> Usually, nobody adds alt text to images in ordinary posts.

is flawed as it’s a failing of the author, not of the syntax.

---

<div class="post-metadata">

**Author:** ![chrisalley](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/chrisalley/32/906_2.png) [@chrisalley](https://talk.commonmark.org/u/chrisalley)\
**Post date:** [October 1, 2014, 2:34am UTC](https://talk.commonmark.org/t/why-not-allow-images-without-alt/617/22 "2014-10-01T02:34:13Z")

</div>

> [@zzzzBov](#):
>
> it’s a failing of the author, not of the syntax.

Some content management systems might let the user fill in the HTML alt, width, and height attributes in another part of the system. So the author would still be adding the alt tag, just not using Markdown.

---

<div class="post-metadata">

**Author:** ![zzzzBov](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/zzzzbov/32/218_2.png) [@zzzzBov](https://talk.commonmark.org/u/zzzzBov)\
**Post date:** [October 1, 2014, 4:02pm UTC](https://talk.commonmark.org/t/why-not-allow-images-without-alt/617/23 "2014-10-01T16:02:56Z")

</div>

> [@chrisalley](#):
>
> Some content management systems might let the user fill in the HTML alt, width, and height attributes in another part of the system. So the author would still be adding the alt tag, just not using Markdown.

If the system is going to automatically generate the alt text, then the following would make sense:

Explicitly empty `[alt]`: system provides alt text

```
![]({image-id})

```

renders as

```
<img src="/path/to/img.png" alt="image alt text"/>

```

Provided `[alt]`: overrides system alt text

```
![custom alt text]({image-id})

```

renders as

```
<img src="/path/to/img.png" alt="custom alt text"/>

```

In neither case is the removal of `[]` necessary.

---

<div class="post-metadata">

**Author:** ![chrisalley](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/chrisalley/32/906_2.png) [@chrisalley](https://talk.commonmark.org/u/chrisalley)\
**Post date:** [October 2, 2014, 10:00am UTC](https://talk.commonmark.org/t/why-not-allow-images-without-alt/617/24 "2014-10-02T10:00:08Z")

</div>

I basically agree with the method you described for adding the alt text from another source. The main reason for making `[]` optional is that `!(file.png)` looks cleaner than `![](file.png)`. So while the removal of `[]` is unnecessary, from an aesthetic perspective it might be beneficial. Maybe as an extension?

---

<div class="post-metadata">

**Author:** ![mofosyne](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/mofosyne/32/1438_2.png) [@mofosyne](https://talk.commonmark.org/u/mofosyne)\
**Post date:** [October 2, 2014, 10:43am UTC](https://talk.commonmark.org/t/why-not-allow-images-without-alt/617/25 "2014-10-02T10:43:29Z")

</div>

Probably not necessary to make it an extension if we use generic directive syntax. Since `!(file.png)`is just shorthand for `!default[](file.png){}` function. Which in javascript would be `defaultExtention("","file.png","");`.

Basically order of `[]` & `()` & `{}` is not important, and if any is missing, it is automatically added in as an empty bracket.

---

<div class="post-metadata">

**Author:** ![Bear\_Town](https://cdn.commonmark.org/letter_avatar_proxy/v2/letter/b/839c29/32.png) [@Bear\_Town](https://talk.commonmark.org/u/Bear_Town)\
**Post date:** [January 30, 2019, 2:14am UTC](https://talk.commonmark.org/t/why-not-allow-images-without-alt/617/26 "2019-01-30T02:14:03Z")

</div>

Sorry to continue this old conversation, but here’s my 2 cents.

I completely agree that alt should be optional. Alt attribute is misunderstood for the most part. Yes, it is required. But for many, if not most images on the web, it serves no value to say **specifically** what the image is. Rather than that, it should just describe what this image is in general, like icon, logo etc.

Markdown, in any use case other than a full-packed CMS, is meant to express images just decorating the content. It feels too weird to deliver the alt text for images like memes or visualisations of what we just said. Justifications stating that “HTML5 requires it” are not explaining why users should type it. They could, and imo should be automatically generated if omitted, to either fragment of a post, just something general, or empty string.

---

<div class="post-metadata">

**Author:** ![chrisalley](https://cdn.commonmark.org/user_avatar/talk.commonmark.org/chrisalley/32/906_2.png) [@chrisalley](https://talk.commonmark.org/u/chrisalley)\
**Post date:** [January 31, 2019, 5:53am UTC](https://talk.commonmark.org/t/why-not-allow-images-without-alt/617/27 "2019-01-31T05:53:12Z")

</div>

You can use the [content block syntax](https://talk.commonmark.org/t/transclusion-or-including-sub-documents-for-reuse/270/12?u=chrisalley) to create an image without an alt tag. It’s an easier to write syntax as well. So, perhaps the regular image syntax doesn’t need to be changed?

[Previous page](https://talk.commonmark.org/t/why-not-allow-images-without-alt/617.md?page=1)
