@readme/markdown 6.75.0-beta.65 → 6.75.0-beta.66

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.
@@ -16,7 +16,7 @@ interface ImageProps {
16
16
 
17
17
  const Image = (Props: ImageProps) => {
18
18
  const {
19
- align = '',
19
+ align = 'center',
20
20
  alt = '',
21
21
  border = false,
22
22
  caption,
@@ -25,7 +25,7 @@ const Image = (Props: ImageProps) => {
25
25
  src,
26
26
  title = '',
27
27
  width = 'auto',
28
- lazy = false,
28
+ lazy = true,
29
29
  children,
30
30
  } = Props;
31
31
 
@@ -60,55 +60,53 @@ const Image = (Props: ImageProps) => {
60
60
 
61
61
  if (caption) {
62
62
  return (
63
- <span
64
- aria-label={alt}
65
- className={`img lightbox ${lightbox ? 'open' : 'closed'}`}
66
- onClick={toggle}
67
- onKeyDown={handleKeyDown}
68
- role={'button'}
69
- tabIndex={0}
70
- >
71
- <span className="lightbox-inner">
72
- <figure>
63
+ <figure>
64
+ <span
65
+ aria-label={alt}
66
+ className={`img lightbox ${lightbox ? 'open' : 'closed'}`}
67
+ onClick={toggle}
68
+ onKeyDown={handleKeyDown}
69
+ role={'button'}
70
+ tabIndex={0}
71
+ >
72
+ <span className="lightbox-inner">
73
73
  <img
74
74
  src={src}
75
75
  width={width}
76
76
  height={height}
77
77
  title={title}
78
- className={`img img-align-center ${border ? 'border' : ''}`}
78
+ className={`img img-align-center${border ? ' border' : ''}`}
79
79
  alt={alt}
80
80
  loading={lazy ? 'lazy' : 'eager'}
81
81
  />
82
82
  <figcaption>{children || caption}</figcaption>
83
- </figure>
83
+ </span>
84
84
  </span>
85
- </span>
85
+ </figure>
86
86
  );
87
87
  }
88
88
 
89
89
  return (
90
- <p>
91
- <span
92
- aria-label={alt}
93
- className={`img lightbox ${lightbox ? 'open' : 'closed'}`}
94
- onClick={toggle}
95
- onKeyDown={handleKeyDown}
96
- role={'button'}
97
- tabIndex={0}
98
- >
99
- <span className="lightbox-inner">
100
- <img
101
- src={src}
102
- width={width}
103
- height={height}
104
- title={title}
105
- className={`img img-align-${align} ${border ? 'border' : ''}`}
106
- alt={alt}
107
- loading={lazy ? 'lazy' : 'eager'}
108
- />
109
- </span>
90
+ <span
91
+ aria-label={alt}
92
+ className={`img lightbox ${lightbox ? 'open' : 'closed'}`}
93
+ onClick={toggle}
94
+ onKeyDown={handleKeyDown}
95
+ role={'button'}
96
+ tabIndex={0}
97
+ >
98
+ <span className="lightbox-inner">
99
+ <img
100
+ src={src}
101
+ width={width}
102
+ height={height}
103
+ title={title}
104
+ className={`img img-align-${align}${border ? ' border' : ''}`}
105
+ alt={alt}
106
+ loading={lazy ? 'lazy' : 'eager'}
107
+ />
110
108
  </span>
111
- </p>
109
+ </span>
112
110
  );
113
111
  };
114
112
 
package/dist/main.js CHANGED
@@ -14444,7 +14444,7 @@ const CreateHeading = (depth) => (props) => external_amd_react_commonjs_react_co
14444
14444
  ;// CONCATENATED MODULE: ./components/Image/index.tsx
14445
14445
 
14446
14446
  const Image = (Props) => {
14447
- const { align = '', alt = '', border = false, caption, className = '', height = 'auto', src, title = '', width = 'auto', lazy = false, children, } = Props;
14447
+ const { align = 'center', alt = '', border = false, caption, className = '', height = 'auto', src, title = '', width = 'auto', lazy = true, children, } = Props;
14448
14448
  const [lightbox, setLightbox] = external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useState(false);
14449
14449
  if (className === 'emoji') {
14450
14450
  return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, alt: alt, loading: lazy ? 'lazy' : 'eager' });
@@ -14472,16 +14472,15 @@ const Image = (Props) => {
14472
14472
  setLightbox(!lightbox);
14473
14473
  };
14474
14474
  if (caption) {
14475
- return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": alt, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
14476
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
14477
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("figure", null,
14478
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-center ${border ? 'border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }),
14475
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("figure", null,
14476
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": alt, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
14477
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
14478
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-center${border ? ' border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }),
14479
14479
  external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("figcaption", null, children || caption)))));
14480
14480
  }
14481
- return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("p", null,
14482
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": alt, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
14483
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
14484
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-${align} ${border ? 'border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' })))));
14481
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": alt, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
14482
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
14483
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-${align}${border ? ' border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }))));
14485
14484
  };
14486
14485
  /* harmony default export */ const components_Image = (Image);
14487
14486
 
@@ -94430,16 +94429,23 @@ const compatibility_html = (node) => {
94430
94429
  return xml.replace(/<html.*<body>(.*)<\/body><\/html>/ms, '$1');
94431
94430
  };
94432
94431
  const figureToImageBlock = (node) => {
94433
- const _a = node.children.find((child) => child.type === 'image'), { align, width, src, alt, title } = _a, image = compatibility_rest(_a, ["align", "width", "src", "alt", "title"]);
94432
+ 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"]);
94434
94433
  const { className } = image.data.hProperties;
94435
94434
  const figcaption = node.children.find((child) => child.type === 'figcaption');
94436
- const caption = figcaption ? toMarkdown({
94437
- type: 'paragraph',
94438
- children: figcaption.children,
94439
- }).trim() : null;
94440
- 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 });
94435
+ const caption = figcaption
94436
+ ? toMarkdown({
94437
+ type: 'paragraph',
94438
+ children: figcaption.children,
94439
+ }).trim()
94440
+ : null;
94441
+ 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 });
94441
94442
  return `<Image ${formatProps(attributes)} />`;
94442
94443
  };
94444
+ const embedToEmbedBlock = (node) => {
94445
+ const _a = node.data.hProperties, { html } = _a, embed = compatibility_rest(_a, ["html"]);
94446
+ const attributes = Object.assign(Object.assign({}, embed), (html && { html: encodeURIComponent(html) }));
94447
+ return `<Embed ${formatProps(attributes)} />`;
94448
+ };
94443
94449
  const compatibility = (node) => {
94444
94450
  var _a, _b;
94445
94451
  switch (node.type) {
@@ -94456,8 +94462,7 @@ const compatibility = (node) => {
94456
94462
  case 'figure':
94457
94463
  return figureToImageBlock(node);
94458
94464
  case 'embed':
94459
- const attributes = formatHProps(node);
94460
- return `<Embed ${attributes} />`;
94465
+ return embedToEmbedBlock(node);
94461
94466
  default:
94462
94467
  throw new Error('Unhandled node type!');
94463
94468
  }
package/dist/main.node.js CHANGED
@@ -14334,7 +14334,7 @@ const CreateHeading = (depth) => (props) => external_amd_react_commonjs_react_co
14334
14334
  ;// CONCATENATED MODULE: ./components/Image/index.tsx
14335
14335
 
14336
14336
  const Image = (Props) => {
14337
- const { align = '', alt = '', border = false, caption, className = '', height = 'auto', src, title = '', width = 'auto', lazy = false, children, } = Props;
14337
+ const { align = 'center', alt = '', border = false, caption, className = '', height = 'auto', src, title = '', width = 'auto', lazy = true, children, } = Props;
14338
14338
  const [lightbox, setLightbox] = external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.useState(false);
14339
14339
  if (className === 'emoji') {
14340
14340
  return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, alt: alt, loading: lazy ? 'lazy' : 'eager' });
@@ -14362,16 +14362,15 @@ const Image = (Props) => {
14362
14362
  setLightbox(!lightbox);
14363
14363
  };
14364
14364
  if (caption) {
14365
- return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": alt, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
14366
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
14367
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("figure", null,
14368
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-center ${border ? 'border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }),
14365
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("figure", null,
14366
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": alt, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
14367
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
14368
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-center${border ? ' border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }),
14369
14369
  external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("figcaption", null, children || caption)))));
14370
14370
  }
14371
- return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("p", null,
14372
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": alt, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
14373
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
14374
- external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-${align} ${border ? 'border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' })))));
14371
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { "aria-label": alt, className: `img lightbox ${lightbox ? 'open' : 'closed'}`, onClick: toggle, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 },
14372
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("span", { className: "lightbox-inner" },
14373
+ external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_.createElement("img", { src: src, width: width, height: height, title: title, className: `img img-align-${align}${border ? ' border' : ''}`, alt: alt, loading: lazy ? 'lazy' : 'eager' }))));
14375
14374
  };
14376
14375
  /* harmony default export */ const components_Image = (Image);
14377
14376
 
@@ -95883,16 +95882,23 @@ const compatibility_html = (node) => {
95883
95882
  return xml.replace(/<html.*<body>(.*)<\/body><\/html>/ms, '$1');
95884
95883
  };
95885
95884
  const figureToImageBlock = (node) => {
95886
- const _a = node.children.find((child) => child.type === 'image'), { align, width, src, alt, title } = _a, image = compatibility_rest(_a, ["align", "width", "src", "alt", "title"]);
95885
+ 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"]);
95887
95886
  const { className } = image.data.hProperties;
95888
95887
  const figcaption = node.children.find((child) => child.type === 'figcaption');
95889
- const caption = figcaption ? toMarkdown({
95890
- type: 'paragraph',
95891
- children: figcaption.children,
95892
- }).trim() : null;
95893
- 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 });
95888
+ const caption = figcaption
95889
+ ? toMarkdown({
95890
+ type: 'paragraph',
95891
+ children: figcaption.children,
95892
+ }).trim()
95893
+ : null;
95894
+ 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 });
95894
95895
  return `<Image ${formatProps(attributes)} />`;
95895
95896
  };
95897
+ const embedToEmbedBlock = (node) => {
95898
+ const _a = node.data.hProperties, { html } = _a, embed = compatibility_rest(_a, ["html"]);
95899
+ const attributes = Object.assign(Object.assign({}, embed), (html && { html: encodeURIComponent(html) }));
95900
+ return `<Embed ${formatProps(attributes)} />`;
95901
+ };
95896
95902
  const compatibility = (node) => {
95897
95903
  var _a, _b;
95898
95904
  switch (node.type) {
@@ -95909,8 +95915,7 @@ const compatibility = (node) => {
95909
95915
  case 'figure':
95910
95916
  return figureToImageBlock(node);
95911
95917
  case 'embed':
95912
- const attributes = formatHProps(node);
95913
- return `<Embed ${attributes} />`;
95918
+ return embedToEmbedBlock(node);
95914
95919
  default:
95915
95920
  throw new Error('Unhandled node type!');
95916
95921
  }
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": "6.75.0-beta.65",
5
+ "version": "6.75.0-beta.66",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",