@readme/markdown 6.52.1 → 6.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -86,3 +86,5 @@ AnchorWithContext.sanitize = sanitizeSchema => {
86
86
  };
87
87
 
88
88
  module.exports = AnchorWithContext;
89
+
90
+ AnchorWithContext.getHref = getHref;
@@ -10,7 +10,7 @@ Favicon.propTypes = {
10
10
 
11
11
  class Embed extends React.Component {
12
12
  render() {
13
- const { provider, url, title, html, iframe, image, favicon, ...attrs } = this.props;
13
+ const { lazy = true, provider, url, title, html, iframe, image, favicon, ...attrs } = this.props;
14
14
 
15
15
  if (!url) {
16
16
  return <div />;
@@ -27,14 +27,14 @@ class Embed extends React.Component {
27
27
  <div className="embed-media" dangerouslySetInnerHTML={{ __html: html }}></div>
28
28
  ) : (
29
29
  <a className="embed-link" href={url} rel="noopener noreferrer" target="_blank">
30
- {!image || <img alt={title} className="embed-img" loading="lazy" src={image} />}
30
+ {!image || <img alt={title} className="embed-img" loading={lazy ? 'lazy' : ''} src={image} />}
31
31
  {title ? (
32
32
  <div className="embed-body">
33
33
  {!favicon || (
34
34
  <Favicon
35
35
  alt={provider}
36
36
  className="embed-favicon"
37
- loading="lazy"
37
+ loading={lazy ? 'lazy' : ''}
38
38
  src={favicon}
39
39
  style={{ float: 'left' }}
40
40
  />
@@ -69,6 +69,7 @@ Embed.propTypes = {
69
69
  html: propTypes.string,
70
70
  iframe: propTypes.any,
71
71
  image: propTypes.string,
72
+ lazy: propTypes.bool,
72
73
  provider: propTypes.string,
73
74
  title: propTypes.string,
74
75
  url: propTypes.oneOfType([propTypes.string, propTypes.shape({})]),
@@ -79,4 +80,10 @@ Embed.defaultProps = {
79
80
  width: '100%',
80
81
  };
81
82
 
82
- module.exports = Embed;
83
+ const CreateEmbed =
84
+ ({ lazyImages }) =>
85
+ // eslint-disable-next-line react/display-name
86
+ props =>
87
+ <Embed {...props} lazy={lazyImages} />;
88
+
89
+ module.exports = CreateEmbed;
@@ -64,11 +64,12 @@ class Image extends React.Component {
64
64
 
65
65
  render() {
66
66
  const { props } = this;
67
- const { alt } = props;
67
+ const { alt, lazy = true } = props;
68
68
 
69
69
  if (this.isEmoji) {
70
- return <img {...props} alt={alt} loading="lazy" />;
70
+ return <img {...props} alt={alt} loading={lazy ? 'lazy' : ''} />;
71
71
  }
72
+
72
73
  return (
73
74
  <span
74
75
  aria-label={alt}
@@ -78,7 +79,7 @@ class Image extends React.Component {
78
79
  role={'button'}
79
80
  tabIndex={0}
80
81
  >
81
- <img {...props} alt={alt} loading="lazy" />
82
+ <img {...props} alt={alt} loading={lazy ? 'lazy' : ''} />
82
83
  <Lightbox ref={this.lightbox} {...props} onScroll={() => this.toggle(false)} opened={this.state.lightbox} />
83
84
  </span>
84
85
  );
@@ -91,6 +92,7 @@ Image.propTypes = {
91
92
  caption: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
92
93
  className: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
93
94
  height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
95
+ lazy: PropTypes.bool,
94
96
  src: PropTypes.string.isRequired,
95
97
  title: PropTypes.string,
96
98
  width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@@ -112,4 +114,10 @@ Image.sanitize = sanitizeSchema => {
112
114
  return sanitizeSchema;
113
115
  };
114
116
 
115
- module.exports = Image;
117
+ const CreateImage =
118
+ ({ lazyImages }) =>
119
+ // eslint-disable-next-line react/display-name
120
+ props =>
121
+ <Image lazy={lazyImages} {...props} />;
122
+
123
+ module.exports = CreateImage;
package/dist/main.js CHANGED
@@ -9203,6 +9203,7 @@ AnchorWithContext.sanitize = function (sanitizeSchema) {
9203
9203
  };
9204
9204
 
9205
9205
  module.exports = AnchorWithContext;
9206
+ AnchorWithContext.getHref = getHref;
9206
9207
 
9207
9208
  /***/ }),
9208
9209
 
@@ -9504,7 +9505,7 @@ var _extends = __webpack_require__(7154);
9504
9505
  var _objectWithoutProperties = __webpack_require__(6479);
9505
9506
 
9506
9507
  var _excluded = ["src", "alt"],
9507
- _excluded2 = ["provider", "url", "title", "html", "iframe", "image", "favicon"];
9508
+ _excluded2 = ["lazy", "provider", "url", "title", "html", "iframe", "image", "favicon"];
9508
9509
 
9509
9510
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9510
9511
 
@@ -9551,6 +9552,8 @@ var Embed = /*#__PURE__*/function (_React$Component) {
9551
9552
  key: "render",
9552
9553
  value: function render() {
9553
9554
  var _this$props = this.props,
9555
+ _this$props$lazy = _this$props.lazy,
9556
+ lazy = _this$props$lazy === void 0 ? true : _this$props$lazy,
9554
9557
  provider = _this$props.provider,
9555
9558
  url = _this$props.url,
9556
9559
  title = _this$props.title,
@@ -9590,14 +9593,14 @@ var Embed = /*#__PURE__*/function (_React$Component) {
9590
9593
  }, !image || /*#__PURE__*/React.createElement("img", {
9591
9594
  alt: title,
9592
9595
  className: "embed-img",
9593
- loading: "lazy",
9596
+ loading: lazy ? 'lazy' : '',
9594
9597
  src: image
9595
9598
  }), title ? /*#__PURE__*/React.createElement("div", {
9596
9599
  className: "embed-body"
9597
9600
  }, !favicon || /*#__PURE__*/React.createElement(Favicon, {
9598
9601
  alt: provider,
9599
9602
  className: "embed-favicon",
9600
- loading: "lazy",
9603
+ loading: lazy ? 'lazy' : '',
9601
9604
  src: favicon,
9602
9605
  style: {
9603
9606
  float: 'left'
@@ -9628,6 +9631,7 @@ Embed.propTypes = {
9628
9631
  html: propTypes.string,
9629
9632
  iframe: propTypes.any,
9630
9633
  image: propTypes.string,
9634
+ lazy: propTypes.bool,
9631
9635
  provider: propTypes.string,
9632
9636
  title: propTypes.string,
9633
9637
  url: propTypes.oneOfType([propTypes.string, propTypes.shape({})]),
@@ -9637,7 +9641,19 @@ Embed.defaultProps = {
9637
9641
  height: '300px',
9638
9642
  width: '100%'
9639
9643
  };
9640
- module.exports = Embed;
9644
+
9645
+ var CreateEmbed = function CreateEmbed(_ref2) {
9646
+ var lazyImages = _ref2.lazyImages;
9647
+ return (// eslint-disable-next-line react/display-name
9648
+ function (props) {
9649
+ return /*#__PURE__*/React.createElement(Embed, _extends({}, props, {
9650
+ lazy: lazyImages
9651
+ }));
9652
+ }
9653
+ );
9654
+ };
9655
+
9656
+ module.exports = CreateEmbed;
9641
9657
 
9642
9658
  /***/ }),
9643
9659
 
@@ -10076,12 +10092,14 @@ var Image = /*#__PURE__*/function (_React$Component) {
10076
10092
  var _this2 = this;
10077
10093
 
10078
10094
  var props = this.props;
10079
- var alt = props.alt;
10095
+ var alt = props.alt,
10096
+ _props$lazy = props.lazy,
10097
+ lazy = _props$lazy === void 0 ? true : _props$lazy;
10080
10098
 
10081
10099
  if (this.isEmoji) {
10082
10100
  return /*#__PURE__*/React.createElement("img", _extends({}, props, {
10083
10101
  alt: alt,
10084
- loading: "lazy"
10102
+ loading: lazy ? 'lazy' : ''
10085
10103
  }));
10086
10104
  }
10087
10105
 
@@ -10096,7 +10114,7 @@ var Image = /*#__PURE__*/function (_React$Component) {
10096
10114
  tabIndex: 0
10097
10115
  }, /*#__PURE__*/React.createElement("img", _extends({}, props, {
10098
10116
  alt: alt,
10099
- loading: "lazy"
10117
+ loading: lazy ? 'lazy' : ''
10100
10118
  })), /*#__PURE__*/React.createElement(Lightbox, _extends({
10101
10119
  ref: this.lightbox
10102
10120
  }, props, {
@@ -10117,6 +10135,7 @@ Image.propTypes = {
10117
10135
  caption: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
10118
10136
  className: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
10119
10137
  height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
10138
+ lazy: PropTypes.bool,
10120
10139
  src: PropTypes.string.isRequired,
10121
10140
  title: PropTypes.string,
10122
10141
  width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
@@ -10136,7 +10155,18 @@ Image.sanitize = function (sanitizeSchema) {
10136
10155
  return sanitizeSchema;
10137
10156
  };
10138
10157
 
10139
- module.exports = Image;
10158
+ var CreateImage = function CreateImage(_ref) {
10159
+ var lazyImages = _ref.lazyImages;
10160
+ return (// eslint-disable-next-line react/display-name
10161
+ function (props) {
10162
+ return /*#__PURE__*/React.createElement(Image, _extends({
10163
+ lazy: lazyImages
10164
+ }, props));
10165
+ }
10166
+ );
10167
+ };
10168
+
10169
+ module.exports = CreateImage;
10140
10170
 
10141
10171
  /***/ }),
10142
10172
 
@@ -27962,6 +27992,7 @@ var options = {
27962
27992
  spacedTable: true,
27963
27993
  paddedTable: true
27964
27994
  },
27995
+ lazyImages: true,
27965
27996
  normalize: true,
27966
27997
  safeMode: false,
27967
27998
  settings: {
@@ -52198,6 +52229,9 @@ var Variable = __webpack_require__(3689);
52198
52229
 
52199
52230
  var Components = __webpack_require__(3354);
52200
52231
 
52232
+ var _require2 = __webpack_require__(8447),
52233
+ getHref = _require2.getHref;
52234
+
52201
52235
  var GlossaryItem = Components.GlossaryItem,
52202
52236
  Code = Components.Code,
52203
52237
  Table = Components.Table,
@@ -52229,9 +52263,9 @@ var tableFlattening = __webpack_require__(4625);
52229
52263
  var toPlainText = __webpack_require__(4792); // Processor Option Defaults
52230
52264
 
52231
52265
 
52232
- var _require2 = __webpack_require__(2531),
52233
- options = _require2.options,
52234
- parseOptions = _require2.parseOptions;
52266
+ var _require3 = __webpack_require__(2531),
52267
+ options = _require3.options,
52268
+ parseOptions = _require3.parseOptions;
52235
52269
  /* Utilities
52236
52270
  */
52237
52271
 
@@ -52263,11 +52297,12 @@ function setup(blocks) {
52263
52297
  return ["".concat(blocks, "\n\n "), opts];
52264
52298
  }
52265
52299
 
52266
- var _require3 = __webpack_require__(3910),
52267
- calloutIcons = _require3.icons;
52300
+ var _require4 = __webpack_require__(3910),
52301
+ calloutIcons = _require4.icons;
52268
52302
 
52269
52303
  var utils = {
52270
52304
  BaseUrlContext: BaseUrlContext,
52305
+ getHref: getHref,
52271
52306
  GlossaryContext: GlossaryItem.GlossaryContext,
52272
52307
  options: options,
52273
52308
  VariablesContext: Variable.VariablesContext,
@@ -52346,7 +52381,7 @@ function reactProcessor() {
52346
52381
  'rdme-callout': Callout,
52347
52382
  'readme-variable': Variable,
52348
52383
  'readme-glossary-item': GlossaryItem,
52349
- 'rdme-embed': Embed,
52384
+ 'rdme-embed': Embed(opts),
52350
52385
  'rdme-pin': PinWrap,
52351
52386
  table: Table,
52352
52387
  a: Anchor,
@@ -52357,7 +52392,7 @@ function reactProcessor() {
52357
52392
  h5: Heading(5, count, opts),
52358
52393
  h6: Heading(6, count, opts),
52359
52394
  code: Code(opts),
52360
- img: Image,
52395
+ img: Image(opts),
52361
52396
  style: Style(opts)
52362
52397
  }, registerCustomComponents(components, sanitize, opts.customComponentPrefix))
52363
52398
  });
package/dist/main.node.js CHANGED
@@ -9203,6 +9203,7 @@ AnchorWithContext.sanitize = function (sanitizeSchema) {
9203
9203
  };
9204
9204
 
9205
9205
  module.exports = AnchorWithContext;
9206
+ AnchorWithContext.getHref = getHref;
9206
9207
 
9207
9208
  /***/ }),
9208
9209
 
@@ -9504,7 +9505,7 @@ var _extends = __webpack_require__(7154);
9504
9505
  var _objectWithoutProperties = __webpack_require__(6479);
9505
9506
 
9506
9507
  var _excluded = ["src", "alt"],
9507
- _excluded2 = ["provider", "url", "title", "html", "iframe", "image", "favicon"];
9508
+ _excluded2 = ["lazy", "provider", "url", "title", "html", "iframe", "image", "favicon"];
9508
9509
 
9509
9510
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
9510
9511
 
@@ -9551,6 +9552,8 @@ var Embed = /*#__PURE__*/function (_React$Component) {
9551
9552
  key: "render",
9552
9553
  value: function render() {
9553
9554
  var _this$props = this.props,
9555
+ _this$props$lazy = _this$props.lazy,
9556
+ lazy = _this$props$lazy === void 0 ? true : _this$props$lazy,
9554
9557
  provider = _this$props.provider,
9555
9558
  url = _this$props.url,
9556
9559
  title = _this$props.title,
@@ -9590,14 +9593,14 @@ var Embed = /*#__PURE__*/function (_React$Component) {
9590
9593
  }, !image || /*#__PURE__*/React.createElement("img", {
9591
9594
  alt: title,
9592
9595
  className: "embed-img",
9593
- loading: "lazy",
9596
+ loading: lazy ? 'lazy' : '',
9594
9597
  src: image
9595
9598
  }), title ? /*#__PURE__*/React.createElement("div", {
9596
9599
  className: "embed-body"
9597
9600
  }, !favicon || /*#__PURE__*/React.createElement(Favicon, {
9598
9601
  alt: provider,
9599
9602
  className: "embed-favicon",
9600
- loading: "lazy",
9603
+ loading: lazy ? 'lazy' : '',
9601
9604
  src: favicon,
9602
9605
  style: {
9603
9606
  float: 'left'
@@ -9628,6 +9631,7 @@ Embed.propTypes = {
9628
9631
  html: propTypes.string,
9629
9632
  iframe: propTypes.any,
9630
9633
  image: propTypes.string,
9634
+ lazy: propTypes.bool,
9631
9635
  provider: propTypes.string,
9632
9636
  title: propTypes.string,
9633
9637
  url: propTypes.oneOfType([propTypes.string, propTypes.shape({})]),
@@ -9637,7 +9641,19 @@ Embed.defaultProps = {
9637
9641
  height: '300px',
9638
9642
  width: '100%'
9639
9643
  };
9640
- module.exports = Embed;
9644
+
9645
+ var CreateEmbed = function CreateEmbed(_ref2) {
9646
+ var lazyImages = _ref2.lazyImages;
9647
+ return (// eslint-disable-next-line react/display-name
9648
+ function (props) {
9649
+ return /*#__PURE__*/React.createElement(Embed, _extends({}, props, {
9650
+ lazy: lazyImages
9651
+ }));
9652
+ }
9653
+ );
9654
+ };
9655
+
9656
+ module.exports = CreateEmbed;
9641
9657
 
9642
9658
  /***/ }),
9643
9659
 
@@ -10076,12 +10092,14 @@ var Image = /*#__PURE__*/function (_React$Component) {
10076
10092
  var _this2 = this;
10077
10093
 
10078
10094
  var props = this.props;
10079
- var alt = props.alt;
10095
+ var alt = props.alt,
10096
+ _props$lazy = props.lazy,
10097
+ lazy = _props$lazy === void 0 ? true : _props$lazy;
10080
10098
 
10081
10099
  if (this.isEmoji) {
10082
10100
  return /*#__PURE__*/React.createElement("img", _extends({}, props, {
10083
10101
  alt: alt,
10084
- loading: "lazy"
10102
+ loading: lazy ? 'lazy' : ''
10085
10103
  }));
10086
10104
  }
10087
10105
 
@@ -10096,7 +10114,7 @@ var Image = /*#__PURE__*/function (_React$Component) {
10096
10114
  tabIndex: 0
10097
10115
  }, /*#__PURE__*/React.createElement("img", _extends({}, props, {
10098
10116
  alt: alt,
10099
- loading: "lazy"
10117
+ loading: lazy ? 'lazy' : ''
10100
10118
  })), /*#__PURE__*/React.createElement(Lightbox, _extends({
10101
10119
  ref: this.lightbox
10102
10120
  }, props, {
@@ -10117,6 +10135,7 @@ Image.propTypes = {
10117
10135
  caption: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
10118
10136
  className: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
10119
10137
  height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
10138
+ lazy: PropTypes.bool,
10120
10139
  src: PropTypes.string.isRequired,
10121
10140
  title: PropTypes.string,
10122
10141
  width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
@@ -10136,7 +10155,18 @@ Image.sanitize = function (sanitizeSchema) {
10136
10155
  return sanitizeSchema;
10137
10156
  };
10138
10157
 
10139
- module.exports = Image;
10158
+ var CreateImage = function CreateImage(_ref) {
10159
+ var lazyImages = _ref.lazyImages;
10160
+ return (// eslint-disable-next-line react/display-name
10161
+ function (props) {
10162
+ return /*#__PURE__*/React.createElement(Image, _extends({
10163
+ lazy: lazyImages
10164
+ }, props));
10165
+ }
10166
+ );
10167
+ };
10168
+
10169
+ module.exports = CreateImage;
10140
10170
 
10141
10171
  /***/ }),
10142
10172
 
@@ -10784,6 +10814,7 @@ var options = {
10784
10814
  spacedTable: true,
10785
10815
  paddedTable: true
10786
10816
  },
10817
+ lazyImages: true,
10787
10818
  normalize: true,
10788
10819
  safeMode: false,
10789
10820
  settings: {
@@ -34543,6 +34574,9 @@ var Variable = __webpack_require__(3689);
34543
34574
 
34544
34575
  var Components = __webpack_require__(3354);
34545
34576
 
34577
+ var _require2 = __webpack_require__(8447),
34578
+ getHref = _require2.getHref;
34579
+
34546
34580
  var GlossaryItem = Components.GlossaryItem,
34547
34581
  Code = Components.Code,
34548
34582
  Table = Components.Table,
@@ -34574,9 +34608,9 @@ var tableFlattening = __webpack_require__(4625);
34574
34608
  var toPlainText = __webpack_require__(4792); // Processor Option Defaults
34575
34609
 
34576
34610
 
34577
- var _require2 = __webpack_require__(2531),
34578
- options = _require2.options,
34579
- parseOptions = _require2.parseOptions;
34611
+ var _require3 = __webpack_require__(2531),
34612
+ options = _require3.options,
34613
+ parseOptions = _require3.parseOptions;
34580
34614
  /* Utilities
34581
34615
  */
34582
34616
 
@@ -34608,11 +34642,12 @@ function setup(blocks) {
34608
34642
  return ["".concat(blocks, "\n\n "), opts];
34609
34643
  }
34610
34644
 
34611
- var _require3 = __webpack_require__(3910),
34612
- calloutIcons = _require3.icons;
34645
+ var _require4 = __webpack_require__(3910),
34646
+ calloutIcons = _require4.icons;
34613
34647
 
34614
34648
  var utils = {
34615
34649
  BaseUrlContext: BaseUrlContext,
34650
+ getHref: getHref,
34616
34651
  GlossaryContext: GlossaryItem.GlossaryContext,
34617
34652
  options: options,
34618
34653
  VariablesContext: Variable.VariablesContext,
@@ -34691,7 +34726,7 @@ function reactProcessor() {
34691
34726
  'rdme-callout': Callout,
34692
34727
  'readme-variable': Variable,
34693
34728
  'readme-glossary-item': GlossaryItem,
34694
- 'rdme-embed': Embed,
34729
+ 'rdme-embed': Embed(opts),
34695
34730
  'rdme-pin': PinWrap,
34696
34731
  table: Table,
34697
34732
  a: Anchor,
@@ -34702,7 +34737,7 @@ function reactProcessor() {
34702
34737
  h5: Heading(5, count, opts),
34703
34738
  h6: Heading(6, count, opts),
34704
34739
  code: Code(opts),
34705
- img: Image,
34740
+ img: Image(opts),
34706
34741
  style: Style(opts)
34707
34742
  }, registerCustomComponents(components, sanitize, opts.customComponentPrefix))
34708
34743
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@readme/markdown",
3
3
  "description": "ReadMe's React-based Markdown parser",
4
4
  "author": "Rafe Goldberg <rafe@readme.io>",
5
- "version": "6.52.1",
5
+ "version": "6.53.0",
6
6
  "main": "dist/main.node.js",
7
7
  "browser": "dist/main.js",
8
8
  "files": [