Skip to content
This repository has been archived by the owner. It is now read-only.
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
10 lines (9 sloc) 593 Bytes
# Description: Jekyll plugin to replace Markdown image syntax with lazyload HTML markup
Jekyll::Hooks.register :documents, :pre_render do |document, payload|
docExt ='.', '')
# only process if we deal with a markdown file
if payload['site']['markdown_ext'].include? docExt
newContent = document.content.gsub(/(?:!\[(.*?)\]\((.*?)\))/, '<noscript><img src="\2" alt="\1"></noscript><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="\2" alt="\1" class="lazyload fade-in">')
document.content = newContent
You can’t perform that action at this time.