Skip to content

Rule Change: report whitespace-only string as alt text in markdown image #749

Open

Description

@Tanujkanti4441

What rule do you want to change?

require-alt-text

What change do you want to make?

Generate more warnings

How do you think the change should be implemented?

A new default behavior

Example code

![" "](logo.png)

What does the rule currently do for this code?

Rule does not report this, as it does with <img src="logo.png" alt=" ">

What will the rule do after it's changed?

Rule will report the whitespace-only string as alt text in markdown image, so rule can force to add a meaningful text as alternative.

Participation

  • I am willing to submit a pull request to implement this change.

AI acknowledgment

  • I did not use AI to generate this issue report.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

Additional comments

No response

Activity

  1. moved this to Needs Triage in Triageon Oct 2, 2026
  2. DMartens commented on Oct 2, 2026

    @DMartens
    Contributor

    The quotes inside the square brackets are kept when generating HTML (demo).
    As such ![" "](logo.png) is equal to <img src="logo.png" alt='" "'> which is also not reported.
    But I agree that this is not helpful alt text.
    We could either strip known characters such as the quotes or check that the alt text has a known letter via a regular expression.

  3. lumirlumir commented on Oct 8, 2026

    @lumirlumir
    Member

    I think adding a rule like no-restricted-alt-text, as suggested in #713, or adding an option to require-alt-text to restrict which text is allowed or disallowed makes sense.

    That said, as noted, ![" "](logo.png) is represented in the AST with an alt-text value of "\" \"", so require-alt-text rule intentionally doesn’t report cases like this.

  4. Tanujkanti4441 commented on Oct 9, 2026

    @Tanujkanti4441
    ContributorAuthor

    I think adding an option is a good idea to expand require-alt-text, right now rule is just asking to add alternate text now this option will let the users to validate that text also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

  • Status
    Feedback Needed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions