Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(node, resolve) {
var defaults, options, parentNode, imagePath, imageNode, fwToken, isFullWidth, nlToken, isNoLink, responsiveSizesResult, ratio, originalImg, fallbackSrc, srcSet, presentationWidth, srcSplit, fileName, fileNameNoExt, defaultAlt, rawHTML;
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
defaults = {
maxWidth: 650,
wrapperStyle: '',
backgroundColor: 'white',
linkImagesToOriginal: true,
pathPrefix: pathPrefix
};
options = _.assign({}, pluginOptions, defaults);
// Check if this markdownNode has a File parent. This plugin
// won't work if the image isn't hosted locally.
parentNode = getNode(markdownNode.parent);
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(resolve, reject) {
var fileType, rawHTML;
return regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
fileType = node.url.slice(-3);
// Ignore gifs as we can't process them,
// svgs as they are already responsive by definition
if (!(isRelativeUrl(node.url) && fileType !== 'gif' && fileType !== 'svg')) {
_context2.next = 10;
break;
}
_context2.next = 4;
return generateImagesAndUpdateNode(node, resolve);
var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(resolve, reject) {
var $, imageRefs, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, thisImg, formattedImgTag, fileType, rawHTML;
return regeneratorRuntime.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
if (node.value) {
_context3.next = 2;
break;
}
return _context3.abrupt('return', resolve());
case 2:
$ = cheerio.load(node.value);
if (!($('img').length === 0)) {
_context3.next = 5;
break;