@readme/markdown 7.6.1 → 7.6.3

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
@@ -65297,7 +65297,7 @@ const readmeToMdx = () => tree => {
65297
65297
  parent.children.splice(index, 1, {
65298
65298
  type: 'mdxJsxFlowElement',
65299
65299
  name: 'Image',
65300
- attributes: toAttributes(Object.assign(Object.assign({}, image), { src: image.src || image.url }), imageAttrs),
65300
+ attributes: toAttributes(Object.assign(Object.assign({}, image), { border: image.data.hProperties.className === 'border', src: image.src || image.url }), imageAttrs),
65301
65301
  children: caption.children,
65302
65302
  });
65303
65303
  });
@@ -65413,18 +65413,24 @@ const alignToStyle = (align) => {
65413
65413
  };
65414
65414
  };
65415
65415
  const tables_to_jsx_isTableCell = (node) => ['tableHead', 'tableCell'].includes(node.type);
65416
+ const isLiteral = (node) => 'value' in node;
65416
65417
  const visitor = (table, index, parent) => {
65417
65418
  let hasFlowContent = false;
65418
65419
  const tableCellVisitor = (cell) => {
65419
65420
  const content = cell.children.length === 1 && cell.children[0].type === 'paragraph'
65420
65421
  ? cell.children[0].children[0]
65421
65422
  : cell.children[0];
65423
+ // @note: Compatibility with RDMD. Ideally, I'd put this in a separate
65424
+ // transformer, but then there'd be some duplication.
65425
+ visit(cell, 'break', (_, index, parent) => {
65426
+ parent.children.splice(index, 1, { type: 'text', value: '\n' });
65427
+ });
65422
65428
  if (!phrasing(content)) {
65423
65429
  hasFlowContent = true;
65424
65430
  return EXIT;
65425
65431
  }
65426
- visit(cell, 'text', (text) => {
65427
- if (text.value.match(/\n/)) {
65432
+ visit(cell, isLiteral, (node) => {
65433
+ if (node.value.match(/\n/)) {
65428
65434
  hasFlowContent = true;
65429
65435
  return EXIT;
65430
65436
  }
@@ -78120,8 +78126,10 @@ const tocToHast = (headings = []) => {
78120
78126
  while (stack.length > depth) {
78121
78127
  stack.pop();
78122
78128
  }
78123
- if (heading.properties)
78124
- stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, heading.children)));
78129
+ if (heading.properties) {
78130
+ const content = lib_plain({ type: 'root', children: heading.children });
78131
+ stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, content)));
78132
+ }
78125
78133
  });
78126
78134
  return ast;
78127
78135
  };
@@ -82729,6 +82737,10 @@ const callout = (node, _, state, info) => {
82729
82737
  const tracker = state.createTracker(info);
82730
82738
  tracker.move('> ');
82731
82739
  tracker.shift(2);
82740
+ // @note: compatability
82741
+ if (node.data.hProperties.title === '') {
82742
+ node.children.unshift({ type: 'paragraph', children: [{ type: 'text', value: '' }] });
82743
+ }
82732
82744
  const map = (line, index, blank) => {
82733
82745
  return `>${index === 0 ? ` ${node.data.hProperties.icon}` : ''}${blank ? '' : ' '}${line}`;
82734
82746
  };
@@ -93929,7 +93941,7 @@ const compatibility_html = (node) => {
93929
93941
  return xml.replace(/<html.*<body>(.*)<\/body><\/html>/ms, '$1');
93930
93942
  };
93931
93943
  const figureToImageBlock = (node) => {
93932
- const _a = node.children.find((child) => child.type === 'image'), { align, width, src, url, alt, title } = _a, image = compatibility_rest(_a, ["align", "width", "src", "url", "alt", "title"]);
93944
+ const _a = node.children.find((child) => child.type === 'image'), { align, border, width, src, url, alt, title } = _a, image = compatibility_rest(_a, ["align", "border", "width", "src", "url", "alt", "title"]);
93933
93945
  const { className } = image.data.hProperties;
93934
93946
  const figcaption = node.children.find((child) => child.type === 'figcaption');
93935
93947
  const caption = figcaption
@@ -93938,7 +93950,7 @@ const figureToImageBlock = (node) => {
93938
93950
  children: figcaption.children,
93939
93951
  }).trim()
93940
93952
  : null;
93941
- const attributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (alt && { alt })), (className && { border: className === 'border' })), (caption && { caption })), (title && { title })), (width && { width })), { src: src || url });
93953
+ const attributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (alt && { alt })), (className && { border: className === 'border' })), (border && { border })), (caption && { caption })), (title && { title })), (width && { width })), { src: src || url });
93942
93954
  return `<Image ${formatProps(attributes)} />`;
93943
93955
  };
93944
93956
  const embedToEmbedBlock = (node) => {
package/dist/main.node.js CHANGED
@@ -66284,7 +66284,7 @@ const readmeToMdx = () => tree => {
66284
66284
  parent.children.splice(index, 1, {
66285
66285
  type: 'mdxJsxFlowElement',
66286
66286
  name: 'Image',
66287
- attributes: toAttributes(Object.assign(Object.assign({}, image), { src: image.src || image.url }), imageAttrs),
66287
+ attributes: toAttributes(Object.assign(Object.assign({}, image), { border: image.data.hProperties.className === 'border', src: image.src || image.url }), imageAttrs),
66288
66288
  children: caption.children,
66289
66289
  });
66290
66290
  });
@@ -66400,18 +66400,24 @@ const alignToStyle = (align) => {
66400
66400
  };
66401
66401
  };
66402
66402
  const tables_to_jsx_isTableCell = (node) => ['tableHead', 'tableCell'].includes(node.type);
66403
+ const isLiteral = (node) => 'value' in node;
66403
66404
  const visitor = (table, index, parent) => {
66404
66405
  let hasFlowContent = false;
66405
66406
  const tableCellVisitor = (cell) => {
66406
66407
  const content = cell.children.length === 1 && cell.children[0].type === 'paragraph'
66407
66408
  ? cell.children[0].children[0]
66408
66409
  : cell.children[0];
66410
+ // @note: Compatibility with RDMD. Ideally, I'd put this in a separate
66411
+ // transformer, but then there'd be some duplication.
66412
+ visit(cell, 'break', (_, index, parent) => {
66413
+ parent.children.splice(index, 1, { type: 'text', value: '\n' });
66414
+ });
66409
66415
  if (!phrasing(content)) {
66410
66416
  hasFlowContent = true;
66411
66417
  return EXIT;
66412
66418
  }
66413
- visit(cell, 'text', (text) => {
66414
- if (text.value.match(/\n/)) {
66419
+ visit(cell, isLiteral, (node) => {
66420
+ if (node.value.match(/\n/)) {
66415
66421
  hasFlowContent = true;
66416
66422
  return EXIT;
66417
66423
  }
@@ -79107,8 +79113,10 @@ const tocToHast = (headings = []) => {
79107
79113
  while (stack.length > depth) {
79108
79114
  stack.pop();
79109
79115
  }
79110
- if (heading.properties)
79111
- stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, heading.children)));
79116
+ if (heading.properties) {
79117
+ const content = lib_plain({ type: 'root', children: heading.children });
79118
+ stack[stack.length - 1].children.push(h('li', null, h('a', { href: `#${heading.properties.id}` }, content)));
79119
+ }
79112
79120
  });
79113
79121
  return ast;
79114
79122
  };
@@ -83716,6 +83724,10 @@ const callout = (node, _, state, info) => {
83716
83724
  const tracker = state.createTracker(info);
83717
83725
  tracker.move('> ');
83718
83726
  tracker.shift(2);
83727
+ // @note: compatability
83728
+ if (node.data.hProperties.title === '') {
83729
+ node.children.unshift({ type: 'paragraph', children: [{ type: 'text', value: '' }] });
83730
+ }
83719
83731
  const map = (line, index, blank) => {
83720
83732
  return `>${index === 0 ? ` ${node.data.hProperties.icon}` : ''}${blank ? '' : ' '}${line}`;
83721
83733
  };
@@ -94916,7 +94928,7 @@ const compatibility_html = (node) => {
94916
94928
  return xml.replace(/<html.*<body>(.*)<\/body><\/html>/ms, '$1');
94917
94929
  };
94918
94930
  const figureToImageBlock = (node) => {
94919
- const _a = node.children.find((child) => child.type === 'image'), { align, width, src, url, alt, title } = _a, image = compatibility_rest(_a, ["align", "width", "src", "url", "alt", "title"]);
94931
+ const _a = node.children.find((child) => child.type === 'image'), { align, border, width, src, url, alt, title } = _a, image = compatibility_rest(_a, ["align", "border", "width", "src", "url", "alt", "title"]);
94920
94932
  const { className } = image.data.hProperties;
94921
94933
  const figcaption = node.children.find((child) => child.type === 'figcaption');
94922
94934
  const caption = figcaption
@@ -94925,7 +94937,7 @@ const figureToImageBlock = (node) => {
94925
94937
  children: figcaption.children,
94926
94938
  }).trim()
94927
94939
  : null;
94928
- const attributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (alt && { alt })), (className && { border: className === 'border' })), (caption && { caption })), (title && { title })), (width && { width })), { src: src || url });
94940
+ const attributes = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (alt && { alt })), (className && { border: className === 'border' })), (border && { border })), (caption && { caption })), (title && { title })), (width && { width })), { src: src || url });
94929
94941
  return `<Image ${formatProps(attributes)} />`;
94930
94942
  };
94931
94943
  const embedToEmbedBlock = (node) => {
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.1",
5
+ "version": "7.6.3",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",