@readme/markdown 6.75.0-beta.57 → 6.75.0-beta.58

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.
@@ -35,7 +35,19 @@ const Embed = ({
35
35
  ...attrs
36
36
  }: EmbedProps) => {
37
37
  if (typeof iframe !== 'boolean') iframe = iframe === 'true';
38
- if (html === 'false') html = undefined;
38
+
39
+ if (html) {
40
+ try {
41
+ if (html !== decodeURIComponent(html)) {
42
+ html = decodeURIComponent(html);
43
+ } else if (html === 'false') {
44
+ html = undefined;
45
+ }
46
+ } catch (e) {
47
+ // html wasn't HTML apparently
48
+ html = undefined;
49
+ }
50
+ }
39
51
 
40
52
  if (iframe) {
41
53
  return <iframe {...attrs} src={url} style={{ border: 'none', display: 'flex', margin: 'auto' }} />;
@@ -54,7 +66,7 @@ const Embed = ({
54
66
  return (
55
67
  <div className={classes.join(' ')}>
56
68
  {html ? (
57
- <div className="embed-media" dangerouslySetInnerHTML={{ __html: decodeURIComponent(html) }} />
69
+ <div className="embed-media" dangerouslySetInnerHTML={{ __html: html }} />
58
70
  ) : (
59
71
  <a className="embed-link" href={url} rel="noopener noreferrer" target="_blank">
60
72
  {!image || <img alt={title} className="embed-img" loading={lazy ? 'lazy' : undefined} src={image} />}
package/dist/main.js CHANGED
@@ -14306,8 +14306,20 @@ const Embed = (_a) => {
14306
14306
  var { lazy = true, url, html, providerName, providerUrl, title, iframe, image, favicon } = _a, attrs = __rest(_a, ["lazy", "url", "html", "providerName", "providerUrl", "title", "iframe", "image", "favicon"]);
14307
14307
  if (typeof iframe !== 'boolean')
14308
14308
  iframe = iframe === 'true';
14309
- if (html === 'false')
14310
- html = undefined;
14309
+ if (html) {
14310
+ try {
14311
+ if (html !== decodeURIComponent(html)) {
14312
+ html = decodeURIComponent(html);
14313
+ }
14314
+ else if (html === 'false') {
14315
+ html = undefined;
14316
+ }
14317
+ }
14318
+ catch (e) {
14319
+ // html wasn't HTML apparently
14320
+ html = undefined;
14321
+ }
14322
+ }
14311
14323
  if (iframe) {
14312
14324
  return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("iframe", Object.assign({}, attrs, { src: url, style: { border: 'none', display: 'flex', margin: 'auto' } }));
14313
14325
  }
@@ -14319,7 +14331,7 @@ const Embed = (_a) => {
14319
14331
  if (!providerName)
14320
14332
  providerName = providerUrl;
14321
14333
  const classes = ['embed', image ? 'embed_hasImg' : ''];
14322
- return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: classes.join(' ') }, html ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "embed-media", dangerouslySetInnerHTML: { __html: decodeURIComponent(html) } })) : (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("a", { className: "embed-link", href: url, rel: "noopener noreferrer", target: "_blank" },
14334
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: classes.join(' ') }, html ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "embed-media", dangerouslySetInnerHTML: { __html: html } })) : (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("a", { className: "embed-link", href: url, rel: "noopener noreferrer", target: "_blank" },
14323
14335
  !image || external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("img", { alt: title, className: "embed-img", loading: lazy ? 'lazy' : undefined, src: image }),
14324
14336
  title && title !== '@embed' ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "embed-body" },
14325
14337
  !favicon || external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Favicon, { alt: providerName, src: favicon }),
package/dist/main.node.js CHANGED
@@ -9252,8 +9252,20 @@ const Embed = (_a) => {
9252
9252
  var { lazy = true, url, html, providerName, providerUrl, title, iframe, image, favicon } = _a, attrs = __rest(_a, ["lazy", "url", "html", "providerName", "providerUrl", "title", "iframe", "image", "favicon"]);
9253
9253
  if (typeof iframe !== 'boolean')
9254
9254
  iframe = iframe === 'true';
9255
- if (html === 'false')
9256
- html = undefined;
9255
+ if (html) {
9256
+ try {
9257
+ if (html !== decodeURIComponent(html)) {
9258
+ html = decodeURIComponent(html);
9259
+ }
9260
+ else if (html === 'false') {
9261
+ html = undefined;
9262
+ }
9263
+ }
9264
+ catch (e) {
9265
+ // html wasn't HTML apparently
9266
+ html = undefined;
9267
+ }
9268
+ }
9257
9269
  if (iframe) {
9258
9270
  return external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("iframe", Object.assign({}, attrs, { src: url, style: { border: 'none', display: 'flex', margin: 'auto' } }));
9259
9271
  }
@@ -9265,7 +9277,7 @@ const Embed = (_a) => {
9265
9277
  if (!providerName)
9266
9278
  providerName = providerUrl;
9267
9279
  const classes = ['embed', image ? 'embed_hasImg' : ''];
9268
- return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: classes.join(' ') }, html ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "embed-media", dangerouslySetInnerHTML: { __html: decodeURIComponent(html) } })) : (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("a", { className: "embed-link", href: url, rel: "noopener noreferrer", target: "_blank" },
9280
+ return (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: classes.join(' ') }, html ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "embed-media", dangerouslySetInnerHTML: { __html: html } })) : (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("a", { className: "embed-link", href: url, rel: "noopener noreferrer", target: "_blank" },
9269
9281
  !image || external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("img", { alt: title, className: "embed-img", loading: lazy ? 'lazy' : undefined, src: image }),
9270
9282
  title && title !== '@embed' ? (external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement("div", { className: "embed-body" },
9271
9283
  !favicon || external_amd_react_commonjs_react_commonjs2_react_root_React_umd_react_default().createElement(Favicon, { alt: providerName, src: favicon }),
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.57",
5
+ "version": "6.75.0-beta.58",
6
6
  "main": "dist/main.node.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "browser": "dist/main.js",