@readme/markdown 7.5.1 → 7.5.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
@@ -65169,8 +65169,8 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
65169
65169
  }
65170
65170
  else if (node.name === 'Image') {
65171
65171
  const { position } = node;
65172
- const { alt = '', align, border, caption, title = null, width, src, } = getAttrs(node);
65173
- const attrs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (border && { border })), (src && { src })), (width && { width })), { alt, children: caption ? lib_mdast(caption).children : node.children, title });
65172
+ const { alt = '', align, border, caption, height, title = null, width, src, } = getAttrs(node);
65173
+ const attrs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (border && { border })), (src && { src })), (width && { width })), (height && { height })), { alt, children: caption ? lib_mdast(caption).children : node.children, title });
65174
65174
  const mdNode = Object.assign(Object.assign({}, attrs), { position, type: NodeTypes.imageBlock, data: {
65175
65175
  hName: 'img',
65176
65176
  hProperties: attrs,
@@ -65277,7 +65277,7 @@ const readmeComponents = (opts) => () => tree => {
65277
65277
 
65278
65278
 
65279
65279
 
65280
- const imageAttrs = ['align', 'alt', 'caption', 'border', 'src', 'title', 'width', 'lazy', 'className'];
65280
+ const imageAttrs = ['align', 'alt', 'caption', 'border', 'height', 'src', 'title', 'width', 'lazy', 'className'];
65281
65281
  const readmeToMdx = () => tree => {
65282
65282
  // Unwrap pinned nodes, replace rdme-pin with its child node
65283
65283
  visit(tree, 'rdme-pin', (node, i, parent) => {
@@ -65308,7 +65308,14 @@ const readmeToMdx = () => tree => {
65308
65308
  if ('url' in image)
65309
65309
  image.data.hProperties.src = image.url;
65310
65310
  const attributes = toAttributes(image.data.hProperties, imageAttrs);
65311
- if (hasExtra(attributes)) {
65311
+ if (image.data.hProperties.className === 'emoji') {
65312
+ parent.children.splice(index, 1, {
65313
+ type: NodeTypes.emoji,
65314
+ name: image.title.replace(/^:(.*):$/, '$1'),
65315
+ value: image.title,
65316
+ });
65317
+ }
65318
+ else if (hasExtra(attributes)) {
65312
65319
  parent.children.splice(index, 1, {
65313
65320
  type: 'mdxJsxFlowElement',
65314
65321
  name: 'Image',
package/dist/main.node.js CHANGED
@@ -66156,8 +66156,8 @@ const coerceJsxToMd = ({ components = {}, html = false } = {}) => (node, index,
66156
66156
  }
66157
66157
  else if (node.name === 'Image') {
66158
66158
  const { position } = node;
66159
- const { alt = '', align, border, caption, title = null, width, src, } = getAttrs(node);
66160
- const attrs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (border && { border })), (src && { src })), (width && { width })), { alt, children: caption ? lib_mdast(caption).children : node.children, title });
66159
+ const { alt = '', align, border, caption, height, title = null, width, src, } = getAttrs(node);
66160
+ const attrs = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (align && { align })), (border && { border })), (src && { src })), (width && { width })), (height && { height })), { alt, children: caption ? lib_mdast(caption).children : node.children, title });
66161
66161
  const mdNode = Object.assign(Object.assign({}, attrs), { position, type: NodeTypes.imageBlock, data: {
66162
66162
  hName: 'img',
66163
66163
  hProperties: attrs,
@@ -66264,7 +66264,7 @@ const readmeComponents = (opts) => () => tree => {
66264
66264
 
66265
66265
 
66266
66266
 
66267
- const imageAttrs = ['align', 'alt', 'caption', 'border', 'src', 'title', 'width', 'lazy', 'className'];
66267
+ const imageAttrs = ['align', 'alt', 'caption', 'border', 'height', 'src', 'title', 'width', 'lazy', 'className'];
66268
66268
  const readmeToMdx = () => tree => {
66269
66269
  // Unwrap pinned nodes, replace rdme-pin with its child node
66270
66270
  visit(tree, 'rdme-pin', (node, i, parent) => {
@@ -66295,7 +66295,14 @@ const readmeToMdx = () => tree => {
66295
66295
  if ('url' in image)
66296
66296
  image.data.hProperties.src = image.url;
66297
66297
  const attributes = toAttributes(image.data.hProperties, imageAttrs);
66298
- if (hasExtra(attributes)) {
66298
+ if (image.data.hProperties.className === 'emoji') {
66299
+ parent.children.splice(index, 1, {
66300
+ type: NodeTypes.emoji,
66301
+ name: image.title.replace(/^:(.*):$/, '$1'),
66302
+ value: image.title,
66303
+ });
66304
+ }
66305
+ else if (hasExtra(attributes)) {
66299
66306
  parent.children.splice(index, 1, {
66300
66307
  type: 'mdxJsxFlowElement',
66301
66308
  name: 'Image',
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.5.1",
5
+ "version": "7.5.3",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",