@readme/markdown 11.1.0 → 11.1.2

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.
Files changed (129) hide show
  1. package/components/Code/index.tsx +4 -3
  2. package/components/CodeTabs/index.tsx +5 -2
  3. package/dist/10.node.js +419 -207
  4. package/dist/10.node.js.map +1 -1
  5. package/dist/101.node.js +23 -0
  6. package/dist/101.node.js.map +1 -0
  7. package/dist/109.node.js +63 -0
  8. package/dist/109.node.js.map +1 -0
  9. package/dist/197.node.js +63 -0
  10. package/dist/197.node.js.map +1 -0
  11. package/dist/213.node.js +23 -0
  12. package/dist/213.node.js.map +1 -0
  13. package/dist/{580.node.js → 259.node.js} +98 -79
  14. package/dist/259.node.js.map +1 -0
  15. package/dist/339.node.js +4 -4
  16. package/dist/{912.node.js → 356.node.js} +154 -150
  17. package/dist/356.node.js.map +1 -0
  18. package/dist/357.node.js +1352 -0
  19. package/dist/357.node.js.map +1 -0
  20. package/dist/387.node.js +23 -0
  21. package/dist/387.node.js.map +1 -0
  22. package/dist/398.node.js +63 -0
  23. package/dist/398.node.js.map +1 -0
  24. package/dist/{805.node.js → 405.node.js} +110 -91
  25. package/dist/405.node.js.map +1 -0
  26. package/dist/{23.node.js → 434.node.js} +178 -118
  27. package/dist/434.node.js.map +1 -0
  28. package/dist/{550.node.js → 470.node.js} +105 -80
  29. package/dist/470.node.js.map +1 -0
  30. package/dist/{870.node.js → 474.node.js} +84 -77
  31. package/dist/474.node.js.map +1 -0
  32. package/dist/{649.node.js → 483.node.js} +70 -67
  33. package/dist/483.node.js.map +1 -0
  34. package/dist/486.node.js +23865 -25247
  35. package/dist/486.node.js.map +1 -1
  36. package/dist/{982.node.js → 524.node.js} +124 -88
  37. package/dist/524.node.js.map +1 -0
  38. package/dist/53.node.js +506 -0
  39. package/dist/53.node.js.map +1 -0
  40. package/dist/{898.node.js → 561.node.js} +54 -52
  41. package/dist/561.node.js.map +1 -0
  42. package/dist/579.node.js +23 -0
  43. package/dist/579.node.js.map +1 -0
  44. package/dist/{881.node.js → 680.node.js} +202 -142
  45. package/dist/680.node.js.map +1 -0
  46. package/dist/{915.node.js → 7.node.js} +265 -1210
  47. package/dist/7.node.js.map +1 -0
  48. package/dist/{188.node.js → 705.node.js} +135 -132
  49. package/dist/705.node.js.map +1 -0
  50. package/dist/713.node.js +23 -0
  51. package/dist/713.node.js.map +1 -0
  52. package/dist/{135.node.js → 720.node.js} +230 -138
  53. package/dist/720.node.js.map +1 -0
  54. package/dist/{364.node.js → 763.node.js} +488 -432
  55. package/dist/763.node.js.map +1 -0
  56. package/dist/{572.node.js → 828.node.js} +229 -185
  57. package/dist/828.node.js.map +1 -0
  58. package/dist/{311.node.js → 834.node.js} +106 -104
  59. package/dist/834.node.js.map +1 -0
  60. package/dist/{359.node.js → 863.node.js} +290 -236
  61. package/dist/863.node.js.map +1 -0
  62. package/dist/872.node.js +630 -0
  63. package/dist/872.node.js.map +1 -0
  64. package/dist/879.node.js +61 -0
  65. package/dist/879.node.js.map +1 -0
  66. package/dist/{371.node.js → 880.node.js} +401 -400
  67. package/dist/880.node.js.map +1 -0
  68. package/dist/{214.node.js → 894.node.js} +116 -114
  69. package/dist/894.node.js.map +1 -0
  70. package/dist/{890.node.js → 90.node.js} +134 -129
  71. package/dist/90.node.js.map +1 -0
  72. package/dist/{855.node.js → 901.node.js} +510 -522
  73. package/dist/901.node.js.map +1 -0
  74. package/dist/903.node.js +23 -0
  75. package/dist/903.node.js.map +1 -0
  76. package/dist/{38.node.js → 929.node.js} +920 -442
  77. package/dist/929.node.js.map +1 -0
  78. package/dist/941.node.js +23 -0
  79. package/dist/941.node.js.map +1 -0
  80. package/dist/995.node.js +2 -2
  81. package/dist/hooks/useHydrated/index.d.ts +6 -0
  82. package/dist/main.js +28 -10
  83. package/dist/main.node.js +34 -8
  84. package/dist/main.node.js.map +1 -1
  85. package/package.json +2 -2
  86. package/dist/122.node.js +0 -23
  87. package/dist/122.node.js.map +0 -1
  88. package/dist/135.node.js.map +0 -1
  89. package/dist/136.node.js +0 -23
  90. package/dist/136.node.js.map +0 -1
  91. package/dist/188.node.js.map +0 -1
  92. package/dist/214.node.js.map +0 -1
  93. package/dist/23.node.js.map +0 -1
  94. package/dist/311.node.js.map +0 -1
  95. package/dist/354.node.js +0 -23
  96. package/dist/354.node.js.map +0 -1
  97. package/dist/359.node.js.map +0 -1
  98. package/dist/364.node.js.map +0 -1
  99. package/dist/371.node.js.map +0 -1
  100. package/dist/38.node.js.map +0 -1
  101. package/dist/391.node.js +0 -522
  102. package/dist/391.node.js.map +0 -1
  103. package/dist/462.node.js +0 -23
  104. package/dist/462.node.js.map +0 -1
  105. package/dist/48.node.js +0 -57
  106. package/dist/48.node.js.map +0 -1
  107. package/dist/537.node.js +0 -59
  108. package/dist/537.node.js.map +0 -1
  109. package/dist/550.node.js.map +0 -1
  110. package/dist/572.node.js.map +0 -1
  111. package/dist/580.node.js.map +0 -1
  112. package/dist/649.node.js.map +0 -1
  113. package/dist/740.node.js +0 -23
  114. package/dist/740.node.js.map +0 -1
  115. package/dist/741.node.js +0 -23
  116. package/dist/741.node.js.map +0 -1
  117. package/dist/779.node.js +0 -57
  118. package/dist/779.node.js.map +0 -1
  119. package/dist/805.node.js.map +0 -1
  120. package/dist/855.node.js.map +0 -1
  121. package/dist/870.node.js.map +0 -1
  122. package/dist/874.node.js +0 -57
  123. package/dist/874.node.js.map +0 -1
  124. package/dist/881.node.js.map +0 -1
  125. package/dist/890.node.js.map +0 -1
  126. package/dist/898.node.js.map +0 -1
  127. package/dist/912.node.js.map +0 -1
  128. package/dist/915.node.js.map +0 -1
  129. package/dist/982.node.js.map +0 -1
package/dist/main.js CHANGED
@@ -1458,7 +1458,7 @@ var hide = __webpack_require__(3341);
1458
1458
  var Iterators = __webpack_require__(906);
1459
1459
  var $iterCreate = __webpack_require__(6032);
1460
1460
  var setToStringTag = __webpack_require__(3844);
1461
- var getPrototypeOf = __webpack_require__(3008);
1461
+ var getPrototypeOf = __webpack_require__(627);
1462
1462
  var ITERATOR = __webpack_require__(7574)('iterator');
1463
1463
  var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
1464
1464
  var FF_ITERATOR = '@@iterator';
@@ -1771,7 +1771,7 @@ exports.f = Object.getOwnPropertySymbols;
1771
1771
 
1772
1772
  /***/ }),
1773
1773
 
1774
- /***/ 3008:
1774
+ /***/ 627:
1775
1775
  /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1776
1776
 
1777
1777
  // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
@@ -8917,11 +8917,25 @@ const CodeOptsContext = (0,external_amd_react_commonjs_react_commonjs2_react_roo
8917
8917
  const ThemeContext = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createContext)('light');
8918
8918
  /* harmony default export */ const Theme = (ThemeContext);
8919
8919
 
8920
+ ;// ./hooks/useHydrated/index.tsx
8921
+
8922
+ /**
8923
+ * A hook that returns whether or not the component has been hydrated.
8924
+ * Useful for components that should only render in the browser, and not during SSR.
8925
+ * Waiting to render until after hydration avoids React hydration mismatches.
8926
+ */
8927
+ function useHydrated() {
8928
+ const [isHydrated, setIsHydrated] = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useState)(false);
8929
+ (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useEffect)(() => setIsHydrated(true), []);
8930
+ return isHydrated;
8931
+ }
8932
+
8920
8933
  ;// ./components/Code/index.tsx
8921
8934
 
8922
8935
 
8923
8936
 
8924
8937
 
8938
+
8925
8939
  // Only load CodeMirror in the browser, for SSR
8926
8940
  // apps. Necessary because of people like this:
8927
8941
  // https://github.com/codemirror/CodeMirror/issues/3701#issuecomment-164904534
@@ -8951,7 +8965,8 @@ const Code = (props) => {
8951
8965
  const { children, lang, value } = props;
8952
8966
  const theme = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useContext)(Theme);
8953
8967
  const copyButtons = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useContext)(CodeOpts) || props.copyButtons;
8954
- const language = canonicalLanguage(lang);
8968
+ const isHydrated = useHydrated();
8969
+ const language = isHydrated ? canonicalLanguage(lang) : '';
8955
8970
  const codeRef = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createRef)();
8956
8971
  const codeOpts = {
8957
8972
  inline: !lang,
@@ -8959,7 +8974,7 @@ const Code = (props) => {
8959
8974
  dark: theme === 'dark',
8960
8975
  };
8961
8976
  const code = value ?? (Array.isArray(children) ? children[0] : children) ?? '';
8962
- const highlightedCode = syntaxHighlighter && typeof syntaxHighlighter === 'function' && code
8977
+ const highlightedCode = syntaxHighlighter && typeof syntaxHighlighter === 'function' && code && isHydrated
8963
8978
  ? syntaxHighlighter(code, language, codeOpts, { mdx: true })
8964
8979
  : code;
8965
8980
  if (language === 'mermaid') {
@@ -8967,7 +8982,7 @@ const Code = (props) => {
8967
8982
  }
8968
8983
  return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement((external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default()).Fragment, null,
8969
8984
  copyButtons && external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(CopyCode, { className: "fa", codeRef: codeRef }),
8970
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("code", { ref: codeRef, className: ['rdmd-code', `lang-${language}`, `theme-${theme}`].join(' '), "data-lang": language, suppressHydrationWarning: true }, highlightedCode)));
8985
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("code", { ref: codeRef, className: ['rdmd-code', `lang-${language}`, `theme-${theme}`].join(' '), "data-lang": language }, highlightedCode)));
8971
8986
  };
8972
8987
  /* harmony default export */ const components_Code = (Code);
8973
8988
 
@@ -8988,9 +9003,12 @@ const CodeTabs = (props) => {
8988
9003
  Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 1387, 23)).then(module => {
8989
9004
  mermaid = module.default;
8990
9005
  mermaid.initialize({
9006
+ startOnLoad: false,
8991
9007
  theme: theme === 'dark' ? 'dark' : 'default',
8992
9008
  });
8993
- mermaid.contentLoaded();
9009
+ mermaid.run({
9010
+ nodes: document.querySelectorAll('.mermaid-render'),
9011
+ });
8994
9012
  });
8995
9013
  }
8996
9014
  }, [hasMermaid, theme]);
@@ -9006,7 +9024,7 @@ const CodeTabs = (props) => {
9006
9024
  // render single Mermaid diagram
9007
9025
  if (hasMermaid) {
9008
9026
  const value = children.props.children.props.value;
9009
- return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("pre", { className: "mermaid mermaid_single" }, value);
9027
+ return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("pre", { className: "mermaid-render mermaid_single" }, value);
9010
9028
  }
9011
9029
  return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: `CodeTabs CodeTabs_initial theme-${theme}` },
9012
9030
  external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "CodeTabs-toolbar" }, (Array.isArray(children) ? children : [children]).map((pre, i) => {
@@ -67365,7 +67383,7 @@ const mermaidTransformer = () => (tree) => {
67365
67383
  if (child.type === 'element' && child.tagName === 'code' && child.properties.lang === 'mermaid') {
67366
67384
  node.properties = {
67367
67385
  ...node.properties,
67368
- className: ['mermaid', ...(node.properties.className || [])],
67386
+ className: ['mermaid-render', ...(node.properties.className || [])],
67369
67387
  };
67370
67388
  }
67371
67389
  });
@@ -67634,7 +67652,7 @@ const readmeToMdx = () => tree => {
67634
67652
  return;
67635
67653
  if ('url' in image)
67636
67654
  image.data.hProperties.src = image.url;
67637
- const attributes = toAttributes(image.data.hProperties, imageAttrs);
67655
+ const attributes = toAttributes({ ...image, ...image.data.hProperties }, imageAttrs);
67638
67656
  if (image.data.hProperties.className === 'emoji') {
67639
67657
  parent.children.splice(index, 1, {
67640
67658
  type: NodeTypes.emoji,
@@ -67652,7 +67670,7 @@ const readmeToMdx = () => tree => {
67652
67670
  }
67653
67671
  });
67654
67672
  visit(tree, NodeTypes.imageBlock, (image, index, parent) => {
67655
- const attributes = toAttributes(image.data.hProperties, imageAttrs);
67673
+ const attributes = toAttributes({ ...image, ...image.data.hProperties }, imageAttrs);
67656
67674
  if (hasExtra(attributes)) {
67657
67675
  parent.children.splice(index, 1, {
67658
67676
  type: 'mdxJsxFlowElement',
package/dist/main.node.js CHANGED
@@ -16068,6 +16068,14 @@ module.exports = require("react");
16068
16068
 
16069
16069
  /***/ }),
16070
16070
 
16071
+ /***/ 6982:
16072
+ /***/ ((module) => {
16073
+
16074
+ "use strict";
16075
+ module.exports = require("crypto");
16076
+
16077
+ /***/ }),
16078
+
16071
16079
  /***/ 9896:
16072
16080
  /***/ ((module) => {
16073
16081
 
@@ -16578,11 +16586,25 @@ const CodeOptsContext = (0,external_react_.createContext)(false);
16578
16586
  const ThemeContext = (0,external_react_.createContext)('light');
16579
16587
  /* harmony default export */ const Theme = (ThemeContext);
16580
16588
 
16589
+ ;// ./hooks/useHydrated/index.tsx
16590
+
16591
+ /**
16592
+ * A hook that returns whether or not the component has been hydrated.
16593
+ * Useful for components that should only render in the browser, and not during SSR.
16594
+ * Waiting to render until after hydration avoids React hydration mismatches.
16595
+ */
16596
+ function useHydrated() {
16597
+ const [isHydrated, setIsHydrated] = (0,external_react_.useState)(false);
16598
+ (0,external_react_.useEffect)(() => setIsHydrated(true), []);
16599
+ return isHydrated;
16600
+ }
16601
+
16581
16602
  ;// ./components/Code/index.tsx
16582
16603
 
16583
16604
 
16584
16605
 
16585
16606
 
16607
+
16586
16608
  // Only load CodeMirror in the browser, for SSR
16587
16609
  // apps. Necessary because of people like this:
16588
16610
  // https://github.com/codemirror/CodeMirror/issues/3701#issuecomment-164904534
@@ -16612,7 +16634,8 @@ const Code = (props) => {
16612
16634
  const { children, lang, value } = props;
16613
16635
  const theme = (0,external_react_.useContext)(Theme);
16614
16636
  const copyButtons = (0,external_react_.useContext)(CodeOpts) || props.copyButtons;
16615
- const language = canonicalLanguage(lang);
16637
+ const isHydrated = useHydrated();
16638
+ const language = isHydrated ? canonicalLanguage(lang) : '';
16616
16639
  const codeRef = (0,external_react_.createRef)();
16617
16640
  const codeOpts = {
16618
16641
  inline: !lang,
@@ -16620,7 +16643,7 @@ const Code = (props) => {
16620
16643
  dark: theme === 'dark',
16621
16644
  };
16622
16645
  const code = value ?? (Array.isArray(children) ? children[0] : children) ?? '';
16623
- const highlightedCode = syntaxHighlighter && typeof syntaxHighlighter === 'function' && code
16646
+ const highlightedCode = syntaxHighlighter && typeof syntaxHighlighter === 'function' && code && isHydrated
16624
16647
  ? syntaxHighlighter(code, language, codeOpts, { mdx: true })
16625
16648
  : code;
16626
16649
  if (language === 'mermaid') {
@@ -16628,7 +16651,7 @@ const Code = (props) => {
16628
16651
  }
16629
16652
  return (external_react_default().createElement((external_react_default()).Fragment, null,
16630
16653
  copyButtons && external_react_default().createElement(CopyCode, { className: "fa", codeRef: codeRef }),
16631
- external_react_default().createElement("code", { ref: codeRef, className: ['rdmd-code', `lang-${language}`, `theme-${theme}`].join(' '), "data-lang": language, suppressHydrationWarning: true }, highlightedCode)));
16654
+ external_react_default().createElement("code", { ref: codeRef, className: ['rdmd-code', `lang-${language}`, `theme-${theme}`].join(' '), "data-lang": language }, highlightedCode)));
16632
16655
  };
16633
16656
  /* harmony default export */ const components_Code = (Code);
16634
16657
 
@@ -16649,9 +16672,12 @@ const CodeTabs = (props) => {
16649
16672
  __webpack_require__.e(/* import() */ 486).then(__webpack_require__.bind(__webpack_require__, 5486)).then(module => {
16650
16673
  mermaid = module.default;
16651
16674
  mermaid.initialize({
16675
+ startOnLoad: false,
16652
16676
  theme: theme === 'dark' ? 'dark' : 'default',
16653
16677
  });
16654
- mermaid.contentLoaded();
16678
+ mermaid.run({
16679
+ nodes: document.querySelectorAll('.mermaid-render'),
16680
+ });
16655
16681
  });
16656
16682
  }
16657
16683
  }, [hasMermaid, theme]);
@@ -16667,7 +16693,7 @@ const CodeTabs = (props) => {
16667
16693
  // render single Mermaid diagram
16668
16694
  if (hasMermaid) {
16669
16695
  const value = children.props.children.props.value;
16670
- return external_react_default().createElement("pre", { className: "mermaid mermaid_single" }, value);
16696
+ return external_react_default().createElement("pre", { className: "mermaid-render mermaid_single" }, value);
16671
16697
  }
16672
16698
  return (external_react_default().createElement("div", { className: `CodeTabs CodeTabs_initial theme-${theme}` },
16673
16699
  external_react_default().createElement("div", { className: "CodeTabs-toolbar" }, (Array.isArray(children) ? children : [children]).map((pre, i) => {
@@ -87568,7 +87594,7 @@ const mermaidTransformer = () => (tree) => {
87568
87594
  if (child.type === 'element' && child.tagName === 'code' && child.properties.lang === 'mermaid') {
87569
87595
  node.properties = {
87570
87596
  ...node.properties,
87571
- className: ['mermaid', ...(node.properties.className || [])],
87597
+ className: ['mermaid-render', ...(node.properties.className || [])],
87572
87598
  };
87573
87599
  }
87574
87600
  });
@@ -87837,7 +87863,7 @@ const readmeToMdx = () => tree => {
87837
87863
  return;
87838
87864
  if ('url' in image)
87839
87865
  image.data.hProperties.src = image.url;
87840
- const attributes = toAttributes(image.data.hProperties, imageAttrs);
87866
+ const attributes = toAttributes({ ...image, ...image.data.hProperties }, imageAttrs);
87841
87867
  if (image.data.hProperties.className === 'emoji') {
87842
87868
  parent.children.splice(index, 1, {
87843
87869
  type: NodeTypes.emoji,
@@ -87855,7 +87881,7 @@ const readmeToMdx = () => tree => {
87855
87881
  }
87856
87882
  });
87857
87883
  visit(tree, NodeTypes.imageBlock, (image, index, parent) => {
87858
- const attributes = toAttributes(image.data.hProperties, imageAttrs);
87884
+ const attributes = toAttributes({ ...image, ...image.data.hProperties }, imageAttrs);
87859
87885
  if (hasExtra(attributes)) {
87860
87886
  parent.children.splice(index, 1, {
87861
87887
  type: 'mdxJsxFlowElement',