@readme/markdown 7.6.2 → 7.6.4

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.js CHANGED
@@ -65294,10 +65294,12 @@ const readmeToMdx = () => tree => {
65294
65294
  });
65295
65295
  visit(tree, 'figure', (figure, index, parent) => {
65296
65296
  const [image, caption] = figure.children;
65297
+ const { align, width } = image.data.hProperties;
65298
+ const border = image.data.hProperties.className === 'border';
65297
65299
  parent.children.splice(index, 1, {
65298
65300
  type: 'mdxJsxFlowElement',
65299
65301
  name: 'Image',
65300
- attributes: toAttributes(Object.assign(Object.assign({}, image), { border: image.data.hProperties.className === 'border', src: image.src || image.url }), imageAttrs),
65302
+ attributes: toAttributes(Object.assign(Object.assign(Object.assign(Object.assign({}, image), { align, width }), (border && { border })), { src: image.src || image.url }), imageAttrs),
65301
65303
  children: caption.children,
65302
65304
  });
65303
65305
  });
@@ -65413,6 +65415,7 @@ const alignToStyle = (align) => {
65413
65415
  };
65414
65416
  };
65415
65417
  const tables_to_jsx_isTableCell = (node) => ['tableHead', 'tableCell'].includes(node.type);
65418
+ const isLiteral = (node) => 'value' in node;
65416
65419
  const visitor = (table, index, parent) => {
65417
65420
  let hasFlowContent = false;
65418
65421
  const tableCellVisitor = (cell) => {
@@ -65428,8 +65431,8 @@ const visitor = (table, index, parent) => {
65428
65431
  hasFlowContent = true;
65429
65432
  return EXIT;
65430
65433
  }
65431
- visit(cell, 'text', (text) => {
65432
- if (text.value.match(/\n/)) {
65434
+ visit(cell, isLiteral, (node) => {
65435
+ if (node.value.match(/\n/)) {
65433
65436
  hasFlowContent = true;
65434
65437
  return EXIT;
65435
65438
  }
@@ -78125,8 +78128,10 @@ const tocToHast = (headings = []) => {
78125
78128
  while (stack.length > depth) {
78126
78129
  stack.pop();
78127
78130
  }
78128
- if (heading.properties)
78129
- stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, heading.children)));
78131
+ if (heading.properties) {
78132
+ const content = lib_plain({ type: 'root', children: heading.children });
78133
+ stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, content)));
78134
+ }
78130
78135
  });
78131
78136
  return ast;
78132
78137
  };
package/dist/main.node.js CHANGED
@@ -66281,10 +66281,12 @@ const readmeToMdx = () => tree => {
66281
66281
  });
66282
66282
  visit(tree, 'figure', (figure, index, parent) => {
66283
66283
  const [image, caption] = figure.children;
66284
+ const { align, width } = image.data.hProperties;
66285
+ const border = image.data.hProperties.className === 'border';
66284
66286
  parent.children.splice(index, 1, {
66285
66287
  type: 'mdxJsxFlowElement',
66286
66288
  name: 'Image',
66287
- attributes: toAttributes(Object.assign(Object.assign({}, image), { border: image.data.hProperties.className === 'border', src: image.src || image.url }), imageAttrs),
66289
+ attributes: toAttributes(Object.assign(Object.assign(Object.assign(Object.assign({}, image), { align, width }), (border && { border })), { src: image.src || image.url }), imageAttrs),
66288
66290
  children: caption.children,
66289
66291
  });
66290
66292
  });
@@ -66400,6 +66402,7 @@ const alignToStyle = (align) => {
66400
66402
  };
66401
66403
  };
66402
66404
  const tables_to_jsx_isTableCell = (node) => ['tableHead', 'tableCell'].includes(node.type);
66405
+ const isLiteral = (node) => 'value' in node;
66403
66406
  const visitor = (table, index, parent) => {
66404
66407
  let hasFlowContent = false;
66405
66408
  const tableCellVisitor = (cell) => {
@@ -66415,8 +66418,8 @@ const visitor = (table, index, parent) => {
66415
66418
  hasFlowContent = true;
66416
66419
  return EXIT;
66417
66420
  }
66418
- visit(cell, 'text', (text) => {
66419
- if (text.value.match(/\n/)) {
66421
+ visit(cell, isLiteral, (node) => {
66422
+ if (node.value.match(/\n/)) {
66420
66423
  hasFlowContent = true;
66421
66424
  return EXIT;
66422
66425
  }
@@ -79112,8 +79115,10 @@ const tocToHast = (headings = []) => {
79112
79115
  while (stack.length > depth) {
79113
79116
  stack.pop();
79114
79117
  }
79115
- if (heading.properties)
79116
- stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, heading.children)));
79118
+ if (heading.properties) {
79119
+ const content = lib_plain({ type: 'root', children: heading.children });
79120
+ stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, content)));
79121
+ }
79117
79122
  });
79118
79123
  return ast;
79119
79124
  };
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": "7.6.2",
5
+ "version": "7.6.4",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",