Skip to content

Commit

Permalink
Fix and improve swap_attribute README example
Browse files Browse the repository at this point in the history
* Wrongly specified as `swap_url`
* Using `data-src` as a more meaningful case than `srcset`, as the latter is in any case allowed instead of `src`
  • Loading branch information
riccardoporreca authored Aug 14, 2022
1 parent 32de58b commit 987668d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ In this case, any link that matches the `^https://example.com` will be converted
A similar swapping process can be done for attributes:

```ruby
run_proofer(file, :file, swap_urls: { 'img': [['src', 'srcset']] })
run_proofer(file, :file, swap_attributes: { 'img': [['src', 'data-src']] })
```

In this case, we are telling HTMLProofer that, for any `img` tag detected, and for any check using the `src` attribute, to use the `srcset` attribute instead. Since the value is an array of arrays, you can pass in as many attribute swaps as you need.
In this case, we are telling HTMLProofer that, for any `img` tag detected, and for any check using the `src` attribute, to use the `data-src` attribute instead. Since the value is an array of arrays, you can pass in as many attribute swaps as you need.

### Using on the command-line

Expand Down

0 comments on commit 987668d

Please sign in to comment.