@readme/markdown 9.2.1 → 9.2.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.
@@ -14,11 +14,11 @@ interface Props {
14
14
  const CodeTabs = (props: Props) => {
15
15
  const { children } = props;
16
16
  const theme = useContext(ThemeContext);
17
-
17
+ const hasMermaid = !Array.isArray(children) && children.props?.children.props.lang === 'mermaid';
18
18
 
19
19
  // render Mermaid diagram
20
20
  useEffect(() => {
21
- if (typeof window !== 'undefined') {
21
+ if (typeof window !== 'undefined' && hasMermaid) {
22
22
  import('mermaid').then(module => {
23
23
  mermaid = module.default;
24
24
  mermaid.initialize({
@@ -27,7 +27,7 @@ const CodeTabs = (props: Props) => {
27
27
  mermaid.contentLoaded();
28
28
  });
29
29
  }
30
- }, [theme]);
30
+ }, [hasMermaid, theme]);
31
31
 
32
32
  function handleClick({ target }, index: number) {
33
33
  const $wrap = target.parentElement.parentElement;
@@ -42,7 +42,7 @@ const CodeTabs = (props: Props) => {
42
42
  }
43
43
 
44
44
  // render single Mermaid diagram
45
- if (!Array.isArray(children) && children.props?.children.props.lang === 'mermaid') {
45
+ if (hasMermaid) {
46
46
  const value = children.props.children.props.value;
47
47
  return <pre className="mermaid mermaid_single">{value}</pre>;
48
48
  }
package/dist/main.js CHANGED
@@ -12039,9 +12039,10 @@ let mermaid;
12039
12039
  const CodeTabs = (props) => {
12040
12040
  const { children } = props;
12041
12041
  const theme = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useContext)(Theme);
12042
+ const hasMermaid = !Array.isArray(children) && children.props?.children.props.lang === 'mermaid';
12042
12043
  // render Mermaid diagram
12043
12044
  (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useEffect)(() => {
12044
- if (typeof window !== 'undefined') {
12045
+ if (typeof window !== 'undefined' && hasMermaid) {
12045
12046
  Promise.resolve(/* import() */).then(__webpack_require__.t.bind(__webpack_require__, 1387, 23)).then(module => {
12046
12047
  mermaid = module.default;
12047
12048
  mermaid.initialize({
@@ -12050,7 +12051,7 @@ const CodeTabs = (props) => {
12050
12051
  mermaid.contentLoaded();
12051
12052
  });
12052
12053
  }
12053
- }, [theme]);
12054
+ }, [hasMermaid, theme]);
12054
12055
  function handleClick({ target }, index) {
12055
12056
  const $wrap = target.parentElement.parentElement;
12056
12057
  const $open = [].slice.call($wrap.querySelectorAll('.CodeTabs_active'));
@@ -12061,7 +12062,7 @@ const CodeTabs = (props) => {
12061
12062
  target.classList.add('CodeTabs_active');
12062
12063
  }
12063
12064
  // render single Mermaid diagram
12064
- if (!Array.isArray(children) && children.props?.children.props.lang === 'mermaid') {
12065
+ if (hasMermaid) {
12065
12066
  const value = children.props.children.props.value;
12066
12067
  return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("pre", { className: "mermaid mermaid_single" }, value);
12067
12068
  }
package/dist/main.node.js CHANGED
@@ -16415,9 +16415,10 @@ let mermaid;
16415
16415
  const CodeTabs = (props) => {
16416
16416
  const { children } = props;
16417
16417
  const theme = (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useContext)(Theme);
16418
+ const hasMermaid = !Array.isArray(children) && children.props?.children.props.lang === 'mermaid';
16418
16419
  // render Mermaid diagram
16419
16420
  (0,external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useEffect)(() => {
16420
- if (typeof window !== 'undefined') {
16421
+ if (typeof window !== 'undefined' && hasMermaid) {
16421
16422
  __webpack_require__.e(/* import() */ 486).then(__webpack_require__.bind(__webpack_require__, 5486)).then(module => {
16422
16423
  mermaid = module.default;
16423
16424
  mermaid.initialize({
@@ -16426,7 +16427,7 @@ const CodeTabs = (props) => {
16426
16427
  mermaid.contentLoaded();
16427
16428
  });
16428
16429
  }
16429
- }, [theme]);
16430
+ }, [hasMermaid, theme]);
16430
16431
  function handleClick({ target }, index) {
16431
16432
  const $wrap = target.parentElement.parentElement;
16432
16433
  const $open = [].slice.call($wrap.querySelectorAll('.CodeTabs_active'));
@@ -16437,7 +16438,7 @@ const CodeTabs = (props) => {
16437
16438
  target.classList.add('CodeTabs_active');
16438
16439
  }
16439
16440
  // render single Mermaid diagram
16440
- if (!Array.isArray(children) && children.props?.children.props.lang === 'mermaid') {
16441
+ if (hasMermaid) {
16441
16442
  const value = children.props.children.props.value;
16442
16443
  return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("pre", { className: "mermaid mermaid_single" }, value);
16443
16444
  }