@readme/markdown 10.2.6 → 10.2.8

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.
package/dist/main.node.js CHANGED
@@ -16196,11 +16196,12 @@ const defaultIcons = {
16196
16196
  error: '\u2757\uFE0F',
16197
16197
  };
16198
16198
  const Callout = (props) => {
16199
- const { attributes, theme = 'default', empty } = props;
16199
+ const { attributes, empty } = props;
16200
16200
  const children = external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.Children.toArray(props.children);
16201
16201
  const icon = props.icon;
16202
16202
  const isEmoji = icon && emoji_regex().test(icon);
16203
16203
  const heading = empty ? external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("p", { className: 'callout-heading empty' }) : children[0];
16204
+ const theme = props.theme || (icon && themes[icon]) || 'default';
16204
16205
  return (
16205
16206
  // @ts-expect-error -- theme is not a valid attribute
16206
16207
  // eslint-disable-next-line react/jsx-props-no-spreading, react/no-unknown-property
@@ -57727,8 +57728,10 @@ var NodeTypes;
57727
57728
  NodeTypes["i"] = "i";
57728
57729
  NodeTypes["imageBlock"] = "image-block";
57729
57730
  NodeTypes["plain"] = "plain";
57731
+ NodeTypes["recipe"] = "recipe";
57730
57732
  NodeTypes["reusableContent"] = "reusable-content";
57731
57733
  NodeTypes["tableau"] = "tableau";
57734
+ /** @deprecated Deprecated in favor of `recipe`. */
57732
57735
  NodeTypes["tutorialTile"] = "tutorial-tile";
57733
57736
  NodeTypes["variable"] = "readme-variable";
57734
57737
  })(NodeTypes || (NodeTypes = {}));
@@ -69608,13 +69611,6 @@ const findFirst = (node) => {
69608
69611
  return node;
69609
69612
  return null;
69610
69613
  };
69611
- const findLast = (node) => {
69612
- if ('children' in node && Array.isArray(node.children))
69613
- return findFirst(node.children[node.children.length - 1]);
69614
- if (node.type === 'text')
69615
- return node;
69616
- return null;
69617
- };
69618
69614
  const wrapHeading = (node) => {
69619
69615
  const firstChild = node.children[0];
69620
69616
  return {
@@ -69622,8 +69618,8 @@ const wrapHeading = (node) => {
69622
69618
  depth: 3,
69623
69619
  children: ('children' in firstChild ? firstChild.children : []),
69624
69620
  position: {
69625
- start: findFirst(firstChild)?.position.start,
69626
- end: findLast(firstChild)?.position.end,
69621
+ start: firstChild.position.start,
69622
+ end: firstChild.position.end,
69627
69623
  },
69628
69624
  };
69629
69625
  };
@@ -69645,6 +69641,11 @@ const calloutTransformer = () => {
69645
69641
  }
69646
69642
  if (heading) {
69647
69643
  node.children[0] = wrapHeading(node);
69644
+ // @note: We add to the offset/column the length of the unicode
69645
+ // character that was stripped off, so that the start position of the
69646
+ // heading/text matches where it actually starts.
69647
+ node.children[0].position.start.offset += match.length;
69648
+ node.children[0].position.start.column += match.length;
69648
69649
  }
69649
69650
  Object.assign(node, {
69650
69651
  type: NodeTypes.callout,
@@ -69741,7 +69742,7 @@ const compatibilityTransfomer = () => tree => {
69741
69742
  ;// ./processor/transform/div.ts
69742
69743
 
69743
69744
 
69744
- // This transformer has been necessary for migrating legacy markdown files
69745
+ // This transformer has been necessary for migrating legacy markdown files
69745
69746
  // where tutorial tiles were wrapped in a div. It also provides a fallback for legacy magic blocks that were never fully supported:
69746
69747
  // [block:custom-block]
69747
69748
  // { ... }
@@ -69759,7 +69760,7 @@ const divTransformer = () => tree => {
69759
69760
  const { hName, hProperties, ...rest } = node.data;
69760
69761
  const tile = {
69761
69762
  ...rest,
69762
- type: NodeTypes.tutorialTile,
69763
+ type: NodeTypes.recipe,
69763
69764
  };
69764
69765
  parent.children.splice(index, 1, tile);
69765
69766
  }
@@ -87256,7 +87257,8 @@ const readme_components_types = {
87256
87257
  HTMLBlock: NodeTypes.htmlBlock,
87257
87258
  Table: 'table',
87258
87259
  Variable: NodeTypes.variable,
87259
- TutorialTile: NodeTypes.tutorialTile,
87260
+ Recipe: NodeTypes.recipe,
87261
+ TutorialTile: NodeTypes.recipe, // coerce to recipe for backwards compatibility
87260
87262
  };
87261
87263
  var TableNames;
87262
87264
  (function (TableNames) {
@@ -107681,8 +107683,8 @@ const makeUseMDXComponents = (more = {}) => {
107681
107683
  'html-block': components_HTMLBlock,
107682
107684
  'image-block': components_Image,
107683
107685
  'table-of-contents': components_TableOfContents,
107684
- // Ensures backwards compatibility with historical TutoirialTile component
107685
- 'TutorialTile': components_Recipe,
107686
+ // Ensures backwards compatibility with historical TutorialTile component
107687
+ TutorialTile: components_Recipe,
107686
107688
  ...headings,
107687
107689
  ...more,
107688
107690
  };