@readme/markdown 6.66.0-beta.5 → 6.66.0-beta.7

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.
@@ -78,7 +78,7 @@ function CreateCode({ copyButtons, theme }) {
78
78
  }
79
79
 
80
80
  Code.propTypes = {
81
- children: PropTypes.arrayOf(PropTypes.string),
81
+ children: PropTypes.oneOf(PropTypes.arrayOf(PropTypes.string), PropTypes.string),
82
82
  className: PropTypes.string,
83
83
  copyButtons: PropTypes.bool,
84
84
  lang: PropTypes.string,
@@ -4,19 +4,16 @@ const React = require('react');
4
4
  const { useState } = require('react');
5
5
 
6
6
  const traverseProps = (props, fn) => {
7
- if (props?.children) {
8
- if (props.children.forEach) {
9
- props.children.forEach(child => {
10
- if (child.props) {
11
- traverseProps(child.props, fn);
12
- }
13
- });
7
+ if (!props) return;
8
+ fn(props);
9
+
10
+ if (props && 'children' in props) {
11
+ if (Array.isArray(props.children)) {
12
+ props.children.forEach(child => child.props && traverseProps(child.props, fn));
14
13
  } else {
15
- fn(props.children.props);
14
+ traverseProps(props.children.props, fn);
16
15
  }
17
16
  }
18
-
19
- fn(props);
20
17
  };
21
18
 
22
19
  const CodeTabs = props => {
@@ -69,7 +66,7 @@ const CodeTabs = props => {
69
66
  };
70
67
 
71
68
  CodeTabs.propTypes = {
72
- children: PropTypes.arrayOf(PropTypes.any).isRequired,
69
+ children: PropTypes.oneOf(PropTypes.arrayOf(PropTypes.any), PropTypes.object),
73
70
  theme: PropTypes.string,
74
71
  };
75
72
 
@@ -5,13 +5,13 @@ const React = require('react');
5
5
  * To get around hast/html sanitation, we pass custom components through using
6
6
  * className's. Then this Div component, can render the associated component
7
7
  * instead. This used to be done with a custom `React.createElement`, but for
8
- * mdx@v1.5, I don't see a way to customize that.
8
+ * mdx@v1.6, I don't see a way to customize that.
9
9
  */
10
10
 
11
- const Div = ({ components, ...props }) => {
11
+ const Div = ({ components, theme, ...props }) => {
12
12
  if (Object.keys(components).includes(props.className)) {
13
13
  const Component = components[props.className];
14
- return <Component {...props} />;
14
+ return <Component theme={theme} {...props} />;
15
15
  }
16
16
 
17
17
  // eslint-disable-next-line react/jsx-props-no-spreading
@@ -19,9 +19,10 @@ const Div = ({ components, ...props }) => {
19
19
  };
20
20
 
21
21
  Div.propTypes = {
22
- children: PropTypes.arrayOf(PropTypes.any),
22
+ children: PropTypes.oneOf(PropTypes.arrayOf(PropTypes.any), PropTypes.object),
23
23
  className: PropTypes.string,
24
24
  components: PropTypes.object,
25
+ theme: PropTypes.string.isRequired,
25
26
  };
26
27
 
27
28
  module.exports =
package/dist/main.js CHANGED
@@ -7625,7 +7625,7 @@ function CreateCode(_ref2) {
7625
7625
  };
7626
7626
  }
7627
7627
  Code.propTypes = {
7628
- children: PropTypes.arrayOf(PropTypes.string),
7628
+ children: PropTypes.oneOf(PropTypes.arrayOf(PropTypes.string), PropTypes.string),
7629
7629
  className: PropTypes.string,
7630
7630
  copyButtons: PropTypes.bool,
7631
7631
  lang: PropTypes.string,
@@ -7659,18 +7659,17 @@ var React = __webpack_require__(3634);
7659
7659
  var _require2 = __webpack_require__(3634),
7660
7660
  useState = _require2.useState;
7661
7661
  var traverseProps = function traverseProps(props, fn) {
7662
- if (props !== null && props !== void 0 && props.children) {
7663
- if (props.children.forEach) {
7662
+ if (!props) return;
7663
+ fn(props);
7664
+ if (props && 'children' in props) {
7665
+ if (Array.isArray(props.children)) {
7664
7666
  props.children.forEach(function (child) {
7665
- if (child.props) {
7666
- traverseProps(child.props, fn);
7667
- }
7667
+ return child.props && traverseProps(child.props, fn);
7668
7668
  });
7669
7669
  } else {
7670
- fn(props.children.props);
7670
+ traverseProps(props.children.props, fn);
7671
7671
  }
7672
7672
  }
7673
- fn(props);
7674
7673
  };
7675
7674
  var CodeTabs = function CodeTabs(props) {
7676
7675
  var children = props.children,
@@ -7725,7 +7724,7 @@ var CodeTabs = function CodeTabs(props) {
7725
7724
  }, children));
7726
7725
  };
7727
7726
  CodeTabs.propTypes = {
7728
- children: PropTypes.arrayOf(PropTypes.any).isRequired,
7727
+ children: PropTypes.oneOf(PropTypes.arrayOf(PropTypes.any), PropTypes.object),
7729
7728
  theme: PropTypes.string
7730
7729
  };
7731
7730
  function CreateCodeTabs(_ref3) {
@@ -7751,7 +7750,7 @@ module.exports.CodeTabs = CodeTabs;
7751
7750
 
7752
7751
  var _extends = __webpack_require__(434);
7753
7752
  var _objectWithoutProperties = __webpack_require__(215);
7754
- var _excluded = ["components"];
7753
+ var _excluded = ["components", "theme"];
7755
7754
  var PropTypes = __webpack_require__(5697);
7756
7755
  var React = __webpack_require__(3634);
7757
7756
 
@@ -7759,24 +7758,28 @@ var React = __webpack_require__(3634);
7759
7758
  * To get around hast/html sanitation, we pass custom components through using
7760
7759
  * className's. Then this Div component, can render the associated component
7761
7760
  * instead. This used to be done with a custom `React.createElement`, but for
7762
- * mdx@v1.5, I don't see a way to customize that.
7761
+ * mdx@v1.6, I don't see a way to customize that.
7763
7762
  */
7764
7763
 
7765
7764
  var Div = function Div(_ref) {
7766
7765
  var components = _ref.components,
7766
+ theme = _ref.theme,
7767
7767
  props = _objectWithoutProperties(_ref, _excluded);
7768
7768
  if (Object.keys(components).includes(props.className)) {
7769
7769
  var Component = components[props.className];
7770
- return /*#__PURE__*/React.createElement(Component, props);
7770
+ return /*#__PURE__*/React.createElement(Component, _extends({
7771
+ theme: theme
7772
+ }, props));
7771
7773
  }
7772
7774
 
7773
7775
  // eslint-disable-next-line react/jsx-props-no-spreading
7774
7776
  return /*#__PURE__*/React.createElement("div", props);
7775
7777
  };
7776
7778
  Div.propTypes = {
7777
- children: PropTypes.arrayOf(PropTypes.any),
7779
+ children: PropTypes.oneOf(PropTypes.arrayOf(PropTypes.any), PropTypes.object),
7778
7780
  className: PropTypes.string,
7779
- components: PropTypes.object
7781
+ components: PropTypes.object,
7782
+ theme: PropTypes.string.isRequired
7780
7783
  };
7781
7784
  module.exports = function (components, _ref2) {
7782
7785
  var theme = _ref2.theme;
@@ -36717,7 +36720,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
36717
36720
  /* eslint-disable no-param-reassign */
36718
36721
 
36719
36722
  __webpack_require__(2787);
36720
- var MDXRuntime = (__webpack_require__(2114)["default"]);
36723
+ var Mdx = (__webpack_require__(2114)["default"]);
36721
36724
  var Variable = __webpack_require__(1882);
36722
36725
  var generateTOC = __webpack_require__(3263);
36723
36726
  var React = __webpack_require__(3634);
@@ -36937,7 +36940,7 @@ function react(content) {
36937
36940
  })), transformers, [remarkSlug, [remarkDisableTokenizers, opts.disableTokenizers]]);
36938
36941
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
36939
36942
  key: content
36940
- }, /*#__PURE__*/React.createElement(MDXRuntime, {
36943
+ }, /*#__PURE__*/React.createElement(Mdx, {
36941
36944
  components: reactComponents(opts, components),
36942
36945
  rehypePlugins: [sectionAnchorId],
36943
36946
  remarkPlugins: remarkPlugins
package/dist/main.node.js CHANGED
@@ -7625,7 +7625,7 @@ function CreateCode(_ref2) {
7625
7625
  };
7626
7626
  }
7627
7627
  Code.propTypes = {
7628
- children: PropTypes.arrayOf(PropTypes.string),
7628
+ children: PropTypes.oneOf(PropTypes.arrayOf(PropTypes.string), PropTypes.string),
7629
7629
  className: PropTypes.string,
7630
7630
  copyButtons: PropTypes.bool,
7631
7631
  lang: PropTypes.string,
@@ -7659,18 +7659,17 @@ var React = __webpack_require__(3634);
7659
7659
  var _require2 = __webpack_require__(3634),
7660
7660
  useState = _require2.useState;
7661
7661
  var traverseProps = function traverseProps(props, fn) {
7662
- if (props !== null && props !== void 0 && props.children) {
7663
- if (props.children.forEach) {
7662
+ if (!props) return;
7663
+ fn(props);
7664
+ if (props && 'children' in props) {
7665
+ if (Array.isArray(props.children)) {
7664
7666
  props.children.forEach(function (child) {
7665
- if (child.props) {
7666
- traverseProps(child.props, fn);
7667
- }
7667
+ return child.props && traverseProps(child.props, fn);
7668
7668
  });
7669
7669
  } else {
7670
- fn(props.children.props);
7670
+ traverseProps(props.children.props, fn);
7671
7671
  }
7672
7672
  }
7673
- fn(props);
7674
7673
  };
7675
7674
  var CodeTabs = function CodeTabs(props) {
7676
7675
  var children = props.children,
@@ -7725,7 +7724,7 @@ var CodeTabs = function CodeTabs(props) {
7725
7724
  }, children));
7726
7725
  };
7727
7726
  CodeTabs.propTypes = {
7728
- children: PropTypes.arrayOf(PropTypes.any).isRequired,
7727
+ children: PropTypes.oneOf(PropTypes.arrayOf(PropTypes.any), PropTypes.object),
7729
7728
  theme: PropTypes.string
7730
7729
  };
7731
7730
  function CreateCodeTabs(_ref3) {
@@ -7751,7 +7750,7 @@ module.exports.CodeTabs = CodeTabs;
7751
7750
 
7752
7751
  var _extends = __webpack_require__(434);
7753
7752
  var _objectWithoutProperties = __webpack_require__(215);
7754
- var _excluded = ["components"];
7753
+ var _excluded = ["components", "theme"];
7755
7754
  var PropTypes = __webpack_require__(5697);
7756
7755
  var React = __webpack_require__(3634);
7757
7756
 
@@ -7759,24 +7758,28 @@ var React = __webpack_require__(3634);
7759
7758
  * To get around hast/html sanitation, we pass custom components through using
7760
7759
  * className's. Then this Div component, can render the associated component
7761
7760
  * instead. This used to be done with a custom `React.createElement`, but for
7762
- * mdx@v1.5, I don't see a way to customize that.
7761
+ * mdx@v1.6, I don't see a way to customize that.
7763
7762
  */
7764
7763
 
7765
7764
  var Div = function Div(_ref) {
7766
7765
  var components = _ref.components,
7766
+ theme = _ref.theme,
7767
7767
  props = _objectWithoutProperties(_ref, _excluded);
7768
7768
  if (Object.keys(components).includes(props.className)) {
7769
7769
  var Component = components[props.className];
7770
- return /*#__PURE__*/React.createElement(Component, props);
7770
+ return /*#__PURE__*/React.createElement(Component, _extends({
7771
+ theme: theme
7772
+ }, props));
7771
7773
  }
7772
7774
 
7773
7775
  // eslint-disable-next-line react/jsx-props-no-spreading
7774
7776
  return /*#__PURE__*/React.createElement("div", props);
7775
7777
  };
7776
7778
  Div.propTypes = {
7777
- children: PropTypes.arrayOf(PropTypes.any),
7779
+ children: PropTypes.oneOf(PropTypes.arrayOf(PropTypes.any), PropTypes.object),
7778
7780
  className: PropTypes.string,
7779
- components: PropTypes.object
7781
+ components: PropTypes.object,
7782
+ theme: PropTypes.string.isRequired
7780
7783
  };
7781
7784
  module.exports = function (components, _ref2) {
7782
7785
  var theme = _ref2.theme;
@@ -34380,7 +34383,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
34380
34383
  /* eslint-disable no-param-reassign */
34381
34384
 
34382
34385
  __webpack_require__(2787);
34383
- var MDXRuntime = (__webpack_require__(2114)["default"]);
34386
+ var Mdx = (__webpack_require__(2114)["default"]);
34384
34387
  var Variable = __webpack_require__(1882);
34385
34388
  var generateTOC = __webpack_require__(3263);
34386
34389
  var React = __webpack_require__(3634);
@@ -34600,7 +34603,7 @@ function react(content) {
34600
34603
  })), transformers, [remarkSlug, [remarkDisableTokenizers, opts.disableTokenizers]]);
34601
34604
  return /*#__PURE__*/React.createElement(ErrorBoundary, {
34602
34605
  key: content
34603
- }, /*#__PURE__*/React.createElement(MDXRuntime, {
34606
+ }, /*#__PURE__*/React.createElement(Mdx, {
34604
34607
  components: reactComponents(opts, components),
34605
34608
  rehypePlugins: [sectionAnchorId],
34606
34609
  remarkPlugins: remarkPlugins
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.66.0-beta.5",
5
+ "version": "6.66.0-beta.7",
6
6
  "main": "dist/main.node.js",
7
7
  "browser": "dist/main.js",
8
8
  "files": [