* Add optional decoding="async" loading="lazy" for img
In theory, they can make the page load faster and show content faster.
There’s one problem: CommonMark allows arbitrary inline elements in alt text.
If I want to get the correct alt text, I need to match every inline event.
I think most people will only use plain text, so I only match Event::Text.
* Add very basic test for img
This is the reason why we should use plain text when lazy_async_image is enabled.
* Explain lazy_async_image in documentation
* Add test with empty alt and special characters
I totaly forgot one can leave the alt text empty.
I thought I need to eliminate the alt attribute in that case,
but actually empty alt text is better than not having an alt attribute at all:
https://www.w3.org/TR/WCAG20-TECHS/H67.htmlhttps://www.boia.org/blog/images-that-dont-need-alternative-text-still-need-alt-attributes
Thus I will leave the empty alt text.
Another test is added to ensure alt text is properly escaped.
I will remove the redundant escaping code after this commit.
* Remove manually escaping alt text
After removing the if-else inside the arm of Event::Text(text),
the alt text is still escaped.
Indeed they are redundant.
* Use insta for snapshot testing
`cargo insta review` looks cool!
I wanted to dedup the cases variable,
but my Rust skill is not good enough to declare a global vector.
This PR includes the following:
- Added a check for `../` which would check to see if a file is in a
_sub_ directory
- Wrote test for `is_colocated_asset_links`
This PR is similare to PR #1969
* add external_level and internal_level
* remove unnecessary debug derive on LinkDef
* clarify doc comment about link check levels
* simplify link checker logging
* add missing warn prefix
* simplify link level logging, remove "Level" from linklevel variants
* remove link level config from test site
* switch back to using bail! from get_link_domain
* move console's deps to libs
* remove unnecessary reference
* calling console::error/warn directly
* emit one error, or one warning, per link checker run
* various link checker level changes
* add docs about link checker levels
* remove accidentally committed test site
* remove completed TODO