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

Use AST parser to validate alt text - Remark #32

Closed
wants to merge 1 commit into from

Conversation

kendallgassner
Copy link
Collaborator

@kendallgassner kendallgassner commented Oct 3, 2023

What

Closes #30

I updated the alt-text-bot to use an AST (remark) to parse images for bad alt text. Using an AST allows us to ignore any images defined in code blocks.

Why is this cool

  • In the future, we can add additional linting rules
  • The workflow is easier to read in javascript
  • We can test more easily
  • We can ensure that there aren't false positives
  • We can provide more feedback. For example, it is easier to indicate what line the alt text is found on.

TODO

  • - I was able to add codeblock tests and ensure all of our old test cases were passing. I have not had a chance to check if the action still runs properly.

Testing

If you find it useful I used AST Explorer to test remark output.

@khiga8
Copy link
Contributor

khiga8 commented Oct 3, 2023

Excited to see this! First question -- is there a reason you went with remark over markdownlint? I would personally prefer the latter because it already comes with the no alt text rule.

We also have additional rules in markdownlint-github like no-default-alt-text for flagging screenshots, and there are plans to add more rules soon! I would prefer if we align on markdownlint so we can use the existing rules!

@kendallgassner
Copy link
Collaborator Author

kendallgassner commented Oct 3, 2023

Remark:

I see the value in using a rule set GitHub has worked on though 🤔 ... Do we have more than the two rules?

cc. @khiga8

@kendallgassner kendallgassner changed the title Use AST parser to check alt text Use AST parser to validate alt text - Remark Oct 4, 2023
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 this pull request may close these issues.

Ignore images in code snippets
2 participants