ethereum / eipw

Mozilla Public License 2.0
28 stars 27 forks source link

`markdown-link-first` incorrectly matches inside image alt text #96

Closed SamWilsn closed 1 month ago

SamWilsn commented 5 months ago

For example:

error[markdown-link-first]: the first match of the given pattern must be a link
  --> ERCS/erc-7615.md
   |
65 | ![ERC-7615 Workflow](../assets/erc-7615/ERC7615.svg)
   |
   = info: the pattern in question: `(?i)(?:eip|erc)-[0-9]+`
   = help: see https://ethereum.github.io/eipw/markdown-link-first/

Found in https://github.com/ethereum/ERCs/actions/runs/9476286533/job/26108931430?pr=235

rutefig commented 5 months ago

@SamWilsn can I have this one?

rutefig commented 5 months ago

So i think the main issue here is that that function is checking if the first reference for some proposal it is a link for that proposal which makes sense which the reference is not the proposal itself, which in this case was. To solve this I think there can be two approaches, or just ignore this check everytime the proposal reference is inside of the image alt, or skip the check if the proposal being referenced has the same id as the document. @SamWilsn

SamWilsn commented 5 months ago

You cannot place links in an image alt text, at least as far as I know, so ignoring this lint for all image alt texts makes the most sense to me. I think you can do that somewhere around:

https://github.com/ethereum/eipw/blob/db50295b89f65329e9c07dec8e9f518b8c064e3c/eipw-lint/src/lints/markdown/link_first.rs#L143-L145