'use strict' /* global hexo */ /* * Put {% cloudinary 'folder/filename.jpg' 'description' %} in your post. * Change the username in data-src tag * and cloud name in typing.js * src is an animated svg generated from https://loading.io/ * More info: * https://hexo.io/docs/tag-plugins * https://hexo.io/api/tag * https://cloudinary.com/documentation/responsive_images */ hexo.extend.tag.register('cloudinary', (args) => { const fileName = args[0] const alt = args[1] || '' let modern = '' let legacy = '' if (fileName.endsWith('.png')) { modern = fileName.replace(/\.png$/, '.webp') legacy = fileName } else if (fileName.endsWith('.webp')) { modern = fileName legacy = fileName.replace(/\.webp$/, '.gif') } if (fileName.endsWith('.png') || fileName.endsWith('.webp')) { return ` ${alt} ` } else { return ` ${alt} ` } })