Since parsing of images is done by remark directly, implementation was done using a postprocessor, which adds an attribute loading=lazy for all images, except emoticons. Since these are guaranteed to be lightweight and served from our servers, I considered they could be eagerly loaded (see condition in postprocessor).
As it is the case with all postprocessors, this one can be easily disabled with a configuration option (lazyLoadImages). Since this feature should be ignored by browser not supporting it, I feel like we do not need a major version for enforcing this setting in the default configuration.
Fixes #496
Lazy-loading for iframes was added by commit https://github.com/zestedesavoir/zmarkdown/commit/28b2196031cefd1fb8da480bf031fff2814c7187 , this PR aims at lazy-loading all images for ZMarkdown.
Since parsing of images is done by remark directly, implementation was done using a postprocessor, which adds an attribute
loading=lazy
for all images, except emoticons. Since these are guaranteed to be lightweight and served from our servers, I considered they could be eagerly loaded (see condition in postprocessor).As it is the case with all postprocessors, this one can be easily disabled with a configuration option (
lazyLoadImages
). Since this feature should be ignored by browser not supporting it, I feel like we do not need a major version for enforcing this setting in the default configuration.