-
-
Notifications
You must be signed in to change notification settings - Fork 741
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
Add HTML support for MD045: no-alt-text #993
Add HTML support for MD045: no-alt-text #993
Conversation
This looks pretty thorough and I like the test cases I see. Thank you! I will need to review this from a real computer, potentially this evening. I will have a set of nitpicks as always, so be warned. :) A few things I noticed from a very quick scan on my phone:
|
Hi @DavidAnson, I appreciate your feedback! I've addressed the following from your first set of feedback:
With regards to:
I followed the approach taken in MD033.js which was one of the only other rules I could find that sets an error on an HTML tag. I believe this sets the error range on the first line of the tag and accounts for multiline tags. My understanding could be wrong and I am definitely open to your suggestions. |
Thanks for the quick activity! I will remind myself how the other range calculation works when I review this. |
FYI, GitHub is complaining this PR cannot be merged due to conflicts and I think that may be blocking me from approving a CI run? |
95e5135
to
4b42701
Compare
FYI now that tests are running, if anything new pops up in TestRepos, I typically verify all new issues are valid before updating those snapshots. There are npm scripts to clone and lint and update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks solid, thank you! Most of my comments are trivial nitpicks.
Following up on @DavidAnson's review comments * https://github.com/DavidAnson/markdownlint/pull/993/files#r1348209927 * https://github.com/DavidAnson/markdownlint/pull/993/files#r1348209384
1beaa90
to
93fd67e
Compare
Hi @DavidAnson! Apologies for the delayed follow-up. Starting from commit 0165cf5, I've hopefully addressed all of your feedback, but let me know if I'm missing anything. Re: #993 (comment)
I've visually verified the repo snapshot flags with the following steps:
|
Thank you for verifying the new violations - that's exactly what I wanted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome. I'm going to make the changes I suggest since I'm getting extra nit-picky at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub is being silly, but maybe you can tell me how to work around it. If I make edits and push changes from a Codespace, it fails with HTTP 403 because I do not have write permission to your fork. However, if I use the web UI to make edits to files you have already edited, it works (that's what I did to implement my feedback), BUT it always adds a trailing newline, so the git diff
check fails on the generated file. Could you please sync my changes to your branch, re-generate markdownlint-browser.js
in your fork, and push it? Everything should go green and I'll approve the PR. (OR maybe you know how I can push edits from a Codespace?)
Thanks, I've pushed up a commit(a1db76d) which re-runs the script!
That sounds frustrating! I do have this checkbox option toggled on this PR: This checkbox should give you permission to commit to my branch. (Related: Allowing changes to a pull request branch created from a fork) Is your codespaces of my forked repo? This article has some pointers that might be helpful: Committing changes to a pull request branch created from a fork - GitHub Docs. |
Thank you! I will do a final review and merge the PR this evening. Regarding permissions, I think all the preconditions are correct (and my ability to change individual files confirms my permission), but pushing from two different Codespaces created from that pull request failed. I have tried this in the past from the command line and that failed as well. It is possible I am making a mistake every time, but this has never worked for me and I am sure that I created the Codespace from the PR yesterday, so would have expected GitHub to set things up correctly. (I confirm that it created an "origin" and "upstream" remote.) I will try again tonight following the directions you sent exactly to double check myself. |
@DavidAnson I was able to repro what you're seeing on my end too. After some investigation, I discovered this is a known issue in Codespaces currently. Related community issues:
For now, you will have to stick with the traditional route of cloning via the steps in Committing changes to a pull request branch created from a fork - GitHub Docs. 😅 |
Merged, thank you! Regarding the Codespaces issue, thanks for tracking that down. :) |
Issue: #992
This PR adds support to flag missing alt text on HTML images. I wasn't sure if I should hold off on opening the PR until there was more discussion on the issue so this might be premature... I am happy to continue discussing this on this PR or on the issue.
Approach taken
I am new to this repo and followed the approaches I saw in other rules.
I noticed there is parser that returns HTML tokens. I didn't see a way to access the attributes off the HTML. It may not be ideal but I ended up using regex to check if the HTML image token contains
alt=
.