Jekyll plugin that replaces pictures in Markdown documents by responsive images using jekyll-responsive-mage
Jekyll::Hooks.register :documents, :pre_render do |document, payload| | |
docExt = document.extname.tr('.', '') | |
# only process if we deal with a markdown file | |
if payload['site']['markdown_ext'].include? docExt | |
newContent = document.content.gsub(/!\[(.*)\]\((?:\/?([^\)\:\s]+))(?:\s"(.*)")?\)(?:{:([^}]+)})*/, '{% responsive_image path: \2 alt: "\1" title: "\3" %}') | |
document.content = newContent | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
This Jekyll plugin replaces every Markdown pictures in Markdown documents by responsive images using jekyll-responsive-image's template.
For example:

will be replaced by